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

Cecil Westerhof cldwesterhof at gmail.com
Fri Mar 25 00:08:14 CET 2011


2011/3/24 Cecil Westerhof <cldwesterhof at gmail.com>

> \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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ntg.nl/pipermail/ntg-context/attachments/20110325/d2a5d708/attachment.html>


More information about the ntg-context mailing list