summaryrefslogtreecommitdiff
path: root/tex/context/base
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2019-12-12 02:01:50 +0100
committerContext Git Mirror Bot <phg@phi-gamma.net>2019-12-12 02:01:50 +0100
commite75317d1924dd10388f154df7412a0ab201e455e (patch)
tree2fc6cfd0391d3997cdaf1f8120cfa1a55bc30d10 /tex/context/base
parentf74c4055713ab52a11d12435eb04040ec6553129 (diff)
downloadcontext-e75317d1924dd10388f154df7412a0ab201e455e.tar.gz
2019-12-12 01:07:00
Diffstat (limited to 'tex/context/base')
-rw-r--r--tex/context/base/mkii/cont-new.mkii2
-rw-r--r--tex/context/base/mkii/context.mkii2
-rw-r--r--tex/context/base/mkii/mult-fr.mkii3
-rw-r--r--tex/context/base/mkiv/char-tex.lua1
-rw-r--r--tex/context/base/mkiv/cont-new.mkiv2
-rw-r--r--tex/context/base/mkiv/cont-run.lua5
-rw-r--r--tex/context/base/mkiv/context.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkxl2
-rw-r--r--tex/context/base/mkiv/lpdf-fmt.lua172
-rw-r--r--tex/context/base/mkiv/lpdf-tag.lua40
-rw-r--r--tex/context/base/mkiv/lpdf-wid.lua339
-rw-r--r--tex/context/base/mkiv/luat-cnf.lua44
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin26605 -> 26588 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin269165 -> 269277 bytes
-rw-r--r--tex/context/base/mkiv/syst-ini.mkiv9
-rw-r--r--tex/context/base/mkiv/syst-ini.mkxl50
-rw-r--r--tex/context/base/mkiv/util-zip.lua44
17 files changed, 483 insertions, 234 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index c68d0bd30..1a0170924 100644
--- a/tex/context/base/mkii/cont-new.mkii
+++ b/tex/context/base/mkii/cont-new.mkii
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2019.12.06 19:45}
+\newcontextversion{2019.12.12 00:57}
%D This file is loaded at runtime, thereby providing an
%D excellent place for hacks, patches, extensions and new
diff --git a/tex/context/base/mkii/context.mkii b/tex/context/base/mkii/context.mkii
index cf49f51f0..c80c787d3 100644
--- a/tex/context/base/mkii/context.mkii
+++ b/tex/context/base/mkii/context.mkii
@@ -20,7 +20,7 @@
%D your styles an modules.
\edef\contextformat {\jobname}
-\edef\contextversion{2019.12.06 19:45}
+\edef\contextversion{2019.12.12 00:57}
%D For those who want to use this:
diff --git a/tex/context/base/mkii/mult-fr.mkii b/tex/context/base/mkii/mult-fr.mkii
index 02135bcbf..de8778e45 100644
--- a/tex/context/base/mkii/mult-fr.mkii
+++ b/tex/context/base/mkii/mult-fr.mkii
@@ -232,6 +232,7 @@
\setinterfacevariable{handwritten}{manuscript}
\setinterfacevariable{hang}{suspend}
\setinterfacevariable{hanging}{suspend}
+\setinterfacevariable{hangingboth}{hangingboth}
\setinterfacevariable{head}{tete}
\setinterfacevariable{header}{entete}
\setinterfacevariable{headintext}{headintext}
@@ -1044,6 +1045,7 @@
\setinterfaceconstant{overprint}{overprint}
\setinterfaceconstant{ownerpassword}{ownerpassword}
\setinterfaceconstant{ownnumber}{numeroproprio}
+\setinterfaceconstant{packcriterium}{packcriterium}
\setinterfaceconstant{page}{page}
\setinterfaceconstant{pageboundaries}{limitespage}
\setinterfaceconstant{pagecolor}{couleurpage}
@@ -1053,6 +1055,7 @@
\setinterfaceconstant{pageconversion}{pageconversion}
\setinterfaceconstant{pageconversionset}{pageconversionset}
\setinterfaceconstant{pageleft}{pageleft}
+\setinterfaceconstant{pagemethod}{pagemethod}
\setinterfaceconstant{pagenumber}{numeropage}
\setinterfaceconstant{pageprefix}{pageprefix}
\setinterfaceconstant{pageprefixconnector}{pageprefixconnector}
diff --git a/tex/context/base/mkiv/char-tex.lua b/tex/context/base/mkiv/char-tex.lua
index bbaf11875..b361a9a07 100644
--- a/tex/context/base/mkiv/char-tex.lua
+++ b/tex/context/base/mkiv/char-tex.lua
@@ -692,7 +692,6 @@ if not csletters then
else
mark(csletters)
-
end
lpegpatterns.csletter = utfchartabletopattern(csletters)
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index 32d0ff457..a461be673 100644
--- a/tex/context/base/mkiv/cont-new.mkiv
+++ b/tex/context/base/mkiv/cont-new.mkiv
@@ -13,7 +13,7 @@
% \normalend % uncomment this to get the real base runtime
-\newcontextversion{2019.12.06 19:45}
+\newcontextversion{2019.12.12 00:57}
%D This file is loaded at runtime, thereby providing an excellent place for
%D hacks, patches, extensions and new features.
diff --git a/tex/context/base/mkiv/cont-run.lua b/tex/context/base/mkiv/cont-run.lua
index 2634654fe..9a2b3db96 100644
--- a/tex/context/base/mkiv/cont-run.lua
+++ b/tex/context/base/mkiv/cont-run.lua
@@ -166,10 +166,7 @@ if sandboxing then
-- We block some potential escapes from protection.
- context [[
- \let\primitive \relax
- \let\normalprimitive\relax
- ]]
+ context [[\let\primitive\relax\let\normalprimitive\relax]]
debug = {
traceback = traceback,
diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv
index fa33068b2..e3ee67729 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -45,7 +45,7 @@
%D {YYYY.MM.DD HH:MM} format.
\edef\contextformat {\jobname}
-\edef\contextversion{2019.12.06 19:45}
+\edef\contextversion{2019.12.12 00:57}
\edef\contextkind {beta}
%D Kind of special:
diff --git a/tex/context/base/mkiv/context.mkxl b/tex/context/base/mkiv/context.mkxl
index 38e339ec8..1a56b8e3b 100644
--- a/tex/context/base/mkiv/context.mkxl
+++ b/tex/context/base/mkiv/context.mkxl
@@ -29,7 +29,7 @@
%D {YYYY.MM.DD HH:MM} format.
\edef\contextformat {\jobname}
-\edef\contextversion{2019.12.06 19:45}
+\edef\contextversion{2019.12.12 00:57}
\edef\contextkind {beta}
%D Kind of special:
diff --git a/tex/context/base/mkiv/lpdf-fmt.lua b/tex/context/base/mkiv/lpdf-fmt.lua
index 25a72fa49..f56b56b52 100644
--- a/tex/context/base/mkiv/lpdf-fmt.lua
+++ b/tex/context/base/mkiv/lpdf-fmt.lua
@@ -81,10 +81,13 @@ local prefixes = {
cmyk = "DefaultCMYK",
}
-local formatspecification, formatname = nil, nil
+local formatspecification = nil
+local formatname = nil
-- * correspondent document wide flags (write once) needed for permission tests
+-- defaults as mt
+
local formats = utilities.storage.allocate {
version = {
external_icc_profiles = 1.4, -- 'p' in name; URL reference of output intent
@@ -95,6 +98,7 @@ local formats = utilities.storage.allocate {
optional_content = 1.5,
transparency = 1.4,
object_compression = 1.5,
+ attachments = 1.7,
},
default = {
pdf_version = 1.7, -- todo: block tex primitive
@@ -113,10 +117,11 @@ local formats = utilities.storage.allocate {
open_prepress_interface = true, -- unknown
optional_content = true, -- todo: block at lua level
transparency = true, -- todo: block at lua level
- jbig2_compression = true, -- todo: block at lua level
- jpeg2000_compression = true, -- todo: block at lua level
+ jbig2_compression = true, -- todo: block at lua level (dropped anyway)
+ jpeg2000_compression = true, -- todo: block at lua level (dropped anyway)
include_cidsets = true,
include_charsets = true,
+ attachments = true,
inject_metadata = function()
-- nothing
end
@@ -133,6 +138,7 @@ local formats = utilities.storage.allocate {
internal_icc_profiles = true,
include_cidsets = true,
include_charsets = true,
+ attachments = false,
inject_metadata = function()
addtoinfo("GTS_PDFXVersion","PDF/X-1a:2001")
injectxmpinfo("xml://rdf:RDF","<rdf:Description rdf:about='' xmlns:pdfxid='http://www.npes.org/pdfx/ns/id/'><pdfxid:GTS_PDFXVersion>PDF/X-1a:2001</pdfxid:GTS_PDFXVersion></rdf:Description>",false)
@@ -149,6 +155,7 @@ local formats = utilities.storage.allocate {
internal_icc_profiles = true,
include_cidsets = true,
include_charsets = true,
+ attachments = false,
inject_metadata = function()
addtoinfo("GTS_PDFXVersion","PDF/X-1a:2003")
injectxmpinfo("xml://rdf:RDF","<rdf:Description rdf:about='' xmlns:pdfxid='http://www.npes.org/pdfx/ns/id/'><pdfxid:GTS_PDFXVersion>PDF/X-1a:2003</pdfxid:GTS_PDFXVersion></rdf:Description>",false)
@@ -169,6 +176,7 @@ local formats = utilities.storage.allocate {
include_intents = true,
include_cidsets = true,
include_charsets = true,
+ attachments = false,
inject_metadata = function()
addtoinfo("GTS_PDFXVersion","PDF/X-3:2002")
end
@@ -189,6 +197,7 @@ local formats = utilities.storage.allocate {
jbig2_compression = true,
include_cidsets = true,
include_charsets = true,
+ attachments = false,
inject_metadata = function()
addtoinfo("GTS_PDFXVersion","PDF/X-3:2003")
end
@@ -213,6 +222,7 @@ local formats = utilities.storage.allocate {
object_compression = true,
include_cidsets = true,
include_charsets = true,
+ attachments = false,
inject_metadata = function()
injectxmpinfo("xml://rdf:RDF","<rdf:Description rdf:about='' xmlns:pdfxid='http://www.npes.org/pdfx/ns/id/'><pdfxid:GTS_PDFXVersion>PDF/X-4</pdfxid:GTS_PDFXVersion></rdf:Description>",false)
insertxmpinfo("xml://rdf:Description/xmpMM:InstanceID","<xmpMM:VersionID>1</xmpMM:VersionID>",false)
@@ -240,6 +250,7 @@ local formats = utilities.storage.allocate {
object_compression = true,
include_cidsets = true,
include_charsets = true,
+ attachments = false,
inject_metadata = function()
injectxmpinfo("xml://rdf:RDF","<rdf:Description rdf:about='' xmlns:pdfxid='http://www.npes.org/pdfx/ns/id/'><pdfxid:GTS_PDFXVersion>PDF/X-4p</pdfxid:GTS_PDFXVersion></rdf:Description>",false)
insertxmpinfo("xml://rdf:Description/xmpMM:InstanceID","<xmpMM:VersionID>1</xmpMM:VersionID>",false)
@@ -267,6 +278,7 @@ local formats = utilities.storage.allocate {
object_compression = true,
include_cidsets = true,
include_charsets = true,
+ attachments = false,
inject_metadata = function()
-- todo
end
@@ -293,6 +305,7 @@ local formats = utilities.storage.allocate {
object_compression = true,
include_cidsets = true,
include_charsets = true,
+ attachments = false,
inject_metadata = function()
-- todo
end
@@ -318,6 +331,7 @@ local formats = utilities.storage.allocate {
object_compression = true,
include_cidsets = true,
include_charsets = true,
+ attachments = false,
inject_metadata = function()
-- todo
end
@@ -334,11 +348,12 @@ local formats = utilities.storage.allocate {
calibrated_rgb_colors = true, -- unknown
cielab_colors = true, -- unknown
include_intents = true,
- forms = true, -- NEW; forms are allowed (with limitations); no JS, other restrictions are unknown (TODO)
- tagging = true, -- NEW; the only difference to PDF/A-1b
+ forms = true, -- new: forms are allowed (with limitations); no JS, other restrictions are unknown (TODO)
+ tagging = true, -- new: the only difference to PDF/A-1b
internal_icc_profiles = true,
include_cidsets = true,
include_charsets = true,
+ attachments = false,
inject_metadata = function()
injectxmpinfo("xml://rdf:RDF","<rdf:Description rdf:about='' xmlns:pdfaid='http://www.aiim.org/pdfa/ns/id/'><pdfaid:part>1</pdfaid:part><pdfaid:conformance>A</pdfaid:conformance></rdf:Description>",false)
end
@@ -359,11 +374,14 @@ local formats = utilities.storage.allocate {
internal_icc_profiles = true,
include_cidsets = true,
include_charsets = true,
+ attachments = false,
inject_metadata = function()
injectxmpinfo("xml://rdf:RDF","<rdf:Description rdf:about='' xmlns:pdfaid='http://www.aiim.org/pdfa/ns/id/'><pdfaid:part>1</pdfaid:part><pdfaid:conformance>B</pdfaid:conformance></rdf:Description>",false)
end
},
- ["pdf/a-2a"] = { -- untested; only PDF/A Attachments are allowed
+ -- Only PDF/A Attachments are allowed but we don't check the attachments
+ -- for any quality: they are just blobs.
+ ["pdf/a-2a"] = {
pdf_version = 1.7,
format_name = "pdf/a-2a",
xmp_file = "lpdf-pda.xml",
@@ -378,17 +396,74 @@ local formats = utilities.storage.allocate {
forms = true,
tagging = true,
internal_icc_profiles = true,
- transparency = true, -- NEW
+ transparency = true, -- new
jbig2_compression = true,
- jpeg2000_compression = true, -- NEW
- object_compression = true,
+ jpeg2000_compression = true, -- new
+ object_compression = true, -- new
include_cidsets = false,
include_charsets = false,
+ attachments = true,
inject_metadata = function()
injectxmpinfo("xml://rdf:RDF","<rdf:Description rdf:about='' xmlns:pdfaid='http://www.aiim.org/pdfa/ns/id/'><pdfaid:part>2</pdfaid:part><pdfaid:conformance>A</pdfaid:conformance></rdf:Description>",false)
end
},
- ["pdf/a-3a"] = { -- untested; NEW: any type of attachment is allowed
+ ["pdf/a-2b"] = {
+ pdf_version = 1.7,
+ format_name = "pdf/a-2b",
+ xmp_file = "lpdf-pda.xml",
+ gts_flag = "GTS_PDFA1",
+ gray_scale = true,
+ cmyk_colors = true,
+ rgb_colors = true,
+ spot_colors = true,
+ calibrated_rgb_colors = true, -- unknown
+ cielab_colors = true, -- unknown
+ include_intents = true,
+ forms = true,
+ tagging = false,
+ internal_icc_profiles = true,
+ transparency = true,
+ jbig2_compression = true,
+ jpeg2000_compression = true,
+ object_compression = true,
+ include_cidsets = false,
+ include_charsets = false,
+ attachments = "externa",
+ inject_metadata = function()
+ injectxmpinfo("xml://rdf:RDF","<rdf:Description rdf:about='' xmlns:pdfaid='http://www.aiim.org/pdfa/ns/id/'><pdfaid:part>2</pdfaid:part><pdfaid:conformance>B</pdfaid:conformance></rdf:Description>",false)
+ end
+ },
+ -- This is like the b variant, but it requires Unicode mapping of fonts
+ -- which we do anyway.
+ ["pdf/a-2u"] = {
+ pdf_version = 1.7,
+ format_name = "pdf/a-2u",
+ xmp_file = "lpdf-pda.xml",
+ gts_flag = "GTS_PDFA1",
+ gray_scale = true,
+ cmyk_colors = true,
+ rgb_colors = true,
+ spot_colors = true,
+ calibrated_rgb_colors = true, -- unknown
+ cielab_colors = true, -- unknown
+ include_intents = true,
+ forms = true,
+ tagging = false,
+ internal_icc_profiles = true,
+ transparency = true,
+ jbig2_compression = true,
+ jpeg2000_compression = true,
+ object_compression = true,
+ include_cidsets = false,
+ include_charsets = false,
+ attachments = "external",
+ inject_metadata = function()
+ injectxmpinfo("xml://rdf:RDF","<rdf:Description rdf:about='' xmlns:pdfaid='http://www.aiim.org/pdfa/ns/id/'><pdfaid:part>2</pdfaid:part><pdfaid:conformance>U</pdfaid:conformance></rdf:Description>",false)
+ end
+ },
+ -- Any type of attachment is allowed but we don't check the quality
+ -- of them.
+ ["pdf/a-3a"] = {
pdf_version = 1.7,
format_name = "pdf/a-3a",
xmp_file = "lpdf-pda.xml",
@@ -409,10 +484,63 @@ local formats = utilities.storage.allocate {
object_compression = true,
include_cidsets = false,
include_charsets = false,
+ attachments = "internal",
inject_metadata = function()
injectxmpinfo("xml://rdf:RDF","<rdf:Description rdf:about='' xmlns:pdfaid='http://www.aiim.org/pdfa/ns/id/'><pdfaid:part>3</pdfaid:part><pdfaid:conformance>A</pdfaid:conformance></rdf:Description>",false)
end
},
+ ["pdf/a-3b"] = {
+ pdf_version = 1.7,
+ format_name = "pdf/a-3b",
+ xmp_file = "lpdf-pda.xml",
+ gts_flag = "GTS_PDFA1",
+ gray_scale = true,
+ cmyk_colors = true,
+ rgb_colors = true,
+ spot_colors = true,
+ calibrated_rgb_colors = true, -- unknown
+ cielab_colors = true, -- unknown
+ include_intents = true,
+ forms = true,
+ tagging = false,
+ internal_icc_profiles = true,
+ transparency = true,
+ jbig2_compression = true,
+ jpeg2000_compression = true,
+ object_compression = true,
+ include_cidsets = false,
+ include_charsets = false,
+ attachments = "external",
+ inject_metadata = function()
+ injectxmpinfo("xml://rdf:RDF","<rdf:Description rdf:about='' xmlns:pdfaid='http://www.aiim.org/pdfa/ns/id/'><pdfaid:part>3</pdfaid:part><pdfaid:conformance>B</pdfaid:conformance></rdf:Description>",false)
+ end
+ },
+ ["pdf/a-3u"] = {
+ pdf_version = 1.7,
+ format_name = "pdf/a-3u",
+ xmp_file = "lpdf-pda.xml",
+ gts_flag = "GTS_PDFA1",
+ gray_scale = true,
+ cmyk_colors = true,
+ rgb_colors = true,
+ spot_colors = true,
+ calibrated_rgb_colors = true, -- unknown
+ cielab_colors = true, -- unknown
+ include_intents = true,
+ forms = true,
+ tagging = false,
+ internal_icc_profiles = true,
+ transparency = true,
+ jbig2_compression = true,
+ jpeg2000_compression = true,
+ object_compression = true,
+ include_cidsets = false,
+ include_charsets = false,
+ attachments = "external",
+ inject_metadata = function()
+ injectxmpinfo("xml://rdf:RDF","<rdf:Description rdf:about='' xmlns:pdfaid='http://www.aiim.org/pdfa/ns/id/'><pdfaid:part>3</pdfaid:part><pdfaid:conformance>U</pdfaid:conformance></rdf:Description>",false)
+ end
+ },
["pdf/ua-1"] = { -- based on PDF/A-3a, but no 'gts_flag'
pdf_version = 1.7,
format_name = "pdf/ua-1",
@@ -433,6 +561,7 @@ local formats = utilities.storage.allocate {
object_compression = true,
include_cidsets = true,
include_charsets = true, --- really ?
+ attachments = true,
inject_metadata = function()
injectxmpinfo("xml://rdf:RDF","<rdf:Description rdf:about='' xmlns:pdfaid='http://www.aiim.org/pdfa/ns/id/'><pdfaid:part>3</pdfaid:part><pdfaid:conformance>A</pdfaid:conformance></rdf:Description>",false)
injectxmpinfo("xml://rdf:RDF","<rdf:Description rdf:about='' xmlns:pdfuaid='http://www.aiim.org/pdfua/ns/id/'><pdfuaid:part>1</pdfuaid:part></rdf:Description>",false)
@@ -626,10 +755,16 @@ local function handledefaultprofile(s,spec) -- specification
end
end
-local loadedintents, intents = { }, pdfarray()
+local loadedintents = { }
+local intents = pdfarray()
local function handleoutputintent(s,spec)
- local name, url, filename, id, outputcondition, info = s.info or s.filename or "", s.url or "", s.filename or "", s.id or "", s.outputcondition or "", s.info or ""
+ local url = s.url or ""
+ local filename = s.filename or ""
+ local name = s.info or filename
+ local id = s.id or ""
+ local outputcondition = s.outputcondition or ""
+ local info = s.info or ""
if name == "" or id == "" then
report_backend("error in output intent specification: %s",serialize(s,false))
elseif not loadedintents[name] then
@@ -771,8 +906,13 @@ function codeinjections.setformat(s)
-- cid sets can always omitted now, but those validators still complain so let's
-- for a while keep it (for luigi):
--
- lpdf.setomitcidset (formatspecification.include_cidsets == false and 1 or 0)
- lpdf.setomitcharset(formatspecification.include_charsets == false and 1 or 0)
+ lpdf.setomitcidset (formatspecification.include_cidsets == false and 1 or 0) -- why a number
+ lpdf.setomitcharset(formatspecification.include_charsets == false and 1 or 0) -- why a number
+ --
+ -- maybe block by pdf version
+ --
+ codeinjections.settaggingsupport(formatspecification.tagging)
+ codeinjections.setattachmentsupport(formatspecification.attachments)
--
-- context.setupcolors { -- not this way
-- cmyk = spec.cmyk_colors and variables.yes or variables.no,
@@ -847,6 +987,10 @@ function codeinjections.getformatoption(key)
return formatspecification and formatspecification[key]
end
+-- function codeinjections.getformatspecification()
+-- return formatspecification
+-- end
+
function codeinjections.supportedformats()
local t = { }
for k, v in sortedhash(formats.data) do
diff --git a/tex/context/base/mkiv/lpdf-tag.lua b/tex/context/base/mkiv/lpdf-tag.lua
index d99e09243..61a6999c1 100644
--- a/tex/context/base/mkiv/lpdf-tag.lua
+++ b/tex/context/base/mkiv/lpdf-tag.lua
@@ -26,6 +26,7 @@ local nodeinjections = backends.pdf.nodeinjections
local codeinjections = backends.pdf.codeinjections
local enableaction = nodes.tasks.enableaction
+local disableaction = nodes.tasks.disableaction
local pdfdictionary = lpdf.dictionary
local pdfarray = lpdf.array
@@ -695,13 +696,36 @@ end
-- this belongs elsewhere (export is not pdf related)
-function codeinjections.enabletags(tg,lb)
- structures.tags.handler = nodeinjections.addtags
- enableaction("shipouts","structures.tags.handler")
- enableaction("shipouts","nodes.handlers.accessibility")
- enableaction("math","noads.handlers.tags")
- -- maybe also textblock
- if trace_tags then
- report_tags("enabling structure tags")
+local permitted = true
+local enabled = false
+
+function codeinjections.settaggingsupport(option)
+ if option == false then
+ if enabled then
+ disableaction("shipouts","structures.tags.handler")
+ disableaction("shipouts","nodes.handlers.accessibility") -- maybe not this one
+ disableaction("math","noads.handlers.tags")
+ enabled = false
+ end
+ if permitted then
+ if trace_tags then
+ report_tags("blocking structure tags")
+ end
+ permitted = false
+ end
+ end
+end
+
+function codeinjections.enabletags()
+ if permitted and not enabled then
+ structures.tags.handler = nodeinjections.addtags
+ enableaction("shipouts","structures.tags.handler")
+ enableaction("shipouts","nodes.handlers.accessibility")
+ enableaction("math","noads.handlers.tags")
+ -- maybe also textblock
+ if trace_tags then
+ report_tags("enabling structure tags")
+ end
+ enabled = true
end
end
diff --git a/tex/context/base/mkiv/lpdf-wid.lua b/tex/context/base/mkiv/lpdf-wid.lua
index a538a9ad2..96b36324f 100644
--- a/tex/context/base/mkiv/lpdf-wid.lua
+++ b/tex/context/base/mkiv/lpdf-wid.lua
@@ -222,6 +222,25 @@ local referenced = { }
local ignorereferenced = true -- fuzzy pdf spec .. twice in attachment list, can become an option
local tobesavedobjrefs = utilities.storage.allocate()
local collectedobjrefs = utilities.storage.allocate()
+local permitted = true
+local enabled = true
+local embedded = true
+
+function codeinjections.setattachmentsupport(option)
+ if option == false then
+ permitted = false
+ enabled = false
+ embedded = true
+ elseif not permitted then
+ -- already dealt with
+ elseif option == "internal" or option == true then
+ enabled = true
+ embedded = true
+ elseif option == "external" then
+ enabled = true
+ embedded = false
+ end
+end
local fileobjreferences = {
collected = collectedobjrefs,
@@ -238,7 +257,7 @@ end
job.register('job.fileobjreferences.collected', tobesavedobjrefs, initializer)
local function flushembeddedfiles()
- if next(filestreams) then
+ if enabled and next(filestreams) then
local e = pdfarray()
for tag, reference in sortedhash(filestreams) do
if not reference then
@@ -259,178 +278,182 @@ end
lpdf.registerdocumentfinalizer(flushembeddedfiles,"embeddedfiles")
function codeinjections.embedfile(specification)
- local data = specification.data
- local filename = specification.file
- local name = specification.name or ""
- local title = specification.title or ""
- local hash = specification.hash or filename
- local keepdir = specification.keepdir -- can change
- local usedname = specification.usedname
- local filetype = specification.filetype
- local compress = specification.compress
- local mimetype = specification.mimetype or specification.mime
- if filename == "" then
- filename = nil
- end
- if compress == nil then
- compress = true
- end
- if data then
- local r = filestreams[hash]
- if r == false then
- return nil
- elseif r then
- return r
- elseif not filename then
- filename = specification.tag
- if not filename or filename == "" then
- filename = specification.registered
+ if enabled then
+ local data = specification.data
+ local filename = specification.file
+ local name = specification.name or ""
+ local title = specification.title or ""
+ local hash = specification.hash or filename
+ local keepdir = specification.keepdir -- can change
+ local usedname = specification.usedname
+ local filetype = specification.filetype
+ local compress = specification.compress
+ local mimetype = specification.mimetype or specification.mime
+ if filename == "" then
+ filename = nil
+ end
+ if compress == nil then
+ compress = true
+ end
+ if data then
+ local r = filestreams[hash]
+ if r == false then
+ return nil
+ elseif r then
+ return r
+ elseif not filename then
+ filename = specification.tag
+ if not filename or filename == "" then
+ filename = specification.registered
+ end
+ if not filename or filename == "" then
+ filename = hash
+ end
end
- if not filename or filename == "" then
- filename = hash
+ else
+ if not filename then
+ return nil
+ end
+ local r = filestreams[hash]
+ if r == false then
+ return nil
+ elseif r then
+ return r
+ else
+ local foundname = resolvers.findbinfile(filename) or ""
+ if foundname == "" or not lfs.isfile(foundname) then
+ filestreams[filename] = false
+ return nil
+ else
+ specification.foundname = foundname
+ end
end
end
- else
- if not filename then
- return nil
+ -- needs to cleaned up:
+ usedname = usedname ~= "" and usedname or filename or name
+ local basename = keepdir == true and usedname or file.basename(usedname)
+ local basename = gsub(basename,"%./","")
+ local savename = name ~= "" and name or basename
+ if not filetype or filetype == "" then
+ filetype = name and (filename and file.suffix(filename)) or "txt"
end
- local r = filestreams[hash]
- if r == false then
- return nil
- elseif r then
- return r
+ savename = file.addsuffix(savename,filetype) -- type is mandate for proper working in viewer
+ local a = pdfdictionary {
+ Type = pdfconstant("EmbeddedFile"),
+ Subtype = mimetype and mimetype ~= "" and pdfconstant(mimetype) or nil,
+ }
+ local f
+ if data then
+ f = pdfflushstreamobject(data,a)
+ specification.data = true -- signal that still data but already flushed
else
+ local foundname = specification.foundname or filename
+ local attributes = lfs.attributes(foundname)
+ if attributes then
+ a.Params = {
+ Size = attributes.size,
+ ModDate = lpdf.pdftimestamp(attributes.modification),
+ }
+ end
+ f = pdfflushstreamfileobject(foundname,a,compress)
+ end
+ local d = pdfdictionary {
+ Type = pdfconstant("Filespec"),
+ F = pdfstring(savename),
+ -- UF = pdfstring(savename),
+ UF = pdfunicode(savename),
+ EF = pdfdictionary { F = pdfreference(f) },
+ Desc = title ~= "" and pdfunicode(title) or nil,
+ AFRelationship = pdfconstant("Unspecified"), -- Supplement, Data, Source, Alternative, Data
+ }
+ local r = pdfreference(pdfflushobject(d))
+ filestreams[hash] = r
+ return r
+ end
+end
+
+function nodeinjections.attachfile(specification)
+ if enabled then
+ local registered = specification.registered or "<unset>"
+ local data = specification.data
+ local hash
+ local filename
+ if data then
+ hash = md5.HEX(data)
+ else
+ filename = specification.file
+ if not filename or filename == "" then
+ report_attachment("no file specified, using registered %a instead",registered)
+ filename = registered
+ specification.file = registered
+ end
local foundname = resolvers.findbinfile(filename) or ""
if foundname == "" or not lfs.isfile(foundname) then
- filestreams[filename] = false
+ report_attachment("invalid filename %a, ignoring registered %a",filename,registered)
return nil
else
specification.foundname = foundname
end
+ hash = filename
end
- end
- -- needs to cleaned up:
- usedname = usedname ~= "" and usedname or filename or name
- local basename = keepdir == true and usedname or file.basename(usedname)
- local basename = gsub(basename,"%./","")
- local savename = name ~= "" and name or basename
- if not filetype or filetype == "" then
- filetype = name and (filename and file.suffix(filename)) or "txt"
- end
- savename = file.addsuffix(savename,filetype) -- type is mandate for proper working in viewer
- local a = pdfdictionary {
- Type = pdfconstant("EmbeddedFile"),
- Subtype = mimetype and mimetype ~= "" and pdfconstant(mimetype) or nil,
- }
- local f
- if data then
- f = pdfflushstreamobject(data,a)
- specification.data = true -- signal that still data but already flushed
- else
- local foundname = specification.foundname or filename
- local attributes = lfs.attributes(foundname)
- if attributes then
- a.Params = {
- Size = attributes.size,
- ModDate = lpdf.pdftimestamp(attributes.modification),
- }
+ specification.hash = hash
+ nofattachments = nofattachments + 1
+ local registered = specification.registered or ""
+ local title = specification.title or ""
+ local subtitle = specification.subtitle or ""
+ local author = specification.author or ""
+ if registered == "" then
+ registered = filename
end
- f = pdfflushstreamfileobject(foundname,a,compress)
- end
- local d = pdfdictionary {
- Type = pdfconstant("Filespec"),
- F = pdfstring(savename),
- -- UF = pdfstring(savename),
- UF = pdfunicode(savename),
- EF = pdfdictionary { F = pdfreference(f) },
- Desc = title ~= "" and pdfunicode(title) or nil,
- AFRelationship = pdfconstant("Unspecified"), -- Supplement, Data, Source, Alternative, Data
- }
- local r = pdfreference(pdfflushobject(d))
- filestreams[hash] = r
- return r
-end
-
-function nodeinjections.attachfile(specification)
- local registered = specification.registered or "<unset>"
- local data = specification.data
- local hash
- local filename
- if data then
- hash = md5.HEX(data)
- else
- filename = specification.file
- if not filename or filename == "" then
- report_attachment("no file specified, using registered %a instead",registered)
- filename = registered
- specification.file = registered
+ if author == "" and title ~= "" then
+ author = title
+ title = filename or ""
+ end
+ if author == "" then
+ author = filename or "<unknown>"
+ end
+ if title == "" then
+ title = registered
end
- local foundname = resolvers.findbinfile(filename) or ""
- if foundname == "" or not lfs.isfile(foundname) then
- report_attachment("invalid filename %a, ignoring registered %a",filename,registered)
- return nil
+ local aref = attachments[registered]
+ if not aref then
+ aref = codeinjections.embedfile(specification)
+ attachments[registered] = aref
+ end
+ local reference = specification.reference
+ if reference and aref then
+ tobesavedobjrefs[reference] = aref[1]
+ end
+ if not aref then
+ report_attachment("skipping attachment, registered %a",registered)
+ -- already reported
+ elseif specification.method == v_hidden then
+ referenced[hash] = "hidden"
else
- specification.foundname = foundname
+ referenced[hash] = "annotation"
+ local name, appearance = analyzesymbol(specification.symbol,attachment_symbols)
+ local d = pdfdictionary {
+ Subtype = pdfconstant("FileAttachment"),
+ FS = aref,
+ Contents = pdfunicode(title),
+ Name = name,
+ NM = pdfstring("attachment:"..nofattachments),
+ T = author ~= "" and pdfunicode(author) or nil,
+ Subj = subtitle ~= "" and pdfunicode(subtitle) or nil,
+ C = analyzecolor(specification.colorvalue,specification.colormodel),
+ CA = analyzetransparency(specification.transparencyvalue),
+ AP = appearance,
+ OC = analyzelayer(specification.layer),
+ }
+ local width = specification.width or 0
+ local height = specification.height or 0
+ local depth = specification.depth or 0
+ local box = hpack_node(nodeinjections.annotation(width,height,depth,d()))
+ box.width = width
+ box.height = height
+ box.depth = depth
+ return box
end
- hash = filename
- end
- specification.hash = hash
- nofattachments = nofattachments + 1
- local registered = specification.registered or ""
- local title = specification.title or ""
- local subtitle = specification.subtitle or ""
- local author = specification.author or ""
- if registered == "" then
- registered = filename
- end
- if author == "" and title ~= "" then
- author = title
- title = filename or ""
- end
- if author == "" then
- author = filename or "<unknown>"
- end
- if title == "" then
- title = registered
- end
- local aref = attachments[registered]
- if not aref then
- aref = codeinjections.embedfile(specification)
- attachments[registered] = aref
- end
- local reference = specification.reference
- if reference and aref then
- tobesavedobjrefs[reference] = aref[1]
- end
- if not aref then
- report_attachment("skipping attachment, registered %a",registered)
- -- already reported
- elseif specification.method == v_hidden then
- referenced[hash] = "hidden"
- else
- referenced[hash] = "annotation"
- local name, appearance = analyzesymbol(specification.symbol,attachment_symbols)
- local d = pdfdictionary {
- Subtype = pdfconstant("FileAttachment"),
- FS = aref,
- Contents = pdfunicode(title),
- Name = name,
- NM = pdfstring("attachment:"..nofattachments),
- T = author ~= "" and pdfunicode(author) or nil,
- Subj = subtitle ~= "" and pdfunicode(subtitle) or nil,
- C = analyzecolor(specification.colorvalue,specification.colormodel),
- CA = analyzetransparency(specification.transparencyvalue),
- AP = appearance,
- OC = analyzelayer(specification.layer),
- }
- local width = specification.width or 0
- local height = specification.height or 0
- local depth = specification.depth or 0
- local box = hpack_node(nodeinjections.annotation(width,height,depth,d()))
- box.width = width
- box.height = height
- box.depth = depth
- return box
end
end
@@ -438,6 +461,8 @@ function codeinjections.attachmentid(filename) -- not used in context
return filestreams[filename]
end
+-- Comments
+
local nofcomments = 0
local usepopupcomments = false
diff --git a/tex/context/base/mkiv/luat-cnf.lua b/tex/context/base/mkiv/luat-cnf.lua
index 88e7a7353..ebda6e8cd 100644
--- a/tex/context/base/mkiv/luat-cnf.lua
+++ b/tex/context/base/mkiv/luat-cnf.lua
@@ -61,16 +61,34 @@ function texconfig.init()
libraries = { -- we set it here as we want libraries also 'indexed'
basiclua = {
- "string", "table", "coroutine", "debug", "file", "io", "lpeg", "math", "os", "package", "bit32",
+ -- always
+ "string", "table", "coroutine", "debug", "file", "io", "lpeg", "math", "os", "package",
+ -- bonus
+ "bit32", "utf8",
},
- basictex = { -- noad
- "callback", "font", "img", "lang", "lua", "node", "pdf", "status", "tex", "texconfig", "texio", "token",
+ basictex = {
+ -- always
+ "callback", "font", "lang", "lua", "node", "status", "tex", "texconfig", "texio", "token",
+ -- not in luametatex
+ "img", "pdf",
},
extralua = {
- "gzip", "zip", "zlib", "lfs", "ltn12", "mime", "socket", "md5", "fio", "unicode", "utf",
+ -- not in luametatex
+ "unicode", "utf", "gzip", "zip", "zlib",
+ -- in luametatex
+ "xzip", "xmath", "xcomplex", "basexx",
+ -- maybe some day in luametatex
+ "lz4", "lzo",
+ -- always (mime can go)
+ "lfs","socket", "mime", "md5", "sha2", "fio", "sio",
},
extratex = {
- "pdfe", "kpse", "mplib",
+ -- not in luametatex
+ "kpse",
+ -- always
+ "pdfe", "mplib",
+ -- in luametatex
+ "pdfdecode", "pngdecode",
},
obsolete = {
"epdf",
@@ -123,16 +141,24 @@ function texconfig.init()
-- shortcut and helper
- local setbytecode = lua.setbytecode
- local getbytecode = lua.getbytecode
+ local setbytecode = lua.setbytecode
+ local getbytecode = lua.getbytecode
+ local callbytecode = lua.callbytecode or function(i)
+ local b = getbytecode(i)
+ if b then
+ b()
+ return true
+ else
+ return false
+ end
+ end
local function init(start)
local i = start
local t = os.clock()
while true do
- local b = getbytecode(i)
+ local b = callbytecode(i)
if b then
- b() ;
setbytecode(i,nil) ;
i = i + 1
else
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 251d59539..9eaf11f05 100644
--- a/tex/context/base/mkiv/status-files.pdf
+++ b/tex/context/base/mkiv/status-files.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf
index 24ef5be72..b30aaa78e 100644
--- a/tex/context/base/mkiv/status-lua.pdf
+++ b/tex/context/base/mkiv/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/syst-ini.mkiv b/tex/context/base/mkiv/syst-ini.mkiv
index c8de22b28..0dd1fe29c 100644
--- a/tex/context/base/mkiv/syst-ini.mkiv
+++ b/tex/context/base/mkiv/syst-ini.mkiv
@@ -97,13 +97,12 @@
%D Initialization of primitives.
\directlua {
- local baseprimitives = tex.extraprimitives("core","tex")
- local moreprimitives = tex.extraprimitives("etex","luatex")
+ local primitives = tex.extraprimitives("core","tex","etex","luatex")
- tex.enableprimitives("",moreprimitives)
+ % table.sort(primitives)
- tex.enableprimitives("normal",baseprimitives)
- tex.enableprimitives("normal",moreprimitives)
+ tex.enableprimitives("", primitives)
+ tex.enableprimitives("normal",primitives)
function tex.enableprimitives() end
}
diff --git a/tex/context/base/mkiv/syst-ini.mkxl b/tex/context/base/mkiv/syst-ini.mkxl
index 0befec48c..0ea381d07 100644
--- a/tex/context/base/mkiv/syst-ini.mkxl
+++ b/tex/context/base/mkiv/syst-ini.mkxl
@@ -94,18 +94,48 @@
\chardef\statuswrite 128
-%D Initialization of primitives.
+%D First we need to initialization the primitives. Because \CONTEXT\ is already a
+%D pretty old macro package, we have a couple of issues with respect to primitives.
+%D The \ETEX\ engine added a few as did \PDFTEX. The \LUATEX\ engine added even
+%D more. This means that there can be a potential clash between primitives and
+%D existing macros. The most noticeable ones are:
+%D
+%D \starttyping
+%D \protected
+%D \expanded
+%D \unexpanded
+%D \stoptyping
+%D
+%D Because we had macros like that before the primitives showed up. The protection
+%D related macros were there before we even knew about extensions to the engine.
+%D When the expansion related ones were introduced, we originally came up with
+%D different names but due to requests we used the current names, somethng that in
+%D retrospect was a bad idea: they should have gotten different names in \LUATEX, if
+%D only because at that time only \CONTEXT\ was using them in rolling releases.
+%D Anyway, we're now stuck with this situation, and it means that one should use the
+%D \type {\normal...} variants in low level code:
+%D
+%D \starttyping
+%D \normalexpanded
+%D \normalprotected
+%D \normalunexpanded
+%D \stoptyping
+%D
+%D In the end not using different names in \LUATEX\ for these kind of backfires. It
+%D makes not much sense to fix this in \LUAMETATEX\ because we're now to long on the
+%D road. It is actually the reason why we have the option in \LUATEX\ to alias all
+%D primitives in one go using a prefix. Actually this trick could be used to recover
+%D a primitive meaning: just enable it with some prefix and \type {\let} the
+%D original to that. But \unknown\ we prevent that trick below.
+%D
+%D The code below differs from \LUATEX: in \LUAMETATEX\ all primitives are already
+%D available; it cannot limit itself to being \TEX\ or \ETEX. It could not do that
+%D anyway because there are differences (no backend, to mention one).
\directlua {
- local baseprimitives = tex.extraprimitives("core","tex")
- local moreprimitives = tex.extraprimitives("etex","luatex")
-
- tex.enableprimitives("",moreprimitives)
-
- tex.enableprimitives("normal",baseprimitives)
- tex.enableprimitives("normal",moreprimitives)
-
- function tex.enableprimitives() end
+ local primitives = tex.extraprimitives() % "core","tex","etex","luatex"
+ tex.enableprimitives("normal",primitives) % could default to everything
+ function tex.enableprimitives() end % so we kind of protect what's there
}
\def\space{ }
diff --git a/tex/context/base/mkiv/util-zip.lua b/tex/context/base/mkiv/util-zip.lua
index 33f8d8a7e..f87e391a1 100644
--- a/tex/context/base/mkiv/util-zip.lua
+++ b/tex/context/base/mkiv/util-zip.lua
@@ -34,7 +34,7 @@ local band = bit32.band
local rshift = bit32.rshift
local lshift = bit32.lshift
-local decompress, calculatecrc
+local decompress, expandsize, calculatecrc
-- if flate then
--
@@ -44,17 +44,17 @@ local decompress, calculatecrc
-- else
local zlibdecompress = zlib.decompress
+ local zlibexpandsize = zlib.expandsize
local zlibchecksum = zlib.crc32
- decompress = function(source,targetsize)
- local target = zlibdecompress(source,-15)
- if target then
- return target
- else
- return false, 1
- end
+ decompress = function(source)
+ return zlibdecompress(source,-15) -- auto
end
+ expandsize = zlibexpandsize and function(source,targetsize)
+ return zlibexpandsize(source,targetsize,-15) -- auto
+ end or decompress
+
calculatecrc = function(buffer,initial)
return zlibchecksum(initial or 0,buffer)
end
@@ -183,8 +183,6 @@ local openzipfile, closezipfile, unzipfile, foundzipfile, getziphash, getziplist
end
end
- local expandsize = xzip.expandsize
-
function unzipfile(z,filename,check)
local hash = z.hash
if not hash then
@@ -483,19 +481,23 @@ if xzip then -- flate then do
local l = list[i]
local n = l.filename
local d = unzipfile(z,n) -- true for check
- local p = filejoin(path,n)
- if mkdirs(dirname(p)) then
- if steps then
- total = total + #d
- done = done + 1
- if done >= step then
- done = 0
- logwriter(format("%4i files of %4i done, %10i bytes, %0.3f seconds",i,count,total,osclock()-time))
+ if d then
+ local p = filejoin(path,n)
+ if mkdirs(dirname(p)) then
+ if steps then
+ total = total + #d
+ done = done + 1
+ if done >= step then
+ done = 0
+ logwriter(format("%4i files of %4i done, %10i bytes, %0.3f seconds",i,count,total,osclock()-time))
+ end
+ elseif verbose then
+ logwriter(n)
end
- elseif verbose then
- logwriter(n)
+ savedata(p,d)
end
- savedata(p,d)
+ else
+ logwriter(format("problem with file %s",n))
end
end
if steps then