From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/67345 Path: news.gmane.org!not-for-mail From: Cecil Westerhof Newsgroups: gmane.comp.tex.context Subject: Re: Use date of the tex file in the document Date: Thu, 24 Mar 2011 18:15:31 +0100 Message-ID: References: <20110324102202.GD3626@orcus> <20110324120017.78d5e9b9@glyph> <579A9EA3-A9B1-44A6-ABC8-36F733161523@googlemail.com> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2087944926==" X-Trace: dough.gmane.org 1300987144 4566 80.91.229.12 (24 Mar 2011 17:19:04 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 24 Mar 2011 17:19:04 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Thu Mar 24 18:18:58 2011 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([195.12.62.10]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Q2oBU-0007i2-I9 for gctc-ntg-context-518@m.gmane.org; Thu, 24 Mar 2011 18:18:56 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 94E1CCAB40; Thu, 24 Mar 2011 18:18:41 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 9EcChEVqyovw; Thu, 24 Mar 2011 18:18:30 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 13046CAB36; Thu, 24 Mar 2011 18:18:30 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 34073CAB36 for ; Thu, 24 Mar 2011 18:18:28 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id gJJBWR95s2No for ; Thu, 24 Mar 2011 18:18:17 +0100 (CET) Original-Received: from filter2-ams.mf.surf.net (filter2-ams.mf.surf.net [192.87.102.70]) by balder.ntg.nl (Postfix) with ESMTP id 30134CAB31 for ; Thu, 24 Mar 2011 18:18:17 +0100 (CET) Original-Received: from mail-fx0-f41.google.com (mail-fx0-f41.google.com [209.85.161.41]) by filter2-ams.mf.surf.net (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id p2OHIVFM020990 for ; Thu, 24 Mar 2011 18:18:31 +0100 Original-Received: by fxm18 with SMTP id 18so301008fxm.14 for ; Thu, 24 Mar 2011 10:18:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=yCllFDHeq3mOHyRvQ0dLtWSWzH6RqT3zSoaxhzLesK8=; b=dz6PPo4ao/KcZTWs7H9RcrFIUXw26IFwhQtWKYnQOdu7oKTys4YVNx1A6Mwn4Q70RN yd94oSy6ML2UkZdfmf+XD5aqxjx01Guw4x5F+m4mKvTb7aVV/MOPv5anJSwz38He+jMd W+pDJ6//FpzYfHYxZ7n08ZhWRGO2N0msy/m0w= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=UPW8Bp0y1xwjAnv7mJf6DFYrffHAzqor7lSI+ceFUlVFF3JhT8nazSGfxcA7wRVpE7 ZqxJ16v7UznYoSaS6IUtJsKk02yXeo2EbPjKc46dGf2gEuz0eHusSae8iEMJ4XwhG71/ a9RwTySPOb9LecPeddzXTpBsa4z+TWTGCDplg= Original-Received: by 10.223.159.9 with SMTP id h9mr1459026fax.145.1300986931807; Thu, 24 Mar 2011 10:15:31 -0700 (PDT) Original-Received: by 10.223.110.71 with HTTP; Thu, 24 Mar 2011 10:15:31 -0700 (PDT) In-Reply-To: <579A9EA3-A9B1-44A6-ABC8-36F733161523@googlemail.com> X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=209.85.161.41; country=US; region=CA; city=Mountain View; postalcode=94043; latitude=37.4192; longitude=-122.0574; metrocode=807; areacode=650; http://maps.google.com/maps?q=37.4192,-122.0574&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 0rEn5ivI7 - feec9dc2bf65 - 20110324 X-Scanned-By: CanIt (www . roaringpenguin . com) on 192.87.102.70 X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.12 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:67345 Archived-At: --===============2087944926== Content-Type: multipart/alternative; boundary=0023541868d4ed86c4049f3d9f47 --0023541868d4ed86c4049f3d9f47 Content-Type: text/plain; charset=ISO-8859-1 2011/3/24 Wolfgang Schuster > > 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"))}} \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 --0023541868d4ed86c4049f3d9f47 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
2011/3/24 Wolfgang Schuster &l= t;schuster.wolfgang@goo= glemail.com>

Am 24.03.2011 um 17:29 schrieb Cecil Westerhof:

> \def\getdate%
> =A0{\dosinglegroupempty\dogetdate}
>
> \def\dogetdate#1%
> =A0 {context{modification_date("\jobname.tex", "#1"= ;)}}

\def\getdate
=A0{\dosingleempty\dogetdate}

\def\dogetdate[#1]%
=A0{\ctalua{context(modification_date("\jobname.tex", "#1&q= uot;))}}

I have:
=A0=A0=A0 \startluacode
=A0= =A0=A0=A0=A0 function modification_date(file, format)
=A0=A0=A0=A0=A0=A0= =A0 local f=A0=A0=A0 =3D file
=A0=A0=A0=A0=A0=A0=A0 local attr =3D lfs.a= ttributes(f)

=A0=A0=A0=A0=A0=A0=A0 assert (type(attr) =3D=3D "table")
= =A0=A0=A0=A0=A0=A0=A0 if attr.mode ~=3D "directory" then
=A0= =A0=A0=A0=A0=A0=A0=A0=A0 if format =3D=3D "long" then
=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0 return os.date("%Y-%m-%d %H:%M",attr.= modification)
=A0=A0=A0=A0=A0=A0=A0=A0=A0 else
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 retur= n os.date("%Y-%m-%d",attr.modification)
=A0=A0=A0=A0=A0=A0=A0= =A0=A0 end
=A0=A0=A0=A0=A0=A0=A0 end
=A0=A0=A0=A0=A0 end
=A0=A0=A0= \stopluacode

=A0=A0=A0 \def\getdate
=A0=A0=A0=A0 {\dosingleempty= \dogetdate}

=A0=A0=A0 \def\dogetdate[#1]%
=A0=A0=A0=A0 {\ctalua{context(modification_date("\jobname.tex", &= quot;#1"))}}

=A0=A0=A0 \starttext

=A0=A0=A0 \getdate
=
=A0=A0=A0 \stoptext

This gives:
\dogetdate [#1]->\ctalua <= br>=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= {context(modification_date("\jobname .tex", "#1"))} l.29 \getdate[]
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0
?

= I tried with \getdate, \getdate{} and \getdate[].

-- Cecil Westerhof
--0023541868d4ed86c4049f3d9f47-- --===============2087944926== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@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 ___________________________________________________________________________________ --===============2087944926==--