diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/gitinfo2/gitexinfo.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/gitinfo2/gitexinfo.sty | 126 |
1 files changed, 126 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/gitinfo2/gitexinfo.sty b/Master/texmf-dist/tex/latex/gitinfo2/gitexinfo.sty new file mode 100644 index 00000000000..7767684eb8e --- /dev/null +++ b/Master/texmf-dist/tex/latex/gitinfo2/gitexinfo.sty @@ -0,0 +1,126 @@ +% gitexinfo.sty +% Copyright 2014 Brent Longborough +% +% This work 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. +% +% This work has the LPPL maintenance status `maintained'. +% The Current Maintainer of this work is Brent Longborough. +% +% This work consists of these files: +% gitinfo2.sty, gitexinfo.sty, gitinfo2.tex, gitinfo2.pdf, +% gitinfo2test.tex, post-git-sample.txt, +% and gitPseudoHeadInfo.gin +% ----------------------------------------------------- +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{gitexinfo}[2014/05/12 v2.00 Auxiliary package for gitinfo2] +\RequirePackage{kvoptions} +\RequirePackage{xstring} +\RequirePackage{etoolbox} +\SetupKeyvalOptions{family=gitinfo,prefix=gitInf@} +\DeclareStringOption{shash} +\DeclareStringOption{lhash} +\DeclareStringOption{authname} +\DeclareStringOption{authemail} +\DeclareStringOption{authsdate} +\DeclareStringOption{authidate} +\DeclareStringOption{authudate} +\DeclareStringOption{commname} +\DeclareStringOption{commemail} +\DeclareStringOption{commsdate} +\DeclareStringOption{commidate} +\DeclareStringOption{commudate} +\DeclareStringOption{refnames} +\DeclareStringOption{firsttagdescribe} +\DeclareStringOption{reltag} +\ProcessKeyvalOptions* +\renewcommand{\gitAbbrevHash}{\gitInf@shash} +\renewcommand{\gitHash}{\gitInf@lhash} +\renewcommand{\gitAuthorName}{\gitInf@authname} +\renewcommand{\gitAuthorEmail}{\gitInf@authemail} +\renewcommand{\gitAuthorDate}{\gitInf@authsdate} +\renewcommand{\gitAuthorIsoDate}{\gitInf@authidate} +\renewcommand{\gitAuthorUnixDate}{\gitInf@authudate} +\renewcommand{\gitCommitterName}{\gitInf@commname} +\renewcommand{\gitCommitterEmail}{\gitInf@commemail} +\renewcommand{\gitCommitterDate}{\gitInf@commsdate} +\renewcommand{\gitCommitterIsoDate}{\gitInf@commidate} +\renewcommand{\gitCommitterUnixDate}{\gitInf@commudate} +\renewcommand{\gitFirstTagDescribe}{\gitInf@firsttagdescribe} +\renewcommand{\gitReferences}{\gitInf@refnames} +\newcommand{\git@vtag}[1]{% + \def\do##1{% + \StrCut{##1}{tag: }\lcut\rcut% + \IfEq{\rcut}{}{% + \IfDecimal{\lcut}{% case where we have decimal e.g. 1.0 + \renewcommand{\gitVtag}{\lcut} + \renewcommand{\gitVtags}{\space\lcut} + \renewcommand{\gitVtagn}{\space\lcut} + \listbreak + }{}% + }{% + \IfDecimal\rcut{% case where we have string: decimal e.g. tag: 1.0 + \renewcommand{\gitVtag}{\rcut} + \renewcommand{\gitVtags}{\space\rcut} + \renewcommand{\gitVtagn}{\space\rcut} + \listbreak + }{}% + }% + }% + \expandafter\docsvlist\expandafter{#1}% + \StrDel{#1}{)}[\bcut]% + \StrDel{\bcut}{(HEAD}[\bcut]% + \StrCount{\bcut}{, }[\xcut]% + \StrCut[\xcut]{\bcut}{, }{\bcut}{\xcut}% + \IfEq{\xcut}{}{}{% + \renewcommand{\gitBranch}{\xcut}% + }% +}% +\newcommand{\git@taglist}[1]{% + \def\do##1{% + \StrCut{##1}{tag: }\llcut\rrcut% + \IfEq{\rrcut}{}{% + \IfDecimal{\llcut}{% case where we have decimal e.g. 1.0 + \StrGobbleLeft{\gitTags,\space\llcut}{0}[\gitTags] + }{}% + }{% + \StrGobbleLeft{\gitTags,\space\rrcut}{0}[\gitTags] + }% + }% + \expandafter\docsvlist\expandafter{#1}% + \StrGobbleLeft{\gitTags}{2}[\gitTags] +}% +\newcommand{\git@rtag}[1]{% + \IfEq{#1}{}{}{% + \StrRight{#1}{2}[\gitInf@dirtflag] + \StrDel{#1}{-*}[\gitInf@describe] + \IfEq{\gitInf@dirtflag}{-*}{\renewcommand{\gitDirty}{\gitInf@dirty}}{} + \StrGobbleRight{\gitInf@describe}{9}[\gitInf@describe]% Remove -g<hash> + \StrCount{\gitInf@describe}{-}[\gitInf@mcount]% Find last - + \StrCut[\gitInf@mcount]{\gitInf@describe}{-}{\gitInf@rel}{\gitInf@off} + \renewcommand{\gitRel}{\gitInf@rel} + \renewcommand{\gitRels}{\space\gitInf@rel} + \renewcommand{\gitReln}{\space\gitInf@rel} + \renewcommand{\gitRoff}{\gitInf@off} + \renewcommand{\gitDescribe}{#1} + }% +}% +\git@vtag{\gitInf@refnames} +\git@taglist{\gitInf@refnames} +\git@rtag{\gitInf@reltag} +\newcommand{\git@tagmark}{} +\IfEq{\gitTags}{}{% + \renewcommand{\gitTags}{\gitInf@notags} + \ifbool{gitInf@marknotags}{% + \renewcommand{\git@tagmark}{\\Head tags: \gitTags} + }{% + } +}{% + \renewcommand{\git@tagmark}{\\Head tags: \gitTags} +} +\renewcommand{\gitMark}{Branch: \gitBranch\,@\,\gitAbbrevHash{} / Release:\gitReln{} (\gitAuthorDate)\git@tagmark} |