summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/gitinfo2
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2014-09-01 22:26:27 +0000
committerKarl Berry <karl@freefriends.org>2014-09-01 22:26:27 +0000
commit5e3775e74d3445586dfb14b025aa3b758c9fe50d (patch)
tree795198834b5daf95029d06e094baf7af3b3983fe /Master/texmf-dist/tex/latex/gitinfo2
parent90a719a4e36e91ce8d6c935f4ad9e5b1e50e2c49 (diff)
gitinfo2 (1sep14)
git-svn-id: svn://tug.org/texlive/trunk@35083 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/gitinfo2')
-rw-r--r--Master/texmf-dist/tex/latex/gitinfo2/gitexinfo.sty126
-rw-r--r--Master/texmf-dist/tex/latex/gitinfo2/gitinfo2.sty198
2 files changed, 324 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}
diff --git a/Master/texmf-dist/tex/latex/gitinfo2/gitinfo2.sty b/Master/texmf-dist/tex/latex/gitinfo2/gitinfo2.sty
new file mode 100644
index 00000000000..e6dabe42ce9
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/gitinfo2/gitinfo2.sty
@@ -0,0 +1,198 @@
+% gitinfo2.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{gitinfo2}[2014/05/12 v2.00 git revision information]
+\RequirePackage{etoolbox}
+\RequirePackage{kvoptions}
+\RequirePackage{eso-pic}
+\SetupKeyvalOptions{family=gitinfo,prefix=gitInf@}
+\DeclareBoolOption{draft}
+\DeclareBoolOption{grumpy}
+\DeclareBoolOption{pcount}
+\DeclareBoolOption{footinfo}
+\DeclareBoolOption{mark}
+\DeclareBoolOption{markifdraft}
+\DeclareBoolOption{markifdirty}
+\DeclareBoolOption{marknotags}
+\DeclareStringOption[(None)]{missing}
+\DeclareStringOption[(None)]{notags}
+\DeclareStringOption[(*)]{dirty}
+\DeclareStringOption[4]{maxdepth}
+\DeclareStringOption[1.5\baselineskip]{raisemark}
+\ProcessKeyvalOptions*
+\newcommand{\gitAbbrevHash}{\gitInf@missing}
+\newcommand{\gitHash}{\gitInf@missing}
+\newcommand{\gitAuthorName}{\gitInf@missing}
+\newcommand{\gitAuthorEmail}{\gitInf@missing}
+\newcommand{\gitAuthorDate}{\gitInf@missing}
+\newcommand{\gitAuthorIsoDate}{\gitInf@missing}
+\newcommand{\gitAuthorUnixDate}{\gitInf@missing}
+\newcommand{\gitCommitterName}{\gitInf@missing}
+\newcommand{\gitCommitterEmail}{\gitInf@missing}
+\newcommand{\gitCommitterDate}{\gitInf@missing}
+\newcommand{\gitCommitterIsoDate}{\gitInf@missing}
+\newcommand{\gitCommitterUnixDate}{\gitInf@missing}
+\newcommand{\gitTags}{}
+\newcommand{\gitFirstTagDescribe}{\gitInf@missing}
+\newcommand{\gitReferences}{\gitInf@missing}
+\newcommand{\gitBranch}{\gitInf@missing}
+\newcommand{\gitVtag}{}
+\newcommand{\gitVtags}{}
+\newcommand{\gitVtagn}{\space\gitInf@missing}
+\newcommand{\gitRel}{}
+\newcommand{\gitRels}{}
+\newcommand{\gitReln}{\space\gitInf@missing}
+\newcommand{\gitDirty}{}
+\newcommand{\gitRoff}{}
+\newcommand{\gitDescribe}{(None)}
+\newcommand{\gitMarkPref}{[git]}
+\newcommand{\gitMarkFormat}{\color{gray}\small\sffamily}
+\newcommand{\gitMark}{}
+
+% private values
+\newif\ifGI@is@a@repo@
+
+% private constants
+\providecommand{\GI@repo@prefix}{}
+\providecommand{\GI@githeadinfo@file}{\GI@repo@prefix.git/gitHeadInfo.gin}
+\newcommand{\gitInf@dirtflag}{}
+\newcommand{\gitInf@describe}{}
+\newcommand{\gitInf@mcount}{}
+\newcommand{\gitInf@rel}{}
+\newcommand{\gitInf@off}{}
+
+% \TeX{}nical tools
+
+\newcommand\GI@export@macro[1]{%
+ \edef\@tempa{\endgroup
+ \def\noexpand#1{#1}}%
+ \@tempa}
+
+% finding the .git directory
+
+\newcommand\GI@check@repo@prefix{%
+ \GI@is@a@repo@true
+ \IfFileExists{./\GI@githeadinfo@file}{%
+ \edef\GI@repo@prefix{./}%
+ }{%
+ \GI@set@repo@prefix}}
+
+\newcommand\GI@set@repo@prefix{%
+ \begingroup \count@\gitInf@maxdepth\relax
+ \GI@set@repo@prefix@}
+
+\newcommand\GI@set@repo@prefix@{%
+ \advance\count@\m@ne
+ \ifnum\count@<\z@
+ % \expandafter\GI@not@a@git@repo
+ \endgroup\relax
+ \else
+ \edef\GI@repo@prefix{../\GI@repo@prefix}%
+ \IfFileExists{\GI@githeadinfo@file}{%
+ \PackageWarningNoLine{gitinfo2}{%
+ gitinfo2 found : \GI@githeadinfo@file \MessageBreak
+ }%
+ \GI@export@macro\GI@githeadinfo@file
+ }{%
+ \expandafter\GI@set@repo@prefix@}%
+ \fi}
+
+\GI@check@repo@prefix
+\InputIfFileExists{\GI@githeadinfo@file}{}{%
+ \ifbool{gitInf@grumpy}{%
+ \PackageError{gitinfo2}{I can't find the file '\GI@githeadinfo@file'\MessageBreak
+ Please check the manual (gitinfo2.pdf) \MessageBreak
+ if you need more details}{}
+ }{%
+ \PackageWarningNoLine{gitinfo2}{I can't find the file '\GI@githeadinfo@file'.\MessageBreak
+ All git metadata has been set to '\gitInf@missing'}
+ }
+}
+% ---------------------------------------------------------------------
+% Memoir support
+% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+\@ifclassloaded{memoir}{%
+ \ifbool{gitInf@pcount}{
+ \newcommand{\@gitPage}{\thepage/\thelastpage}
+ \addtodef{\frontmatter}{\renewcommand{\@gitPage}{\thepage}}{}
+ \addtodef{\mainmatter}{}{\renewcommand{\@gitPage}{\thepage/\thelastpage}}
+ }{%
+ \newcommand{\@gitPage}{\thepage}
+ }
+ \newcommand{\@gitFootRev}{Release\gitRels: \gitAbbrevHash{} (\gitAuthorDate)}
+ \newcommand{\@gitrFootRev}{%
+ \tiny\textsf{\raggedleft \@gitFootRev}%
+ }%
+ \newcommand{\@gitlFootRev}{%
+ \tiny\textsf{\@gitFootRev}%
+ }%
+ \copypagestyle{giplain}{plain}
+ \copypagestyle{giruled}{ruled}
+ \copypagestyle{giheadings}{headings}
+ \makeevenfoot{giplain}{\@gitPage}{}{\@gitrFootRev}
+ \makeoddfoot{giplain}{\@gitlFootRev}{}{\@gitPage}
+ \makeevenfoot{giruled}{\@gitPage}{}{\@gitrFootRev}
+ \makeoddfoot{giruled}{\@gitlFootRev}{}{\@gitPage}
+ \makeevenfoot{giheadings}{\@gitPage}{}{\@gitrFootRev}
+ \makeoddfoot{giheadings}{\@gitlFootRev}{}{\@gitPage}
+ \makeevenhead{giheadings}{}{}{\slshape\leftmark}
+ \makeoddhead{giheadings}{\slshape\rightmark}{}{}
+}{}%
+% ---------------------------------------------------------------------
+% Watermarking
+% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+\ifbool{gitInf@markifdirty}{%
+ \IfEq{\gitDirty}{}{}{%
+ \booltrue{gitInf@mark}
+ \renewcommand{\gitMarkPref}{[Dirty]}
+ }%
+}{}%
+\ifbool{gitInf@markifdraft}{%
+ \ifbool{gitInf@draft}{%
+ \booltrue{gitInf@mark}
+ \renewcommand{\gitMarkPref}{[Draft]}
+ }{}%
+}{}%
+\ifbool{gitInf@mark}{%
+ \AddToShipoutPictureBG{%
+ \AtPageLowerLeft{%
+ \raisebox{\gitInf@raisemark}{%
+ \makebox[\paperwidth]{%
+ \begin{minipage}[b]{\paperwidth}%
+ \renewcommand{\baselinestretch}{1}%
+ \centering{\gitMarkFormat\gitMarkPref{} \gitMark}%
+ \end{minipage}%
+ }%
+ }%
+ }%
+ }%
+}{}%
+% ---------------------------------------------------------------------
+% Datetime integration
+% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+\@ifpackageloaded{datetime}{%
+ \IfEq{\gitAuthorDate}{\gitInf@missing}{%
+ \newdate{gitdate}{\THEDAY}{\THEMONTH}{\THEYEAR}
+ }{%
+ \StrCut{\gitAuthorDate}{-}{\gitInf@year}{\gitInf@md}
+ \StrCut{\gitInf@md}{-}{\gitInf@month}{\gitInf@day}
+ \newdate{gitdate}{\gitInf@day}{\gitInf@month}{\gitInf@year}
+ }
+}{}%