diff options
author | Karl Berry <karl@freefriends.org> | 2022-10-09 20:16:32 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-10-09 20:16:32 +0000 |
commit | 397183e0ea8dbd39bacd6c3e44225ef8755e72af (patch) | |
tree | e89a35842d639bebbe9119b6fcf564504088efa8 /Master/texmf-dist/tex/latex/gitstatus | |
parent | e93c12770c6156c45d221eee825e9c70e38d953a (diff) |
gitstatus (9oct22)
git-svn-id: svn://tug.org/texlive/trunk@64662 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/gitstatus')
-rw-r--r-- | Master/texmf-dist/tex/latex/gitstatus/gitstatus.sty | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/gitstatus/gitstatus.sty b/Master/texmf-dist/tex/latex/gitstatus/gitstatus.sty new file mode 100644 index 00000000000..e6747b508e0 --- /dev/null +++ b/Master/texmf-dist/tex/latex/gitstatus/gitstatus.sty @@ -0,0 +1,61 @@ +%% +%% This is file `gitstatus.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% gitstatus.dtx (with options: `package') +%% Copyright (C) 2022 by Maximilian Gruber +%% +%% This file may be distributed and/or modified under the +%% conditions of the LaTeX Project Public License, either +%% version 1.3 of this license or (at your option) any later +%% version. The latest version of this license is in: +%% +%% http://www.latex-project.org/lppl.txt +%% +%% and version 1.3 or later is part of all distributions of +%% LaTeX version 2005/12/01 or later. +\NeedsTeXFormat{LaTeX2e}[2005/12/01] +\ProvidesPackage{gitstatus} + [2022/10/06 v1.1 Watermark Git Information Package] +\RequirePackage{kvoptions} +\RequirePackage{catchfile} +\RequirePackage{xstring} +\DeclareStringOption[.git/]{gitdir} % custom git dir (can be relative) +\DeclareBoolOption[false]{watermark} % watermark with branch + hash on top of page +\DeclareComplementaryOption{nowatermark}{watermark} +\DeclareBoolOption[false]{novariables} % disable creation of variables +\ProcessKeyvalOptions* +\def\gitstatus@headpath{\gitstatus@gitdir HEAD} +\IfFileExists{\gitstatus@headpath}{ + \CatchFileDef{\gitstatus@headfull}{\gitstatus@headpath}{} + \StrGobbleRight{\gitstatus@headfull}{1}[\gitstatus@head] + \StrBehind[2]{\gitstatus@head}{/}[\gitstatus@branch] +}{ + \def\gitstatus@branch{NOT AVAILABLE} + \PackageWarning{gitstatus}{Can't find HEAD (maybe check specified gitdir).} +} +\def\gitstatus@branchpath{\gitstatus@gitdir refs/heads/\gitstatus@branch} +\IfFileExists{\gitstatus@branchpath}{ + \CatchFileDef{\gitstatus@commit}{\gitstatus@branchpath}{} +}{ + \def\gitstatus@commit{NOT AVAILABLE} + \PackageWarning{gitstatus}{Can't read commit hash (maybe check specified gitdir).} +} +\ifgitstatus@novariables +\else + \def\gitdir{\gitstatus@gitdir} + \def\gitbranch{\gitstatus@branch} + \def\gitcommit{\gitstatus@commit} +\fi +\ifgitstatus@watermark + \RequirePackage{xcolor} + \RequirePackage[printwatermark]{xwatermark} + \newwatermark + [allpages,color=black!20,angle=0,scale=0.5,align=left,xpos=-2cm,ypos=13cm] + {On branch: \texttt{\gitstatus@branch}\\ Commit: \texttt{\gitstatus@commit}} +\fi +\endinput +%% +%% End of file `gitstatus.sty'. |