From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/67354 Path: news.gmane.org!not-for-mail From: Philipp Gesang Newsgroups: gmane.comp.tex.context Subject: Re: Use date of the tex file in the document Date: Thu, 24 Mar 2011 18:50:41 +0100 Message-ID: <20110324175031.GB4137@orcus.urz.uni-heidelberg.de> References: <20110324102202.GD3626@orcus> <20110324120017.78d5e9b9@glyph> <579A9EA3-A9B1-44A6-ABC8-36F733161523@googlemail.com> <20110324172929.GA4137@orcus.urz.uni-heidelberg.de> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0800093278==" X-Trace: dough.gmane.org 1300989057 16702 80.91.229.12 (24 Mar 2011 17:50:57 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 24 Mar 2011 17:50:57 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Thu Mar 24 18:50:53 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 1Q2ogO-0001GX-Rl for gctc-ntg-context-518@m.gmane.org; Thu, 24 Mar 2011 18:50:52 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id BE4DDCAB4F; Thu, 24 Mar 2011 18:50:37 +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 C0AIfq1PTp9I; Thu, 24 Mar 2011 18:50:34 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 01F25CAB40; Thu, 24 Mar 2011 18:50:34 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 993F4CAB40 for ; Thu, 24 Mar 2011 18:50:32 +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 NJCuP1Op2WS0 for ; Thu, 24 Mar 2011 18:50:30 +0100 (CET) Original-Received: from filter4-til.mf.surf.net (filter4-til.mf.surf.net [194.171.167.220]) by balder.ntg.nl (Postfix) with ESMTP id 67358CAB36 for ; Thu, 24 Mar 2011 18:50:30 +0100 (CET) Original-Received: from relay2.uni-heidelberg.de (relay2.uni-heidelberg.de [129.206.210.211]) by filter4-til.mf.surf.net (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id p2OHoi5i008403 for ; Thu, 24 Mar 2011 18:50:44 +0100 Original-Received: from ix.urz.uni-heidelberg.de (cyrus-portal.urz.uni-heidelberg.de [129.206.100.176]) by relay2.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id p2OHogLM019092 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 24 Mar 2011 18:50:43 +0100 Original-Received: from extmail.urz.uni-heidelberg.de (extmail.urz.uni-heidelberg.de [129.206.100.140]) by ix.urz.uni-heidelberg.de (8.13.8/8.13.8) with ESMTP id p2OHogkk012667 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 24 Mar 2011 18:50:42 +0100 Original-Received: from localhost (vpn193a.rzuser.uni-heidelberg.de [129.206.196.193]) by extmail.urz.uni-heidelberg.de (8.13.4/8.13.1) with ESMTP id p2OHofpE016463 for ; Thu, 24 Mar 2011 18:50:42 +0100 In-Reply-To: X-Operating-System: Linux orcus 2.6.37-ARCH User-Agent: Mutt/1.5.21 (2010-09-15) X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=129.206.210.211; country=DE; region=01; city=Heidelberg; latitude=49.4167; longitude=8.7000; http://maps.google.com/maps?q=49.4167,8.7000&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 05En5OIDA - a9b70901ad4a - 20110324 X-Scanned-By: CanIt (www . roaringpenguin . com) on 194.171.167.216 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:67354 Archived-At: --===============0800093278== Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="k4f25fnPtRuIRUb3" Content-Disposition: inline --k4f25fnPtRuIRUb3 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2011-03-24 <18:42:12>, Cecil Westerhof wrote: > 2011/3/24 Philipp Gesang >=20 > > > {\ctalua{context(modification_date("\jobname.tex", "#1"))}} > > ^ > > s/\\ctalua/\\ctxlua/ > > >=20 > I have: > \startluacode > function modification_date(file, format) > local f =3D file > local attr =3D lfs.attributes(f) >=20 > assert (type(attr) =3D=3D "table") > if attr.mode ~=3D "directory" then > if format =3D=3D "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 >=20 > \def\getdate > {\dosingleempty\dogetdate} >=20 > \def\dogetdate[#1]% > {\ctxlua{context(modification_date("\jobname.tex", "#1"))}} >=20 > \starttext >=20 > \getdate >=20 > \getdate{"short"} \getdate[long] \getdate[nil] \getdate[false] In context optional args are specified in brackets. It=E2=80=99s all documented on the wiki: http://wiki.contextgarden.net/Commands_with_optional_arguments Regards, phg >=20 > \getdate{"long"} >=20 > \stoptext >=20 > This gives: > 2011-03-24 > 2011-03-24"short" > 2011-03-24"long" >=20 > --=20 > Cecil Westerhof > _________________________________________________________________________= __________ > If your question is of interest to others as well, please add an entry to= the Wiki! >=20 > maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-co= ntext > webpage : http://www.pragma-ade.nl / http://tex.aanhet.net > archive : http://foundry.supelec.fr/projects/contextrev/ > wiki : http://contextgarden.net > _________________________________________________________________________= __________ --k4f25fnPtRuIRUb3 Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iEYEARECAAYFAk2LhHEACgkQ02lYlJYWs9KRgwCePAcHdztif6ntRfba1IaHXSOy oWkAnj5vp9BHGECz50S/Tu5iuI/SnKWa =hgiB -----END PGP SIGNATURE----- --k4f25fnPtRuIRUb3-- --===============0800093278== 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 ___________________________________________________________________________________ --===============0800093278==--