Il 23/02/24 14:32, Pablo Rodriguez via ntg-context ha scritto:
Dear list,
I have the following sample file:
\starttext
whatever
\startluacode
luatex.wrapup(
function()
local t = {}
local pdf_file_name = tex.jobname..".pdf"
local sha_pdf = utilities.sha2.hash256(io.loaddata(pdf_file_name))
local c_r = environment.currentrun
t[c_r] = sha_pdf
local exists_pdf = ("%s_%s-%s.pdf"):format(c_r-1, tex.jobname, t[c_r-1])
if io.exists(exists_pdf) then os.remove(exists_pdf) end
os.rename(pdf_file_name, ("%s_%s-%s.pdf"):format(c_r, tex.jobname,
sha_pdf))
end
)
\stopluacode
\stoptext
In short, it adds its SHA256 to the final filename.
Since renames the PDF document in each run, I would like to remove the
output from the previous run.
The table seems not to store the value from a previous run.
I see now that I am creating it again with each run.
Is there any way to check if compilation needs any other run?
Many thanks for your help,
Pablo
___________________________________________________________________________________
Hello Pablo,
you can keep the log, tuc and pdf file of every run with the --keeplog,
--keeptuc and --keeppdf options (type "context --help --expert" to know
about the file naming).
A new run is started unless:
- the maxruns number of runs has been reached
- the tuc file is identical to the one of the previous run
Massi
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the
Wiki!
maillist : ntg-context@ntg.nl /
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive : https://github.com/contextgarden/context
wiki : https://wiki.contextgarden.net
___________________________________________________________________________________