[NTG-context] typesetting information from git

Hans Hagen pragma at wxs.nl
Fri Feb 23 21:55:51 CET 2018

On 2/23/2018 9:38 PM, Schmitz Thomas A. wrote:
> Hi,
> I like to add a sort of watermark with info about the git revision at the bottom of some files that I typeset. I’m using Lua, so I have:
> context(os.resultof("git --no-pager log --pretty='%h of %aD' -1 foo.xml”))
> which gives something like "git revision b085c92a of Wed, 14 Feb 2018 12:49:35 +0100.” Suppose I want to make this more general. What would be the easiest way to either say “the xml file that is being processed” (something like arg[1]) or “the xml file whose name is in the Lua variable ‘foo?’”
I'm not sure if i understand well but something


context.setupdocument {
     gitversion = string.strip(os.resultof("git --no-pager log 
--pretty='%h of %aD' -1 foo.tex") or "")


  [this is from file: \documentvariable{gitversion}]




(as long as uou make sure you call the got command only once and not 
again in each footer)

                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl

More information about the ntg-context mailing list