* wrapup
@ 2018-09-21 11:01 Hans Hagen
2018-09-21 13:58 ` wrapup Procházka Lukáš Ing.
0 siblings, 1 reply; 2+ messages in thread
From: Hans Hagen @ 2018-09-21 11:01 UTC (permalink / raw)
To: mailing list for ConTeXt users
I'll add documentdata.variable so that one can do this:
\setupdocument
[id=foo]
\startluacode
luatex.wrapup(function()
local id = documentdata.variable("id")
if id and id ~= "" then
local oldname = file.addsuffix(environment.jobname,"pdf")
local newname = file.addsuffix("doc-"..id,"pdf")
if lfs.isfile(newname) then
-- print("removing",newname)
os.remove(newname)
end
if not lfs.isfile(newname) then
-- print("renaming",oldname,newname)
os.rename(oldname,newname)
end
if not lfs.isfile(newname) then
-- print("error in renaming")
end
end
end)
\stopluacode
\starttext
test
\stoptext
--
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: wrapup
2018-09-21 11:01 wrapup Hans Hagen
@ 2018-09-21 13:58 ` Procházka Lukáš Ing.
0 siblings, 0 replies; 2+ messages in thread
From: Procházka Lukáš Ing. @ 2018-09-21 13:58 UTC (permalink / raw)
To: mailing list for ConTeXt users
Hello,
just a note:
whilst command line option "--result=..." must point to the dir where the processed file is located, "os.rename()" allows to move files across dirs (at least on Win7), so this might be a way to evade "--result" limitation.
Best regards,
Lukas
On Fri, 21 Sep 2018 13:01:14 +0200, Hans Hagen <j.hagen@xs4all.nl> wrote:
> I'll add documentdata.variable so that one can do this:
>
> \setupdocument
> [id=foo]
>
> \startluacode
>
> luatex.wrapup(function()
> local id = documentdata.variable("id")
> if id and id ~= "" then
> local oldname = file.addsuffix(environment.jobname,"pdf")
> local newname = file.addsuffix("doc-"..id,"pdf")
> if lfs.isfile(newname) then
> -- print("removing",newname)
> os.remove(newname)
> end
> if not lfs.isfile(newname) then
> -- print("renaming",oldname,newname)
> os.rename(oldname,newname)
> end
> if not lfs.isfile(newname) then
> -- print("error in renaming")
> end
> end
> end)
>
> \stopluacode
>
> \starttext
>
> test
>
> \stoptext
>
--
Ing. Lukáš Procházka | mailto:LPr@pontex.cz
Pontex s. r. o. | mailto:pontex@pontex.cz | http://www.pontex.cz | IDDS: nrpt3sn | IČO: 40763439
Bezová 1658
147 14 Praha 4
Mob.: +420 702 033 396
___________________________________________________________________________________
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://context.aanhet.net
archive : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-09-21 13:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-21 11:01 wrapup Hans Hagen
2018-09-21 13:58 ` wrapup Procházka Lukáš Ing.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).