[NTG-context] wrapup

Procházka Lukáš Ing. LPr at pontex.cz
Fri Sep 21 15:58:56 CEST 2018


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 at 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 at pontex.cz
Pontex s. r. o.      | mailto:pontex at pontex.cz | http://www.pontex.cz | IDDS: nrpt3sn | IČO: 40763439
Bezová 1658
147 14 Praha 4

Mob.: +420 702 033 396



More information about the ntg-context mailing list