[NTG-context] Use date of the tex file in the document

Philipp Gesang pgesang at ix.urz.uni-heidelberg.de
Thu Mar 24 18:29:36 CET 2011


On 2011-03-24 <18:15:31>, Cecil Westerhof wrote:
> 2011/3/24 Wolfgang Schuster <schuster.wolfgang at googlemail.com>
> 
> >
> > Am 24.03.2011 um 17:29 schrieb Cecil Westerhof:
> >
> > > \def\getdate%
> > >  {\dosinglegroupempty\dogetdate}
> > >
> > > \def\dogetdate#1%
> > >   {context{modification_date("\jobname.tex", "#1")}}
> >
> > \def\getdate
> >  {\dosingleempty\dogetdate}
> >
> > \def\dogetdate[#1]%
> >  {\ctalua{context(modification_date("\jobname.tex", "#1"))}}
> >
> 
> I have:
>     \startluacode
>       function modification_date(file, format)
>         local f    = file
>         local attr = lfs.attributes(f)
> 
>         assert (type(attr) == "table")
>         if attr.mode ~= "directory" then
>           if format == "long" then
>             return os.date("%Y-%m-%d %H:%M",attr.modification)
>           else
>             return os.date("%Y-%m-%d",attr.modification)
>           end
>         end
>       end
>     \stopluacode
> 
>     \def\getdate
>      {\dosingleempty\dogetdate}
> 
>     \def\dogetdate[#1]%
>      {\ctalua{context(modification_date("\jobname.tex", "#1"))}}
           ^
s/\\ctalua/\\ctxlua/

Regards, Philipp
> 
>     \starttext
> 
>     \getdate
> 
>     \stoptext
> 
> This gives:
> \dogetdate [#1]->\ctalua
>                          {context(modification_date("\jobname .tex", "#1"))}
> l.29 \getdate[]
> 
> ?
> 
> I tried with \getdate, \getdate{} and \getdate[].
> 
> -- 
> Cecil Westerhof

> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
> 
> maillist : ntg-context at ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://www.ntg.nl/pipermail/ntg-context/attachments/20110324/c0eb4f27/attachment.pgp>


More information about the ntg-context mailing list