From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/67361 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: Fri, 25 Mar 2011 00:08:14 +0100 Message-ID: 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="===============0674795499==" X-Trace: dough.gmane.org 1301008141 984 80.91.229.12 (24 Mar 2011 23:09:01 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 24 Mar 2011 23:09:01 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Fri Mar 25 00:08:56 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 1Q2teC-000381-Ki for gctc-ntg-context-518@m.gmane.org; Fri, 25 Mar 2011 00:08:56 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id E57BDCAB4E; Fri, 25 Mar 2011 00:08:40 +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 3szygCG8gRGA; Fri, 25 Mar 2011 00:08:38 +0100 (CET) Original-Received: from balder.ntg.nl (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 45FE7CAB42; Fri, 25 Mar 2011 00:08:38 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id BB30BCAB42 for ; Fri, 25 Mar 2011 00:08:36 +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 VHZJLCrY4KH0 for ; Fri, 25 Mar 2011 00:08:25 +0100 (CET) Original-Received: from filter1-til.mf.surf.net (filter1-til.mf.surf.net [194.171.167.217]) by balder.ntg.nl (Postfix) with ESMTP id B14FACAB1A for ; Fri, 25 Mar 2011 00:08:25 +0100 (CET) Original-Received: from mail-bw0-f41.google.com (mail-bw0-f41.google.com [209.85.214.41]) by filter1-til.mf.surf.net (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id p2ON8ci8000678 for ; Fri, 25 Mar 2011 00:08:39 +0100 Original-Received: by bwz17 with SMTP id 17so732386bwz.14 for ; Thu, 24 Mar 2011 16:08:38 -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=U59DKlTo62Ku7OsW1mFBQOU1Q6yW9yHgxo2gCQDU1gU=; b=f6VLgTl4SRDr7K7J8vw27DdMsjgHp/17yVCjHsQBEKmLl6NOiHSeKS9NoeitYG7+FE XFdtwxzNw6O1qkUfFMMCXi8KLwniywp+02tg7xe/MlERQWSm0KMft42Y0aLWiRXT7kWR UGyjXhvMT9aqHHCN9zR6j+P/JCvE4F9NQE0MA= 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=wb5ixWFH1ov+x6efe/YP91v74KD+77RKYl33gmigKLYROPCpl5xYZ9xaOes/mY0Utj FH+cDqEVdGn0BgxJ7g5tZ7mAQRFt1rdByp+Qqq0mP/LgZtXzu8NgqNYcbfAOhA1Gvfz+ +XdnHuFF4UbK+VDa/IZDblFqVdEaoDtXAGnF4= Original-Received: by 10.204.7.3 with SMTP id b3mr57145bkb.160.1301008094881; Thu, 24 Mar 2011 16:08:14 -0700 (PDT) Original-Received: by 10.204.154.216 with HTTP; Thu, 24 Mar 2011 16:08:14 -0700 (PDT) In-Reply-To: X-Bayes-Prob: 0.0001 (Score 0, tokens from: @@RPTN) X-CanIt-Geo: ip=209.85.214.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: 08Enb8Crb - 21e8b19b542d - 20110325 X-Scanned-By: CanIt (www . roaringpenguin . com) on 194.171.167.217 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:67361 Archived-At: --===============0674795499== Content-Type: multipart/alternative; boundary=0003255561865868c6049f428dec --0003255561865868c6049f428dec Content-Type: text/plain; charset=ISO-8859-1 2011/3/24 Cecil Westerhof > \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 > I made the code a little better: \startluacode os.setlocale("nl_NL") function modification_date(file, format) local f = file local attr = lfs.attributes(f) local fmt = "%d %B %Y" assert (type(attr) == "table") if attr.mode ~= "directory" then if format == "long" then fmt = fmt .. " %H:%M" end return os.date(fmt,attr.modification) end end \stopluacode There is only one problem. I get: 25 March 2011 instead of: 25 maart 2011 What am I doing wrong? -- Cecil Westerhof --0003255561865868c6049f428dec Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
2011/3/24 Cecil Westerhof <= cldwesterhof@gmail.com>
\startluacode
=A0 func= tion modification_date(file, format)
=A0=A0=A0 local f=A0=A0=A0 =3D file=
=A0=A0=A0 local attr =3D lfs.attributes(f)

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

I made the code a little better:
\startl= uacode
=A0 os.setlocale("nl_NL")

=A0 function modificat= ion_date(file, format)
=A0=A0=A0 local f=A0=A0=A0 =3D file
=A0=A0=A0 local attr =3D lfs.attribu= tes(f)
=A0=A0=A0 local fmt=A0 =3D "%d %B %Y"

=A0=A0=A0 = assert (type(attr) =3D=3D "table")
=A0=A0=A0 if attr.mode ~=3D= "directory" then
=A0=A0=A0=A0=A0 if format =3D=3D "long&= quot; then
=A0=A0=A0=A0=A0=A0=A0 fmt =3D fmt .. " %H:%M"
=A0=A0=A0=A0=A0 = end
=A0=A0=A0=A0=A0 return os.date(fmt,attr.modification)
=A0=A0=A0 e= nd
=A0 end
\stopluacode

There is only one problem. I get:
= =A0 =A0 25 March 2011
instead of:
=A0 =A0 25 maart 2011

What am I doing wrong?

--
Cecil Westerhof
--0003255561865868c6049f428dec-- --===============0674795499== 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 ___________________________________________________________________________________ --===============0674795499==--