summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/lpdf-xmp.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2018-12-01 14:04:36 +0100
committerContext Git Mirror Bot <phg@phi-gamma.net>2018-12-01 14:04:36 +0100
commit6953b7c4b4c40fab660992622a6fd140fa310b34 (patch)
tree76f842098f2c24cdf3b63f26651cb58c8827950d /tex/context/base/mkiv/lpdf-xmp.lua
parent9bd28a3039a458b054459fe1ef80161b107b798f (diff)
downloadcontext-6953b7c4b4c40fab660992622a6fd140fa310b34.tar.gz
2018-12-01 13:28:00
Diffstat (limited to 'tex/context/base/mkiv/lpdf-xmp.lua')
-rw-r--r--tex/context/base/mkiv/lpdf-xmp.lua45
1 files changed, 25 insertions, 20 deletions
diff --git a/tex/context/base/mkiv/lpdf-xmp.lua b/tex/context/base/mkiv/lpdf-xmp.lua
index 43437962a..b9595062f 100644
--- a/tex/context/base/mkiv/lpdf-xmp.lua
+++ b/tex/context/base/mkiv/lpdf-xmp.lua
@@ -47,6 +47,7 @@ local mapping = {
["ConTeXt.Url"] = { "context", "rdf:Description/pdfx:ConTeXt.Url" },
["ConTeXt.Support"] = { "context", "rdf:Description/pdfx:ConTeXt.Support" },
["ConTeXt.Version"] = { "context", "rdf:Description/pdfx:ConTeXt.Version" },
+ ["ConTeXt.LMTX"] = { "context", "rdf:Description/pdfx:ConTeXt.LMTX" },
["TeX.Support"] = { "metadata","rdf:Description/pdfx:TeX.Support" },
["LuaTeX.Version"] = { "metadata","rdf:Description/pdfx:LuaTeX.Version" },
["LuaTeX.Functionality"] = { "metadata","rdf:Description/pdfx:LuaTeX.Functionality" },
@@ -111,50 +112,54 @@ function lpdf.id() -- overload of ini
return lpdfid(included.date)
end
-local pdfsettrailerid = lpdf.settrailerid -- this is the wrapped one
+local settrailerid = lpdf.settrailerid -- this is the wrapped one
-function lpdf.settrailerid(v)
- if v then
- local b = toboolean(v) or v == ""
+local trailerid = nil
+local dates = nil
+
+local function update()
+ if trailer_id then
+ local b = toboolean(trailer_id) or trailer_id == ""
if b then
- v = "This file is processed by ConTeXt and LuaTeX."
+ trailer_id = "This file is processed by ConTeXt and LuaTeX."
else
- v = tostring(v)
+ trailer_id = tostring(trailer_id)
end
- local h = md5HEX(v)
+ local h = md5HEX(trailer_id)
if b then
report_info("using frozen trailer id")
else
- report_info("using hashed trailer id %a (%a)",v,h)
+ report_info("using hashed trailer id %a (%a)",trailer_id,h)
end
- pdfsettrailerid(format("[<%s> <%s>]",h,h))
+ settrailerid(format("[<%s> <%s>]",h,h))
end
-end
-
-function lpdf.setdates(v)
- local t = type(v)
+ --
+ local t = type(dates)
if t == "number" or t == "string" then
- t = converters.totime(v)
+ t = converters.totime(dates)
if t then
included.date = true
included.id = "fake"
report_info("forced date/time information %a will be used",lpdf.settime(t))
- lpdf.settrailerid(false)
+ settrailerid(false)
return
end
end
- v = toboolean(v)
- included.date = v
- if v then
+ dates = toboolean(dates)
+ included.date = dates
+ if dates then
included.id = true
else
report_info("no date/time but fake id information will be added")
- lpdf.settrailerid(true)
+ settrailerid(true)
included.id = "fake"
- -- maybe: lpdf.settime(231631200) -- 1975-05-05 % first entry of knuth about tex mentioned in DT
end
end
+function lpdf.settrailerid(v) trailerid = v end
+function lpdf.setdates (v) dates = v end
+
+lpdf.registerdocumentfinalizer(update,"trailer id and dates",1)
directives.register("backend.trailerid", lpdf.settrailerid)
directives.register("backend.date", lpdf.setdates)