On 2011-03-25 <00:30:40>, Hans Hagen wrote:
> On 25-3-2011 12:08, Cecil Westerhof wrote:
>
> >I made the code a little better:
> >\startluacode
> > os.setlocale("nl_NL")
>
> blocked in mkiv to prevent unwanted side effects and that will stay
Still, one can access context’s language substitutio
On 25-3-2011 12:08, Cecil Westerhof wrote:
I made the code a little better:
\startluacode
os.setlocale("nl_NL")
blocked in mkiv to prevent unwanted side effects and that will stay
function modification_date(file, format)
local f= file
local attr = lfs.attributes(f)
why
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:
>> Thanks, nice! I suppose the filename is also directly reachable from inside
>> \startluacode ... \stopluacode. How?
>
> \start-stop luacode expands its contents. So, the following should work
> (untested)
>
> \startluacode
> thisfilename = "\thisfilename.tex"
> \stopluacode
No, that is not
On Thu, 24 Mar 2011, Florian Wobbe wrote:
How would you automatically find out the filename which the macro is called
from? For instance if the file with the macro is included in a master document.
\inputfilename
So, if you want the name of the file in which this macro is defined in, then
s
2011/3/24 Philipp Gesang
> > \getdate
> >
> > \getdate{"short"}
>
> \getdate[long]
> \getdate[nil]
> \getdate[false]
>
> In context optional args are specified in brackets.
I had tried \getdate["long"], but the quotes where wrong.
> It’s all
> documented on the wiki:
> http://wiki.contextga
On 24-3-2011 6:30, Marco wrote:
On 2011-03-24 Cecil Westerhof wrote:
\def\dogetdate[#1]%
{\ctalua{context(modification_date("\jobname.tex", "#1"))}}
^^^
Try \ctxlua …
or
\cldcontext{modification_date("\jobname.tex", "#1")}
but ... is it clever to define modificatio
>> How would you automatically find out the filename which the macro is called
>> from? For instance if the file with the macro is included in a master
>> document.
>
> \inputfilename
>
> So, if you want the name of the file in which this macro is defined in, then
> something like this should
On 2011-03-24 <18:42:12>, Cecil Westerhof wrote:
> 2011/3/24 Philipp Gesang
>
> > > {\ctalua{context(modification_date("\jobname.tex", "#1"))}}
> >^
> > s/\\ctalua/\\ctxlua/
> >
>
> I have:
> \startluacode
> function modification_date(file, format)
> local f= file
>
On Thu, 24 Mar 2011, Florian Wobbe wrote:
\def\getdate
{\dosingleempty\dogetdate}
\def\dogetdate[#1]%
{\ctalua{context(modification_date("\jobname.tex", "#1"))}}
How would you automatically find out the filename which the macro is called
from? For instance if the file with the macro is inc
2011/3/24 Philipp Gesang
> > {\ctalua{context(modification_date("\jobname.tex", "#1"))}}
>^
> s/\\ctalua/\\ctxlua/
>
I have:
\startluacode
function modification_date(file, format)
local f= file
local attr = lfs.attributes(f)
assert (type(attr) == "table")
> \def\getdate
> {\dosingleempty\dogetdate}
>
> \def\dogetdate[#1]%
> {\ctalua{context(modification_date("\jobname.tex", "#1"))}}
How would you automatically find out the filename which the macro is called
from? For instance if the file with the macro is included in a master document.
Florian
On 2011-03-24 Cecil Westerhof wrote:
> \def\dogetdate[#1]%
> {\ctalua{context(modification_date("\jobname.tex", "#1"))}}
^^^
Try \ctxlua …
Marco
___
If your question is of interest to others a
On 2011-03-24 <18:15:31>, Cecil Westerhof wrote:
> 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")}}
> >
> >
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]%
> {\c
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
2011/3/24 Aditya Mahajan
> \getdate would return os.date("%Y-%m-%d",attr.modification)
>> and
>> \getdate{"long"} would return os.date("%Y-%m-%d
>> %H:%M",attr.modification)
>>
>> I have looked at lua, but do not see how to do it. (Something else to
>> learn.)
>>
> I would like to do somethin
On Thu, 24 Mar 2011, Cecil Westerhof wrote:
2011/3/24 Marco
On 2011-03-24 Philipp Gesang wrote:
This should also work:
\starttext
\startluacode
function modification_date (file)
local f = file
local attr = lfs.attributes (f)
assert (type(attr) == "table")
if attr.mode ~= "dir
2011/3/24 Marco
> On 2011-03-24 Philipp Gesang wrote:
>
> This should also work:
>
> \starttext
>
> \startluacode
> function modification_date (file)
>local f = file
>local attr = lfs.attributes (f)
>assert (type(attr) == "table")
>if attr.mode ~= "directory" then
> return
On 2011-03-24 Philipp Gesang wrote:
This should also work:
\starttext
\startluacode
function modification_date (file)
local f = file
local attr = lfs.attributes (f)
assert (type(attr) == "table")
if attr.mode ~= "directory" then
return os.date("%Y-%m-%d %H:%M",attr.modif
2011/3/24 Philipp Gesang
> On 2011-03-24 <10:26:00>, Cecil Westerhof wrote:
> > I would like to use the date of the document in the generated PDF. (It is
> > not interesting when the PDF is generated, but when the source was last
> > changed.) How would I do this?
>
> this solution checks only th
On 2011-03-24 <10:26:00>, Cecil Westerhof wrote:
> I would like to use the date of the document in the generated PDF. (It is
> not interesting when the PDF is generated, but when the source was last
> changed.) How would I do this?
Hi Cecil,
this solution checks only the main file, you’d have to
I would like to use the date of the document in the generated PDF. (It is
not interesting when the PDF is generated, but when the source was last
changed.) How would I do this?
--
Cecil Westerhof
___
If your question
23 matches
Mail list logo