summaryrefslogtreecommitdiff
path: root/tex/context
diff options
context:
space:
mode:
authorContext Git Mirror Bot <phg42.2a@gmail.com>2016-01-29 20:15:07 +0100
committerContext Git Mirror Bot <phg42.2a@gmail.com>2016-01-29 20:15:07 +0100
commit397508ee8dca010aec5a9c6951b68434e5657f14 (patch)
treedae6e16fb8990964ba5261228231696cca3859a1 /tex/context
parent452587cdeefbf6e3bf1eee91e4e976f1135b785f (diff)
downloadcontext-397508ee8dca010aec5a9c6951b68434e5657f14.tar.gz
2016-01-29 19:02:00
Diffstat (limited to 'tex/context')
-rw-r--r--tex/context/base/context-version.pdfbin4176 -> 4175 bytes
-rw-r--r--tex/context/base/mkiv/cldf-ini.lua393
-rw-r--r--tex/context/base/mkiv/cldf-ini.mkiv14
-rw-r--r--tex/context/base/mkiv/cont-new.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkiv2
-rw-r--r--tex/context/base/mkiv/lxml-ini.lua1
-rw-r--r--tex/context/base/mkiv/lxml-ini.mkiv1
-rw-r--r--tex/context/base/mkiv/lxml-lpt.lua339
-rw-r--r--tex/context/base/mkiv/lxml-tex.lua10
-rw-r--r--tex/context/base/mkiv/node-res.lua48
-rw-r--r--tex/context/base/mkiv/publ-imp-apa.mkvi1
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin9104 -> 9092 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin270197 -> 270265 bytes
-rw-r--r--tex/context/base/mkiv/strc-flt.mkvi39
-rw-r--r--tex/context/base/mkiv/syst-ini.mkiv11
-rw-r--r--tex/context/interface/common/i-en-xml.xml722
-rw-r--r--tex/context/modules/mkiv/x-set-11.mkiv6
17 files changed, 1236 insertions, 353 deletions
diff --git a/tex/context/base/context-version.pdf b/tex/context/base/context-version.pdf
index 053e8e353..04f9a3448 100644
--- a/tex/context/base/context-version.pdf
+++ b/tex/context/base/context-version.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/cldf-ini.lua b/tex/context/base/mkiv/cldf-ini.lua
index f4819b11a..c6cc39abc 100644
--- a/tex/context/base/mkiv/cldf-ini.lua
+++ b/tex/context/base/mkiv/cldf-ini.lua
@@ -706,7 +706,7 @@ local containseol = patterns.containseol
local writer
-if luafunctions then
+-- if luafunctions then
writer = function (parent,command,first,...) -- already optimized before call
local t = { first, ... }
@@ -772,6 +772,7 @@ if luafunctions then
local tj = ti[1]
if type(tj) == "function" then
flush(currentcatcodes,"[\\cldl",storefunction(tj),"]")
+ -- flush(currentcatcodes,"[",storefunction(tj),"]")
else
flush(currentcatcodes,"[",tj,"]")
end
@@ -782,8 +783,10 @@ if luafunctions then
if type(tj) == "function" then
if j == tn then
flush(currentcatcodes,"\\cldl",storefunction(tj),"]")
+ -- flush(currentcatcodes,"",storefunction(tj),"]")
else
flush(currentcatcodes,"\\cldl",storefunction(tj),",")
+ -- flush(currentcatcodes,"",storefunction(tj),",")
end
else
if j == tn then
@@ -796,6 +799,7 @@ if luafunctions then
end
elseif typ == "function" then
flush(currentcatcodes,"{\\cldl ",storefunction(ti),"}") -- todo: ctx|prt|texcatcodes
+ -- flush(currentcatcodes,"{",storefunction(ti),"}") -- todo: ctx|prt|texcatcodes
elseif typ == "boolean" then
if ti then
flushdirect(currentcatcodes,"\r")
@@ -806,109 +810,110 @@ if luafunctions then
report_context("coroutines not supported as we cannot yield across boundaries")
elseif isnode(ti) then -- slow
flush(currentcatcodes,"{\\cldl",storenode(ti),"}")
+ -- flush(currentcatcodes,"{",storenode(ti),"}")
else
report_context("error: %a gets a weird argument %a",command,ti)
end
end
end
-else
-
- writer = function (parent,command,first,...) -- already optimized before call
- local t = { first, ... }
- flush(currentcatcodes,command) -- todo: ctx|prt|texcatcodes
- local direct = false
- for i=1,#t do
- local ti = t[i]
- local typ = type(ti)
- if direct then
- if typ == "string" or typ == "number" then
- flush(currentcatcodes,ti)
- else -- node.write
- report_context("error: invalid use of direct in %a, only strings and numbers can be flushed directly, not %a",command,typ)
- end
- direct = false
- elseif ti == nil then
- -- nothing
- elseif ti == "" then
- flush(currentcatcodes,"{}")
- elseif typ == "string" then
- -- is processelines seen ?
- if processlines and lpegmatch(containseol,ti) then
- flush(currentcatcodes,"{")
- local flushlines = parent.__flushlines or flushlines
- flushlines(ti)
- flush(currentcatcodes,"}")
- elseif currentcatcodes == contentcatcodes then
- flush(currentcatcodes,"{",ti,"}")
- else
- flush(currentcatcodes,"{")
- flush(contentcatcodes,ti)
- flush(currentcatcodes,"}")
- end
- elseif typ == "number" then
- -- numbers never have funny catcodes
- flush(currentcatcodes,"{",ti,"}")
- elseif typ == "table" then
- local tn = #ti
- if tn == 0 then
- local done = false
- for k, v in next, ti do
- if done then
- if v == "" then
- flush(currentcatcodes,",",k,'=')
- else
- flush(currentcatcodes,",",k,"={",v,"}")
- end
- else
- if v == "" then
- flush(currentcatcodes,"[",k,"=")
- else
- flush(currentcatcodes,"[",k,"={",v,"}")
- end
- done = true
- end
- end
- if done then
- flush(currentcatcodes,"]")
- else
- flush(currentcatcodes,"[]")
- end
- elseif tn == 1 then -- some 20% faster than the next loop
- local tj = ti[1]
- if type(tj) == "function" then
- flush(currentcatcodes,"[\\cldf{",storefunction(tj),"}]")
- else
- flush(currentcatcodes,"[",tj,"]")
- end
- else -- is concat really faster than flushes here? probably needed anyway (print artifacts)
- for j=1,tn do
- local tj = ti[j]
- if type(tj) == "function" then
- ti[j] = "\\cldf{" .. storefunction(tj) .. "}"
- end
- end
- flush(currentcatcodes,"[",concat(ti,","),"]")
- end
- elseif typ == "function" then
- flush(currentcatcodes,"{\\cldf{",storefunction(ti),"}}") -- todo: ctx|prt|texcatcodes
- elseif typ == "boolean" then
- if ti then
- flushdirect(currentcatcodes,"\r")
- else
- direct = true
- end
- elseif typ == "thread" then
- report_context("coroutines not supported as we cannot yield across boundaries")
- elseif isnode(ti) then -- slow
- flush(currentcatcodes,"{\\cldn{",storenode(ti),"}}")
- else
- report_context("error: %a gets a weird argument %a",command,ti)
- end
- end
- end
-
-end
+-- else
+--
+-- writer = function (parent,command,first,...) -- already optimized before call
+-- local t = { first, ... }
+-- flush(currentcatcodes,command) -- todo: ctx|prt|texcatcodes
+-- local direct = false
+-- for i=1,#t do
+-- local ti = t[i]
+-- local typ = type(ti)
+-- if direct then
+-- if typ == "string" or typ == "number" then
+-- flush(currentcatcodes,ti)
+-- else -- node.write
+-- report_context("error: invalid use of direct in %a, only strings and numbers can be flushed directly, not %a",command,typ)
+-- end
+-- direct = false
+-- elseif ti == nil then
+-- -- nothing
+-- elseif ti == "" then
+-- flush(currentcatcodes,"{}")
+-- elseif typ == "string" then
+-- -- is processelines seen ?
+-- if processlines and lpegmatch(containseol,ti) then
+-- flush(currentcatcodes,"{")
+-- local flushlines = parent.__flushlines or flushlines
+-- flushlines(ti)
+-- flush(currentcatcodes,"}")
+-- elseif currentcatcodes == contentcatcodes then
+-- flush(currentcatcodes,"{",ti,"}")
+-- else
+-- flush(currentcatcodes,"{")
+-- flush(contentcatcodes,ti)
+-- flush(currentcatcodes,"}")
+-- end
+-- elseif typ == "number" then
+-- -- numbers never have funny catcodes
+-- flush(currentcatcodes,"{",ti,"}")
+-- elseif typ == "table" then
+-- local tn = #ti
+-- if tn == 0 then
+-- local done = false
+-- for k, v in next, ti do
+-- if done then
+-- if v == "" then
+-- flush(currentcatcodes,",",k,'=')
+-- else
+-- flush(currentcatcodes,",",k,"={",v,"}")
+-- end
+-- else
+-- if v == "" then
+-- flush(currentcatcodes,"[",k,"=")
+-- else
+-- flush(currentcatcodes,"[",k,"={",v,"}")
+-- end
+-- done = true
+-- end
+-- end
+-- if done then
+-- flush(currentcatcodes,"]")
+-- else
+-- flush(currentcatcodes,"[]")
+-- end
+-- elseif tn == 1 then -- some 20% faster than the next loop
+-- local tj = ti[1]
+-- if type(tj) == "function" then
+-- flush(currentcatcodes,"[\\cldf{",storefunction(tj),"}]")
+-- else
+-- flush(currentcatcodes,"[",tj,"]")
+-- end
+-- else -- is concat really faster than flushes here? probably needed anyway (print artifacts)
+-- for j=1,tn do
+-- local tj = ti[j]
+-- if type(tj) == "function" then
+-- ti[j] = "\\cldf{" .. storefunction(tj) .. "}"
+-- end
+-- end
+-- flush(currentcatcodes,"[",concat(ti,","),"]")
+-- end
+-- elseif typ == "function" then
+-- flush(currentcatcodes,"{\\cldf{",storefunction(ti),"}}") -- todo: ctx|prt|texcatcodes
+-- elseif typ == "boolean" then
+-- if ti then
+-- flushdirect(currentcatcodes,"\r")
+-- else
+-- direct = true
+-- end
+-- elseif typ == "thread" then
+-- report_context("coroutines not supported as we cannot yield across boundaries")
+-- elseif isnode(ti) then -- slow
+-- flush(currentcatcodes,"{\\cldn{",storenode(ti),"}}")
+-- else
+-- report_context("error: %a gets a weird argument %a",command,ti)
+-- end
+-- end
+-- end
+--
+-- end
local generics = { } context.generics = generics
local indexer = nil
@@ -1022,7 +1027,7 @@ end
local caller
-if luafunctions then
+-- if luafunctions then
caller = function(parent,f,a,...)
if not parent then
@@ -1053,6 +1058,7 @@ if luafunctions then
elseif typ == "function" then
-- ignored: a ...
flush(currentcatcodes,"{\\cldl",storefunction(f),"}") -- todo: ctx|prt|texcatcodes
+ -- flush(currentcatcodes,"{",storefunction(f),"}") -- todo: ctx|prt|texcatcodes
elseif typ == "boolean" then
if f then
if a ~= nil then
@@ -1074,6 +1080,7 @@ if luafunctions then
elseif isnode(f) then -- slow
-- writenode(f)
flush(currentcatcodes,"\\cldl",storenode(f)," ")
+ -- flush(currentcatcodes,"",storenode(f)," ")
else
report_context("error: %a gets a weird argument %a","context",f)
end
@@ -1082,71 +1089,72 @@ if luafunctions then
function context.flushnode(n)
flush(currentcatcodes,"\\cldl",storenode(n)," ")
+ -- flush(currentcatcodes,"",storenode(n)," ")
end
-else
-
- caller = function(parent,f,a,...)
- if not parent then
- -- so we don't need to test in the calling (slower but often no issue)
- elseif f ~= nil then
- local typ = type(f)
- if typ == "string" then
- if f == "" then
- -- new, can save a bit sometimes
- -- if trace_context then
- -- report_context("empty argument to context()")
- -- end
- elseif a then
- flush(contentcatcodes,formatters[f](a,...)) -- was currentcatcodes
- -- flush(contentcatcodes,splitformatters[f](a,...)) -- was currentcatcodes
- elseif processlines and lpegmatch(containseol,f) then
- local flushlines = parent.__flushlines or flushlines
- flushlines(f)
- else
- flush(contentcatcodes,f)
- end
- elseif typ == "number" then
- if a then
- flush(currentcatcodes,f,a,...)
- else
- flush(currentcatcodes,f)
- end
- elseif typ == "function" then
- -- ignored: a ...
- flush(currentcatcodes,"{\\cldf{",storefunction(f),"}}") -- todo: ctx|prt|texcatcodes
- elseif typ == "boolean" then
- if f then
- if a ~= nil then
- local flushlines = parent.__flushlines or flushlines
- flushlines(a)
- else
- flushdirect(currentcatcodes,"\n") -- no \r, else issues with \startlines ... use context.par() otherwise
- end
- else
- if a ~= nil then
- -- no command, same as context(a,...)
- writer(parent,"",a,...)
- else
- -- ignored
- end
- end
- elseif typ == "thread" then
- report_context("coroutines not supported as we cannot yield across boundaries")
- elseif isnode(f) then -- slow
- -- writenode(f)
- flush(currentcatcodes,"\\cldn{",storenode(f),"}")
- else
- report_context("error: %a gets a weird argument %a","context",f)
- end
- end
- end
-
- function context.flushnode(n)
- flush(currentcatcodes,"\\cldn{",storenode(n),"}")
- end
-
-end
+-- else
+--
+-- caller = function(parent,f,a,...)
+-- if not parent then
+-- -- so we don't need to test in the calling (slower but often no issue)
+-- elseif f ~= nil then
+-- local typ = type(f)
+-- if typ == "string" then
+-- if f == "" then
+-- -- new, can save a bit sometimes
+-- -- if trace_context then
+-- -- report_context("empty argument to context()")
+-- -- end
+-- elseif a then
+-- flush(contentcatcodes,formatters[f](a,...)) -- was currentcatcodes
+-- -- flush(contentcatcodes,splitformatters[f](a,...)) -- was currentcatcodes
+-- elseif processlines and lpegmatch(containseol,f) then
+-- local flushlines = parent.__flushlines or flushlines
+-- flushlines(f)
+-- else
+-- flush(contentcatcodes,f)
+-- end
+-- elseif typ == "number" then
+-- if a then
+-- flush(currentcatcodes,f,a,...)
+-- else
+-- flush(currentcatcodes,f)
+-- end
+-- elseif typ == "function" then
+-- -- ignored: a ...
+-- flush(currentcatcodes,"{\\cldf{",storefunction(f),"}}") -- todo: ctx|prt|texcatcodes
+-- elseif typ == "boolean" then
+-- if f then
+-- if a ~= nil then
+-- local flushlines = parent.__flushlines or flushlines
+-- flushlines(a)
+-- else
+-- flushdirect(currentcatcodes,"\n") -- no \r, else issues with \startlines ... use context.par() otherwise
+-- end
+-- else
+-- if a ~= nil then
+-- -- no command, same as context(a,...)
+-- writer(parent,"",a,...)
+-- else
+-- -- ignored
+-- end
+-- end
+-- elseif typ == "thread" then
+-- report_context("coroutines not supported as we cannot yield across boundaries")
+-- elseif isnode(f) then -- slow
+-- -- writenode(f)
+-- flush(currentcatcodes,"\\cldn{",storenode(f),"}")
+-- else
+-- report_context("error: %a gets a weird argument %a","context",f)
+-- end
+-- end
+-- end
+--
+-- function context.flushnode(n)
+-- flush(currentcatcodes,"\\cldn{",storenode(n),"}")
+-- end
+--
+-- end
local defaultcaller = caller
@@ -1211,6 +1219,8 @@ local currenttrace = nil
local nofwriters = 0
local nofflushes = 0
+local tracingpermitted = true
+
local visualizer = lpeg.replacer {
{ "\n","<<newline>>" },
{ "\r","<<par>>" },
@@ -1231,15 +1241,24 @@ local tracedwriter = function(parent,...) -- also catcodes ?
local savedflush = flush
local savedflushdirect = flushdirect -- unlikely to be used here
local t, n = { "w : - : " }, 1
- local traced = function(normal,catcodes,...) -- todo: check for catcodes
+ local traced = function(catcodes,...) -- todo: check for catcodes
local s = concat({...})
s = lpegmatch(visualizer,s)
n = n + 1
t[n] = s
- normal(catcodes,...)
end
- flush = function(...) traced(normalflush, ...) end
- flushdirect = function(...) traced(normalflushdirect,...) end
+ flush = function(...)
+ normalflush(...)
+ if tracingpermitted then
+ traced(...)
+ end
+ end
+ flushdirect = function(...)
+ normalflushdirect(...)
+ if tracingpermitted then
+ traced(...)
+ end
+ end
normalwriter(parent,...)
flush = savedflush
flushdirect = savedflushdirect
@@ -1248,11 +1267,9 @@ end
-- we could reuse collapsed
-local traced = function(normal,one,two,...)
- nofflushes = nofflushes + 1
+local traced = function(one,two,...)
if two then
-- only catcodes if 'one' is number
- normal(one,two,...)
local catcodes = type(one) == "number" and one
local arguments = catcodes and { two, ... } or { one, two, ... }
local collapsed, c = { formatters["f : %s : "](catcodes or '-') }, 1
@@ -1271,7 +1288,6 @@ local traced = function(normal,one,two,...)
currenttrace(concat(collapsed))
else
-- no catcodes
- normal(one)
local argtype = type(one)
if argtype == "string" then
currenttrace(formatters["f : - : %s"](lpegmatch(visualizer,one)))
@@ -1283,8 +1299,29 @@ local traced = function(normal,one,two,...)
end
end
-local tracedflush = function(...) traced(normalflush, ...) end
-local tracedflushdirect = function(...) traced(normalflushdirect,...) end
+local tracedflush = function(one,two,...)
+ nofflushes = nofflushes + 1
+ if two then
+ normalflush(one,two,...)
+ else
+ normalflush(one)
+ end
+ if tracingpermitted then
+ traced(...)
+ end
+end
+
+local tracedflushdirect = function(one,two,...)
+ nofflushes = nofflushes + 1
+ if two then
+ normalflushdirect(one,two,...)
+ else
+ normalflushdirect(one)
+ end
+ if tracingpermitted then
+ traced(...)
+ end
+end
local function pushlogger(trace)
trace = trace or report_context
@@ -1404,8 +1441,10 @@ do
-- end
local collectdirect = collect
+ local permitted = true
- -- doesn't work well with tracing do we need to avoid that then
+ -- doesn't work well with tracing do we need to avoid that when
+ -- collecting stuff
function context.startcollecting()
if level == 0 then
@@ -1414,6 +1453,7 @@ do
--
flush = collect
flushdirect = collectdirect
+ permitted = tracingpermitted
--
context.__flush = flush
context.__flushdirect = flushdirect
@@ -1424,8 +1464,9 @@ do
function context.stopcollecting()
level = level - 1
if level < 1 then
- flush = normalflush
- flushdirect = normalflushdirect
+ flush = normalflush
+ flushdirect = normalflushdirect
+ tracingpermitted = permitted
--
context.__flush = flush
context.__flushdirect = flushdirect
@@ -1682,8 +1723,8 @@ local function caller(parent,f,a,...)
end
elseif typ == "function" then
-- ignored: a ...
--- flush(currentcatcodes,mpdrawing,"{\\cldf{",store_(f),"}}")
flush(currentcatcodes,mpdrawing,"{\\cldl",store_(f),"}")
+ -- flush(currentcatcodes,mpdrawing,"{",store_(f),"}")
elseif typ == "boolean" then
-- ignored: a ...
if f then
diff --git a/tex/context/base/mkiv/cldf-ini.mkiv b/tex/context/base/mkiv/cldf-ini.mkiv
index 12ada1383..a985f204e 100644
--- a/tex/context/base/mkiv/cldf-ini.mkiv
+++ b/tex/context/base/mkiv/cldf-ini.mkiv
@@ -33,15 +33,17 @@
% \zerocount removes as it's the default
-\def\cldf#1{\directlua{_cldf_(#1)}} % global (functions)
-\def\cldn#1{\directlua{_cldn_(#1)}} % global (nodes)
-
-\ifx\luafunction\undefined
- \def\luafunction#1{\directlua{_cldl_(#1)}}
-\fi
+% \def\cldf#1{\directlua{_cldf_(#1)}} % global (functions)
+% \def\cldn#1{\directlua{_cldn_(#1)}} % global (nodes)
+%
+% \ifx\luafunction\undefined
+% \def\luafunction#1{\directlua{_cldl_(#1)}}
+% \fi
\let\cldl\luafunction
+% \catcode`=\activecatcode \let\luafunction % saves 10% on the call
+
% \catcodetable\ctxcatcodes \catcode`^=\superscriptcatcode\catcode1=\activecatcode \global\let^^A=\cldf
% \catcodetable\ctxcatcodes \catcode`^=\superscriptcatcode\catcode2=\activecatcode \global\let^^B=\cldn
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index 72b9eeeb2..e9dddbb0f 100644
--- a/tex/context/base/mkiv/cont-new.mkiv
+++ b/tex/context/base/mkiv/cont-new.mkiv
@@ -11,7 +11,7 @@
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.
-\newcontextversion{2016.01.28 22:35}
+\newcontextversion{2016.01.29 19:00}
%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/context.mkiv b/tex/context/base/mkiv/context.mkiv
index 384a2de9b..727363db8 100644
--- a/tex/context/base/mkiv/context.mkiv
+++ b/tex/context/base/mkiv/context.mkiv
@@ -39,7 +39,7 @@
%D up and the dependencies are more consistent.
\edef\contextformat {\jobname}
-\edef\contextversion{2016.01.28 22:35}
+\edef\contextversion{2016.01.29 19:00}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/lxml-ini.lua b/tex/context/base/mkiv/lxml-ini.lua
index f17f28a7c..c44c61644 100644
--- a/tex/context/base/mkiv/lxml-ini.lua
+++ b/tex/context/base/mkiv/lxml-ini.lua
@@ -40,6 +40,7 @@ implement { name = "xmldoifelseselfempty", actions = lxml.doifelseempty, arg
--------- { name = "xmlcontent", actions = lxml.content, arguments = "string" }
--------- { name = "xmlflushstripped", actions = lxml.strip, arguments = { "string", true } }
implement { name = "xmlall", actions = lxml.all, arguments = { "string", "string" } }
+implement { name = "xmllastmatch", actions = lxml.lastmatch }
implement { name = "xmlatt", actions = lxml.att, arguments = { "string", "string" } }
implement { name = "xmllastatt", actions = lxml.lastatt }
implement { name = "xmlattdef", actions = lxml.att, arguments = { "string", "string", "string" } }
diff --git a/tex/context/base/mkiv/lxml-ini.mkiv b/tex/context/base/mkiv/lxml-ini.mkiv
index 3d3ef8733..8175d21e6 100644
--- a/tex/context/base/mkiv/lxml-ini.mkiv
+++ b/tex/context/base/mkiv/lxml-ini.mkiv
@@ -45,6 +45,7 @@
% aliased
\let\xmlall \clf_xmlall
+\let\xmllastmatch \clf_xmllastmatch
\let\xmlatt \clf_xmlatt
\let\xmllastatt \clf_xmllastatt
\let\xmlattdef \clf_xmlattdef
diff --git a/tex/context/base/mkiv/lxml-lpt.lua b/tex/context/base/mkiv/lxml-lpt.lua
index 62250be00..b722fc318 100644
--- a/tex/context/base/mkiv/lxml-lpt.lua
+++ b/tex/context/base/mkiv/lxml-lpt.lua
@@ -43,11 +43,24 @@ a/b/c/text() a/b/c/text(1) a/b/c/text(-1) a/b/c/text(n)
</typing>
--ldx]]--
-local trace_lpath = false if trackers then trackers.register("xml.path", function(v) trace_lpath = v end) end
-local trace_lparse = false if trackers then trackers.register("xml.parse", function(v) trace_lparse = v end) end
-local trace_lprofile = false if trackers then trackers.register("xml.profile", function(v) trace_lpath = v trace_lparse = v trace_lprofile = v end) end
-
-local report_lpath = logs.reporter("xml","lpath")
+local trace_lpath = false
+local trace_lparse = false
+local trace_lprofile = false
+local report_lpath = logs.reporter("xml","lpath")
+
+if trackers then
+ trackers.register("xml.path", function(v)
+ trace_lpath = v
+ end)
+ trackers.register("xml.parse", function(v)
+ trace_lparse = v
+ end)
+ trackers.register("xml.profile", function(v)
+ trace_lpath = v
+ trace_lparse = v
+ trace_lprofile = v
+ end)
+end
--[[ldx--
<p>We've now arrived at an interesting part: accessing the tree using a subset
@@ -659,6 +672,7 @@ local template_f_n = [[
--
+local register_last_match = { kind = "axis", axis = "last-match" } -- , apply = apply_axis["self"] }
local register_self = { kind = "axis", axis = "self" } -- , apply = apply_axis["self"] }
local register_parent = { kind = "axis", axis = "parent" } -- , apply = apply_axis["parent"] }
local register_descendant = { kind = "axis", axis = "descendant" } -- , apply = apply_axis["descendant"] }
@@ -759,21 +773,41 @@ local pathparser = Ct { "patterns", -- can be made a bit faster by moving some p
protocol = Cg(V("letters"),"protocol") * P("://") + Cg(Cc(nil),"protocol"),
-- the / is needed for // as descendant or self is somewhat special
+ --
-- step = (V("shortcuts") + V("axis") * spaces * V("nodes")^0 + V("error")) * spaces * V("expressions")^0 * spaces * V("finalizer")^0,
step = ((V("shortcuts") + P("/") + V("axis")) * spaces * V("nodes")^0 + V("error")) * spaces * V("expressions")^0 * spaces * V("finalizer")^0,
- axis = V("descendant") + V("child") + V("parent") + V("self") + V("root") + V("ancestor") +
- V("descendant_or_self") + V("following_sibling") + V("following") +
- V("reverse_sibling") + V("preceding_sibling") + V("preceding") + V("ancestor_or_self") +
- #(1-P(-1)) * Cc(register_auto_child),
-
- special = special_1 + special_2 + special_3,
+ axis = V("last_match")
+ + V("descendant")
+ + V("child")
+ + V("parent")
+ + V("self")
+ + V("root")
+ + V("ancestor")
+ + V("descendant_or_self")
+ + V("following_sibling")
+ + V("following")
+ + V("reverse_sibling")
+ + V("preceding_sibling")
+ + V("preceding")
+ + V("ancestor_or_self")
+ + #(1-P(-1)) * Cc(register_auto_child),
+
+ special = special_1
+ + special_2
+ + special_3,
initial = (P("/") * spaces * Cc(register_initial_child))^-1,
error = (P(1)^1) / register_error,
- shortcuts_a = V("s_descendant_or_self") + V("s_descendant") + V("s_child") + V("s_parent") + V("s_self") + V("s_root") + V("s_ancestor"),
+ shortcuts_a = V("s_descendant_or_self")
+ + V("s_descendant")
+ + V("s_child")
+ + V("s_parent")
+ + V("s_self")
+ + V("s_root")
+ + V("s_ancestor"),
shortcuts = V("shortcuts_a") * (spaces * "/" * spaces * V("shortcuts_a"))^0,
@@ -785,6 +819,8 @@ local pathparser = Ct { "patterns", -- can be made a bit faster by moving some p
s_root = P("^^") * Cc(register_root ),
s_ancestor = P("^") * Cc(register_ancestor ),
+ -- we can speed this up when needed but we cache anyway so ...
+
descendant = P("descendant::") * Cc(register_descendant ),
child = P("child::") * Cc(register_child ),
parent = P("parent::") * Cc(register_parent ),
@@ -800,6 +836,7 @@ local pathparser = Ct { "patterns", -- can be made a bit faster by moving some p
preceding = P('preceding::') * Cc(register_preceding ),
preceding_sibling = P('preceding-sibling::') * Cc(register_preceding_sibling ),
reverse_sibling = P('reverse-sibling::') * Cc(register_reverse_sibling ),
+ last_match = P('last-match::') * Cc(register_last_match ),
nodes = (V("nodefunction") * spaces * P("(") * V("nodeset") * P(")") + V("nodetest") * V("nodeset")) / register_nodes,
@@ -953,146 +990,194 @@ xml.lpath = lpath
-- can be cases that a finalizer returns (or does) something in case
-- there is no match; an example of this is count()
-local profiled = { } xml.profiled = profiled
+do
-local function profiled_apply(list,parsed,nofparsed,order)
- local p = profiled[parsed.pattern]
- if p then
- p.tested = p.tested + 1
- else
- p = { tested = 1, matched = 0, finalized = 0 }
- profiled[parsed.pattern] = p
+ local profiled = { }
+ xml.profiled = profiled
+ local lastmatch = nil -- we remember the last one .. drawback: no collection till new collect
+ local keepmatch = nil -- we remember the last one .. drawback: no collection till new collect
+
+ if directives then
+ directives.register("xml.path.keeplastmatch",function(v)
+ keepmatch = v
+ lastmatch = nil
+ end)
end
- local collected = list
- for i=1,nofparsed do
- local pi = parsed[i]
- local kind = pi.kind
- if kind == "axis" then
- collected = apply_axis[pi.axis](collected)
- elseif kind == "nodes" then
- collected = apply_nodes(collected,pi.nodetest,pi.nodes)
- elseif kind == "expression" then
- collected = apply_expression(collected,pi.evaluator,order)
- elseif kind == "finalizer" then
- collected = pi.finalizer(collected) -- no check on # here
- p.matched = p.matched + 1
- p.finalized = p.finalized + 1
- return collected
+
+ apply_axis["last-match"] = function()
+ return lastmatch or { }
+ end
+
+ local function profiled_apply(list,parsed,nofparsed,order)
+ local p = profiled[parsed.pattern]
+ if p then
+ p.tested = p.tested + 1
+ else
+ p = { tested = 1, matched = 0, finalized = 0 }
+ profiled[parsed.pattern] = p
end
- if not collected or #collected == 0 then
- local pn = i < nofparsed and parsed[nofparsed]
- if pn and pn.kind == "finalizer" then
- collected = pn.finalizer(collected)
+ local collected = list
+ for i=1,nofparsed do
+ local pi = parsed[i]
+ local kind = pi.kind
+ if kind == "axis" then
+ collected = apply_axis[pi.axis](collected)
+ elseif kind == "nodes" then
+ collected = apply_nodes(collected,pi.nodetest,pi.nodes)
+ elseif kind == "expression" then
+ collected = apply_expression(collected,pi.evaluator,order)
+ elseif kind == "finalizer" then
+ collected = pi.finalizer(collected) -- no check on # here
+ p.matched = p.matched + 1
p.finalized = p.finalized + 1
return collected
end
- return nil
+ if not collected or #collected == 0 then
+ local pn = i < nofparsed and parsed[nofparsed]
+ if pn and pn.kind == "finalizer" then
+ collected = pn.finalizer(collected) -- collected can be nil
+ p.finalized = p.finalized + 1
+ return collected
+ end
+ return nil
+ end
end
+ if collected then
+ p.matched = p.matched + 1
+ end
+ return collected
end
- if collected then
- p.matched = p.matched + 1
- end
- return collected
-end
-local function traced_apply(list,parsed,nofparsed,order)
- if trace_lparse then
- lshow(parsed)
- end
- report_lpath("collecting: %s",parsed.pattern)
- report_lpath("root tags : %s",tagstostring(list))
- report_lpath("order : %s",order or "unset")
- local collected = list
- for i=1,nofparsed do
- local pi = parsed[i]
- local kind = pi.kind
- if kind == "axis" then
- collected = apply_axis[pi.axis](collected)
- report_lpath("% 10i : ax : %s",(collected and #collected) or 0,pi.axis)
- elseif kind == "nodes" then
- collected = apply_nodes(collected,pi.nodetest,pi.nodes)
- report_lpath("% 10i : ns : %s",(collected and #collected) or 0,nodesettostring(pi.nodes,pi.nodetest))
- elseif kind == "expression" then
- collected = apply_expression(collected,pi.evaluator,order)
- report_lpath("% 10i : ex : %s -> %s",(collected and #collected) or 0,pi.expression,pi.converted)
- elseif kind == "finalizer" then
- collected = pi.finalizer(collected)
- report_lpath("% 10i : fi : %s : %s(%s)",(type(collected) == "table" and #collected) or 0,parsed.protocol or xml.defaultprotocol,pi.name,pi.arguments or "")
- return collected
+ local function traced_apply(list,parsed,nofparsed,order)
+ if trace_lparse then
+ lshow(parsed)
end
- if not collected or #collected == 0 then
- local pn = i < nofparsed and parsed[nofparsed]
- if pn and pn.kind == "finalizer" then
- collected = pn.finalizer(collected)
- report_lpath("% 10i : fi : %s : %s(%s)",(type(collected) == "table" and #collected) or 0,parsed.protocol or xml.defaultprotocol,pn.name,pn.arguments or "")
+ report_lpath("collecting: %s",parsed.pattern)
+ report_lpath("root tags : %s",tagstostring(list))
+ report_lpath("order : %s",order or "unset")
+ local collected = list
+ for i=1,nofparsed do
+ local pi = parsed[i]
+ local kind = pi.kind
+ if kind == "axis" then
+ collected = apply_axis[pi.axis](collected)
+ report_lpath("% 10i : ax : %s",(collected and #collected) or 0,pi.axis)
+ elseif kind == "nodes" then
+ collected = apply_nodes(collected,pi.nodetest,pi.nodes)
+ report_lpath("% 10i : ns : %s",(collected and #collected) or 0,nodesettostring(pi.nodes,pi.nodetest))
+ elseif kind == "expression" then
+ collected = apply_expression(collected,pi.evaluator,order)
+ report_lpath("% 10i : ex : %s -> %s",(collected and #collected) or 0,pi.expression,pi.converted)
+ elseif kind == "finalizer" then
+ collected = pi.finalizer(collected)
+ report_lpath("% 10i : fi : %s : %s(%s)",(type(collected) == "table" and #collected) or 0,parsed.protocol or xml.defaultprotocol,pi.name,pi.arguments or "")
return collected
end
- return nil
+ if not collected or #collected == 0 then
+ local pn = i < nofparsed and parsed[nofparsed]
+ if pn and pn.kind == "finalizer" then
+ collected = pn.finalizer(collected)
+ report_lpath("% 10i : fi : %s : %s(%s)",(type(collected) == "table" and #collected) or 0,parsed.protocol or xml.defaultprotocol,pn.name,pn.arguments or "")
+ return collected
+ end
+ return nil
+ end
end
+ return collected
end
- return collected
-end
-local function normal_apply(list,parsed,nofparsed,order)
- local collected = list
- for i=1,nofparsed do
- local pi = parsed[i]
- local kind = pi.kind
- if kind == "axis" then
- local axis = pi.axis
- if axis ~= "self" then
- collected = apply_axis[axis](collected)
+ local function normal_apply(list,parsed,nofparsed,order)
+ local collected = list
+ for i=1,nofparsed do
+ local pi = parsed[i]
+ local kind = pi.kind
+ if kind == "axis" then
+ local axis = pi.axis
+ if axis ~= "self" then
+ collected = apply_axis[axis](collected)
+ end
+ elseif kind == "nodes" then
+ collected = apply_nodes(collected,pi.nodetest,pi.nodes)
+ elseif kind == "expression" then
+ collected = apply_expression(collected,pi.evaluator,order)
+ elseif kind == "finalizer" then
+ return pi.finalizer(collected)
end
- elseif kind == "nodes" then
- collected = apply_nodes(collected,pi.nodetest,pi.nodes)
- elseif kind == "expression" then
- collected = apply_expression(collected,pi.evaluator,order)
- elseif kind == "finalizer" then
- return pi.finalizer(collected)
- end
- if not collected or #collected == 0 then
- local pf = i < nofparsed and parsed[nofparsed].finalizer
- if pf then
- return pf(collected) -- can be anything
+ if not collected or #collected == 0 then
+ local pf = i < nofparsed and parsed[nofparsed].finalizer
+ if pf then
+ return pf(collected) -- can be anything
+ end
+ return nil
end
- return nil
end
+ return collected
end
- return collected
-end
-local function applylpath(list,pattern)
- if not list then
- return
- end
- local parsed = cache[pattern]
- if parsed then
- lpathcalls = lpathcalls + 1
- lpathcached = lpathcached + 1
- elseif type(pattern) == "table" then
- lpathcalls = lpathcalls + 1
- parsed = pattern
- else
- parsed = lpath(pattern) or pattern
- end
- if not parsed then
- return
+ local apply = normal_apply
+
+ if trackers then
+ -- local function check()
+ -- if trace_lprofile or then
+ -- apply = profiled_apply
+ -- elseif trace_lpath then
+ -- apply = traced_apply
+ -- else
+ -- apply = normal_apply
+ -- end
+ -- end
+ -- trackers.register("xml.path", check) -- can be "xml.path,xml.parse,xml.profile
+ -- trackers.register("xml.parse", check)
+ -- trackers.register("xml.profile",check)
+
+ trackers.register("xml.path,xml.parse,xml.profile",function()
+ if trace_lprofile then
+ apply = profiled_apply
+ elseif trace_lpath then
+ apply = traced_apply
+ else
+ apply = normal_apply
+ end
+ end)
end
- local nofparsed = #parsed
- if nofparsed == 0 then
- return -- something is wrong
+
+
+ function xml.applylpath(list,pattern)
+ if not list then
+ lastmatch = nil
+ return
+ end
+ local parsed = cache[pattern]
+ if parsed then
+ lpathcalls = lpathcalls + 1
+ lpathcached = lpathcached + 1
+ elseif type(pattern) == "table" then
+ lpathcalls = lpathcalls + 1
+ parsed = pattern
+ else
+ parsed = lpath(pattern) or pattern
+ end
+ if not parsed then
+ lastmatch = nil
+ return
+ end
+ local nofparsed = #parsed
+ if nofparsed == 0 then
+ lastmatch = nil
+ return -- something is wrong
+ end
+ local collected = apply({ list },parsed,nofparsed,list.mi)
+ lastmatch = keepmatch and collected or nil
+ return collected
end
- if not trace_lpath then
- return normal_apply ({ list },parsed,nofparsed,list.mi)
- elseif trace_lprofile then
- return profiled_apply({ list },parsed,nofparsed,list.mi)
- else
- return traced_apply ({ list },parsed,nofparsed,list.mi)
+
+ function xml.lastmatch()
+ return lastmatch
end
-end
-xml.applylpath = applylpath -- takes a table as first argment, which is what xml.filter will do
+end
+local applylpath = xml.applylpath
--[[ldx--
<p>This is the main filter function. It returns whatever is asked for.</p>
--ldx]]--
diff --git a/tex/context/base/mkiv/lxml-tex.lua b/tex/context/base/mkiv/lxml-tex.lua
index 09f1e10f9..0ec981d68 100644
--- a/tex/context/base/mkiv/lxml-tex.lua
+++ b/tex/context/base/mkiv/lxml-tex.lua
@@ -52,6 +52,9 @@ local xmlinclusion = xml.inclusion
local xmlinclusions = xml.inclusions
local xmlbadinclusions = xml.badinclusions
local xmlcontent = xml.content
+local xmllastmatch = xml.lastmatch
+
+directives.enable("xml.path.keeplastmatch")
local variables = interfaces and interfaces.variables or { }
@@ -1849,6 +1852,13 @@ function lxml.flush(id)
end
end
+function lxml.lastmatch()
+ local collected = xmllastmatch()
+ if collected then
+ all(collected)
+ end
+end
+
function lxml.snippet(id,i)
local e = getid(id)
if e then
diff --git a/tex/context/base/mkiv/node-res.lua b/tex/context/base/mkiv/node-res.lua
index 892cd62f2..eec7f0c07 100644
--- a/tex/context/base/mkiv/node-res.lua
+++ b/tex/context/base/mkiv/node-res.lua
@@ -369,36 +369,38 @@ if context and _cldo_ then
local setfield_node = nodes.setfield
local setfield_nut = nuts .setfield
- function nodepool.lateluafunction(f)
- local n = copy_node(latelua_node)
- setfield_node(n,"string",f_cldo(register(f)))
- return n
- end
- function nutpool.lateluafunction(f)
- local n = copy_nut(latelua_nut)
- setfield_nut(n,"string",f_cldo(register(f)))
- return n
- end
-
- -- when function in latelua:
-
-- function nodepool.lateluafunction(f)
-- local n = copy_node(latelua_node)
- -- setfield_node(n,"string",f)
+ -- setfield_node(n,"string",f_cldo(register(f)))
-- return n
-- end
+
-- function nutpool.lateluafunction(f)
-- local n = copy_nut(latelua_nut)
- -- setfield_nut(n,"string",f)
+ -- setfield_nut(n,"string",f_cldo(register(f)))
-- return n
-- end
+ -- when function in latelua:
+
+ function nodepool.lateluafunction(f)
+ local n = copy_node(latelua_node)
+ setfield_node(n,"string",f)
+ return n
+ end
+
+ function nutpool.lateluafunction(f)
+ local n = copy_nut(latelua_nut)
+ setfield_nut(n,"string",f)
+ return n
+ end
+
local latefunction = nodepool.lateluafunction
local flushnode = context.flushnode
- function context.lateluafunction(f)
- flushnode(latefunction(f)) -- hm, quite some indirect calls
- end
+ -- function context.lateluafunction(f)
+ -- flushnode(latefunction(f)) -- hm, quite some indirect calls
+ -- end
-- when function in latelua:
@@ -420,11 +422,11 @@ if context and _cldo_ then
-- when function in latelua:
- -- function context.lateluafunction(f)
- -- local n = copy_node(latelua_node)
- -- setfield_node(n,"string",f)
- -- contextsprint(ctxcatcodes,"\\cldl",storenode(n)," ")
- -- end
+ function context.lateluafunction(f)
+ local n = copy_node(latelua_node)
+ setfield_node(n,"string",f)
+ contextsprint(ctxcatcodes,"\\cldl",storenode(n)," ")
+ end
end
diff --git a/tex/context/base/mkiv/publ-imp-apa.mkvi b/tex/context/base/mkiv/publ-imp-apa.mkvi
index 1411042c9..b9d265105 100644
--- a/tex/context/base/mkiv/publ-imp-apa.mkvi
+++ b/tex/context/base/mkiv/publ-imp-apa.mkvi
@@ -872,7 +872,6 @@
\btxflush{withauthor}
\btxrightparenthesis
}
- \btxperiod
}
\stoptexdefinition
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 392bf9a1f..35df55af7 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 f7b9aa479..8d31b4caa 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/strc-flt.mkvi b/tex/context/base/mkiv/strc-flt.mkvi
index 334d98a93..fb621c997 100644
--- a/tex/context/base/mkiv/strc-flt.mkvi
+++ b/tex/context/base/mkiv/strc-flt.mkvi
@@ -186,16 +186,36 @@
\unexpanded\def\definefloat
{\dotripleempty\strc_floats_define}
-\def\strc_floats_define[#1][#2][#3]% #1=naam #2=meervoud #3=parent
+\def\strc_floats_define[#1][#2][#3]% name+plural+parent | name+parent+settings
{\ifthirdargument
- \strc_floats_define_cloned[#1][#2][#3]%
+ \doifassignmentelse{#3}
+ {\strc_floats_define_b[#1][#2][#3]}%
+ {\strc_floats_define_a[#1][#2][#3]}%
\else\ifsecondargument
- \strc_floats_define_normal[#1][#2]%
+ \doifelsecommandhandler\??float{#2}%
+ {\strc_floats_define_a[#1][#1][#2]}%
+ {\strc_floats_define_c[#1][#2]}%
\else
- \strc_floats_define_normal[#1][#1]%
+ \strc_floats_define_c[#1][#1]%
\fi\fi}
-\def\strc_floats_define_normal[#1][#2]%
+\def\strc_floats_define_a[#1][#2][#3]% name names parent
+ {\definefloatcaption[#1][#3]%
+ \definecounter[#1][#3]%
+ \definelist[#1][#3]%
+ \copylabeltext[#1=#3]%
+ \strc_floats_define_saved[#1][#3]%
+ \strc_floats_define_commands{#1}{#2}}
+
+\def\strc_floats_define_b[#1][#2][#3]% name parent settings
+ {\definefloatcaption[#1][#2]%
+ \definecounter[#1][#2]%
+ \definelist[#1][#2]%
+ \copylabeltext[#1=#2]%
+ \strc_floats_define_saved[#1][#2][#3]%
+ \strc_floats_define_commands{#1}{#1}}
+
+\def\strc_floats_define_c[#1][#2]% name names
{\registerfloatcaptioncounter{#1}%
\definefloatcaption[#1]%
\definecounter[#1]%
@@ -205,15 +225,6 @@
\strc_floats_define_saved[#1]%
\strc_floats_define_commands{#1}{#2}}
-\def\strc_floats_define_cloned[#1][#2][#3]%
- {\definefloatcaption[#1][#3]%
- \definecounter[#1][#3]%
- \definelist[#1][#3]%
- \copylabeltext[#1=#3]%
- %\presetheadtext[#2=\Word{#2}]%
- \strc_floats_define_saved[#1][#3]%
- \strc_floats_define_commands{#1}{#2}}
-
\def\strc_floats_define_commands#1#2%
{\setuvalue {\e!place\e!listof#2}{\dodoubleempty\strc_lists_place[#1]}% call will change
\setuvalue {\e!complete\e!listof#2}{\dotripleempty\strc_lists_complete_indeed[#1][#2]}% call will change
diff --git a/tex/context/base/mkiv/syst-ini.mkiv b/tex/context/base/mkiv/syst-ini.mkiv
index e165ee8a3..37ffc5768 100644
--- a/tex/context/base/mkiv/syst-ini.mkiv
+++ b/tex/context/base/mkiv/syst-ini.mkiv
@@ -1010,15 +1010,12 @@
\edef\pdfimagehicolor {\pdfvariable imagehicolor} \pdfimagehicolor \plusone
\edef\pdfimageaddfilename {\pdfvariable imageaddfilename} \pdfimageaddfilename \plusone
\edef\pdfpkresolution {\pdfvariable pkresolution} \pdfpkresolution 1200
-\edef\pdfpkfixeddpi {\pdfvariable pkfixeddpi} \pdfpkfixeddpi 1
\edef\pdfinclusioncopyfonts {\pdfvariable inclusioncopyfonts} \pdfinclusioncopyfonts \plusone
\edef\pdfinclusionerrorlevel {\pdfvariable inclusionerrorlevel} \pdfinclusionerrorlevel \zerocount
-\edef\pdfignoreunknownimages {\pdfvariable ignoreunknownimages} \pdfignoreunknownimages \zerocount
\edef\pdfgentounicode {\pdfvariable gentounicode} \pdfgentounicode \plusone
\edef\pdfpagebox {\pdfvariable pagebox} \pdfpagebox \zerocount
\edef\pdfminorversion {\pdfvariable minorversion} \pdfminorversion \plusseven
\edef\pdfuniqueresname {\pdfvariable uniqueresname} \pdfuniqueresname \zerocount
-
\edef\pdfhorigin {\pdfvariable horigin} \pdfhorigin 1in
\edef\pdfvorigin {\pdfvariable vorigin} \pdfvorigin \pdfhorigin
\edef\pdflinkmargin {\pdfvariable linkmargin} \pdflinkmargin \zeropoint
@@ -1026,6 +1023,14 @@
\edef\pdfthreadmargin {\pdfvariable threadmargin} \pdfthreadmargin \zeropoint
\edef\pdfxformmargin {\pdfvariable xformmargin} \pdfxformmargin \zeropoint
+\ifnum\luatexversion>88
+ \edef\pdfpkfixeddpi {\pdfvariable pkfixeddpi} \pdfpkfixeddpi \plusone
+ \edef\pdfignoreunknownimages {\pdfvariable ignoreunknownimages} \pdfignoreunknownimages \zerocount
+\else
+ \newcount\pdfpkfixeddpi
+ \newcount\pdfignoreunknownimages
+\fi
+
\edef\pdfpagesattr {\pdfvariable pagesattr}
\edef\pdfpageattr {\pdfvariable pageattr}
\edef\pdfpageresources {\pdfvariable pageresources}
diff --git a/tex/context/interface/common/i-en-xml.xml b/tex/context/interface/common/i-en-xml.xml
new file mode 100644
index 000000000..441ff07d2
--- /dev/null
+++ b/tex/context/interface/common/i-en-xml.xml
@@ -0,0 +1,722 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<cd:interface file="lxml-ini.mkiv">
+
+ <!-- some common definitions -->
+
+ <cd:define name="xml-node">
+ <cd:argument><cd:constant type="cd:node"/></cd:argument>
+ </cd:define>
+
+ <cd:define name="xml-path">
+ <cd:argument><cd:constant type="cd:path"/></cd:argument>
+ </cd:define>
+
+ <cd:define name="xml-node-path">
+ <cd:argument><cd:constant type="cd:node"/></cd:argument>
+ <cd:argument><cd:constant type="cd:lpath"/></cd:argument>
+ </cd:define>
+
+ <cd:define name="xml-true">
+ <cd:argument><cd:constant type="cd:true"/></cd:argument>
+ </cd:define>
+
+ <cd:define name="xml-true-false">
+ <cd:argument><cd:constant type="cd:true"/></cd:argument>
+ <cd:argument><cd:constant type="cd:false"/></cd:argument>
+ </cd:define>
+
+ <!-- the definitions themselves -->
+
+ <!-- cd:sequence><cd:string value="xmlmain"/></cd:sequence -->
+
+ <cd:command name="xmlmain">
+ <cd:arguments>
+ <cd:argument><cd:constant type="cd:name"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlflush">
+ <cd:arguments><cd:resolve name="xml-node"/></cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmltext">
+ <cd:arguments><cd:resolve name="xml-node-path"/></cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlnonspace">
+ <cd:arguments><cd:resolve name="xml-node-path"/></cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlflushspacewise">
+ <cd:arguments><cd:resolve name="xml-node"/></cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlflushlinewise">
+ <cd:arguments><cd:resolve name="xml-node"/></cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlall">
+ <cd:arguments><cd:resolve name="xml-node-path"/></cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmllastmatch" />
+
+ <cd:command name="xmlfirst">
+ <cd:arguments><cd:resolve name="xml-node-path"/></cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmllast">
+ <cd:arguments><cd:resolve name="xml-node-path"/></cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlcontext">
+ <cd:arguments><cd:resolve name="xml-node-path"/></cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlflushcontext">
+ <cd:arguments><cd:resolve name="xml-node"/></cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlshow">
+ <cd:arguments><cd:resolve name="xml-node"/></cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlinfo">
+ <cd:arguments><cd:resolve name="xml-node"/></cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlfilter">
+ <cd:arguments><cd:resolve name="xml-node-path"/></cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlstrip">
+ <cd:arguments><cd:resolve name="xml-node-path"/></cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlstripped">
+ <cd:arguments><cd:resolve name="xml-node-path"/></cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlstripnolines">
+ <cd:arguments><cd:resolve name="xml-node-path"/></cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlstrippednolines">
+ <cd:arguments><cd:resolve name="xml-node-path"/></cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlposition">
+ <cd:arguments>
+ <cd:resolve name="xml-node-path"/>
+ <cd:argument><cd:constant type="cd:number"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlelement">
+ <cd:arguments>
+ <cd:resolve name="xml-node"/>
+ <cd:argument><cd:constant type="cd:number"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlpos">
+ <cd:arguments>
+ <cd:resolve name="xml-node"/>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlsnippet">
+ <cd:arguments>
+ <cd:resolve name="xml-node"/>
+ <cd:argument><cd:constant type="cd:number"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlconcat">
+ <cd:arguments>
+ <cd:resolve name="xml-node-path"/>
+ <cd:argument><cd:constant type="cd:text"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlconcatrange">
+ <cd:arguments>
+ <cd:resolve name="xml-node-path"/>
+ <cd:argument><cd:constant type="cd:text"/></cd:argument>
+ <cd:argument><cd:constant type="cd:first"/></cd:argument>
+ <cd:argument><cd:constant type="cd:last"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlcommand">
+ <cd:arguments>
+ <cd:resolve name="xml-node-path"/>
+ <cd:argument><cd:constant type="cd:xmlsetup"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlinlineverbatim">
+ <cd:arguments><cd:resolve name="xml-node"/></cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlinlineverbatim" type="environment">
+ <cd:arguments>
+ <cd:keywords>
+ <cd:constant type="cd:name"/>
+ </cd:keywords>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmldisplayverbatim">
+ <cd:arguments><cd:resolve name="xml-node"/></cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmldisplayverbatim" type="environment">
+ <cd:arguments>
+ <cd:keywords>
+ <cd:constant type="cd:name"/>
+ </cd:keywords>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlverbatim">
+ <cd:arguments><cd:resolve name="xml-node"/></cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlprettyprint">
+ <cd:arguments>
+ <cd:resolve name="xml-node"/>
+ <cd:argument><cd:constant type="cd:name"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlloadfile">
+ <cd:arguments>
+ <cd:argument><cd:constant type="cd:name"/></cd:argument>
+ <cd:argument><cd:constant type="cd:file"/></cd:argument>
+ <cd:argument><cd:constant type="cd:xmlsetup"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlloadbuffer">
+ <cd:arguments>
+ <cd:argument><cd:constant type="cd:buffer"/></cd:argument>
+ <cd:argument><cd:constant type="cd:name"/></cd:argument>
+ <cd:argument><cd:constant type="cd:xmlsetup"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlloaddata">
+ <cd:arguments>
+ <cd:argument><cd:constant type="cd:name"/></cd:argument>
+ <cd:argument><cd:constant type="cd:text"/></cd:argument>
+ <cd:argument><cd:constant type="cd:xmlsetup"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlloadonly">
+ <cd:arguments>
+ <cd:argument><cd:constant type="cd:name"/></cd:argument>
+ <cd:argument><cd:constant type="cd:file"/></cd:argument>
+ <cd:argument><cd:constant type="cd:xmlsetup"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlprocessfile">
+ <cd:arguments>
+ <cd:argument><cd:constant type="cd:name"/></cd:argument>
+ <cd:argument><cd:constant type="cd:file"/></cd:argument>
+ <cd:argument><cd:constant type="cd:xmlsetup"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlprocessbuffer">
+ <cd:arguments>
+ <cd:argument><cd:constant type="cd:buffer"/></cd:argument>
+ <cd:argument><cd:constant type="cd:name"/></cd:argument>
+ <cd:argument><cd:constant type="cd:xmlsetup"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlprocessdata">
+ <cd:arguments>
+ <cd:argument><cd:constant type="cd:name"/></cd:argument>
+ <cd:argument><cd:constant type="cd:text"/></cd:argument>
+ <cd:argument><cd:constant type="cd:xmlsetup"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlinclude">
+ <cd:arguments>
+ <cd:resolve name="xml-node-path"/>
+ <cd:argument><cd:constant type="cd:name"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlname">
+ <cd:arguments><cd:resolve name="xml-node"/></cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlnamespace">
+ <cd:arguments><cd:resolve name="xml-node"/></cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmltag">
+ <cd:arguments><cd:resolve name="xml-node"/></cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlcount">
+ <cd:arguments><cd:resolve name="xml-node"/></cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlatt">
+ <cd:arguments>
+ <cd:resolve name="xml-node"/>
+ <cd:argument><cd:constant type="cd:name"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlattdef">
+ <cd:arguments>
+ <cd:resolve name="xml-node"/>
+ <cd:argument><cd:constant type="cd:name"/></cd:argument>
+ <cd:argument><cd:constant type="cd:text"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlrefatt">
+ <cd:arguments>
+ <cd:resolve name="xml-node"/>
+ <cd:argument><cd:constant type="cd:name"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmllastatt" />
+
+ <cd:command name="xmlattribute">
+ <cd:arguments>
+ <cd:resolve name="xml-node-path"/>
+ <cd:argument><cd:constant type="cd:name"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlattributedef">
+ <cd:arguments>
+ <cd:resolve name="xml-node-path"/>
+ <cd:argument><cd:constant type="cd:name"/></cd:argument>
+ <cd:argument><cd:constant type="cd:text"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlchainatt">
+ <cd:arguments>
+ <cd:resolve name="xml-node"/>
+ <cd:argument><cd:constant type="cd:name"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlchainattdef">
+ <cd:arguments>
+ <cd:resolve name="xml-node"/>
+ <cd:argument><cd:constant type="cd:name"/></cd:argument>
+ <cd:argument><cd:constant type="cd:text"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmldirectives">
+ <cd:arguments><cd:resolve name="xml-node"/></cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmldirectivesbefore">
+ <cd:arguments><cd:resolve name="xml-node"/></cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmldirectivesafter">
+ <cd:arguments><cd:resolve name="xml-node"/></cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlinstalldirective">
+ <cd:arguments><cd:resolve name="name"/></cd:arguments>
+ <cd:arguments><cd:resolve name="name"/></cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlsetup">
+ <cd:arguments>
+ <cd:resolve name="xml-node"/>
+ <cd:argument><cd:constant type="cd:setup"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlsetsetup">
+ <cd:arguments>
+ <cd:argument><cd:constant type="cd:name"/></cd:argument>
+ <cd:argument><cd:constant type="cd:lpath"/></cd:argument>
+ <cd:argument><cd:constant type="cd:setup"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlremovesetup">
+ <cd:arguments>
+ <cd:argument><cd:constant type="cd:setup"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlremovedocumentsetup">
+ <cd:arguments>
+ <cd:argument><cd:constant type="cd:name"/></cd:argument>
+ <cd:argument><cd:constant type="cd:setup"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlflushdocumentsetups">
+ <cd:arguments>
+ <cd:argument><cd:constant type="cd:name"/></cd:argument>
+ <cd:argument><cd:constant type="cd:setup"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlresetsetups">
+ <cd:arguments>
+ <cd:argument><cd:constant type="cd:name"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlresetdocumentsetups">
+ <cd:arguments>
+ <cd:argument><cd:constant type="cd:name"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlprependsetup">
+ <cd:arguments>
+ <cd:argument><cd:constant type="cd:setup"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlappendsetup">
+ <cd:arguments>
+ <cd:argument><cd:constant type="cd:setup"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlbeforesetup">
+ <cd:arguments>
+ <cd:argument><cd:constant type="cd:setup"/></cd:argument>
+ <cd:argument><cd:constant type="cd:setup"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlaftersetup">
+ <cd:arguments>
+ <cd:argument><cd:constant type="cd:setup"/></cd:argument>
+ <cd:argument><cd:constant type="cd:setup"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlprependdocumentsetup">
+ <cd:arguments>
+ <cd:argument><cd:constant type="cd:name"/></cd:argument>
+ <cd:argument><cd:constant type="cd:setup"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlappenddocumentsetup">
+ <cd:arguments>
+ <cd:argument><cd:constant type="cd:name"/></cd:argument>
+ <cd:argument><cd:constant type="cd:setup"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlbeforedocumentsetup">
+ <cd:arguments>
+ <cd:argument><cd:constant type="cd:name"/></cd:argument>
+ <cd:argument><cd:constant type="cd:setup"/></cd:argument>
+ <cd:argument><cd:constant type="cd:setup"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlafterdocumentsetup">
+ <cd:arguments>
+ <cd:argument><cd:constant type="cd:name"/></cd:argument>
+ <cd:argument><cd:constant type="cd:setup"/></cd:argument>
+ <cd:argument><cd:constant type="cd:setup"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlregisteredsetups">
+ </cd:command>
+
+ <cd:command name="xmlregistereddocumentsetups">
+ <cd:arguments>
+ <cd:argument><cd:constant type="cd:name"/></cd:argument>
+ <cd:argument><cd:constant type="cd:setup"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlsetfunction">
+ <cd:arguments>
+ <cd:resolve name="xml-node-path"/>
+ <cd:argument><cd:constant type="cd:luafunction"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmldoif">
+ <cd:arguments>
+ <cd:resolve name="xml-node-path"/>
+ <cd:resolve name="xml-true"/>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmldoifnot">
+ <cd:arguments>
+ <cd:resolve name="xml-node-path"/>
+ <cd:resolve name="xml-true"/>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmldoifelse">
+ <cd:arguments>
+ <cd:resolve name="xml-node-path"/>
+ <cd:resolve name="xml-true-false"/>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmldoiftext">
+ <cd:arguments>
+ <cd:resolve name="xml-node-path"/>
+ <cd:resolve name="xml-true"/>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmldoifnottext">
+ <cd:arguments>
+ <cd:resolve name="xml-node-path"/>
+ <cd:resolve name="xml-true"/>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmldoifelsetext">
+ <cd:arguments>
+ <cd:resolve name="xml-node-path"/>
+ <cd:resolve name="xml-true-false"/>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmldoifselfempty">
+ <cd:arguments>
+ <cd:resolve name="xml-node"/>
+ <cd:resolve name="xml-true"/>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmldoifnotselfempty">
+ <cd:arguments>
+ <cd:resolve name="xml-node"/>
+ <cd:resolve name="xml-true"/>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmldoifelseselfempty">
+ <cd:arguments>
+ <cd:resolve name="xml-node"/>
+ <cd:resolve name="xml-true-false"/>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmldoifelseempty">
+ <cd:arguments>
+ <cd:resolve name="xml-node-path"/>
+ <cd:resolve name="xml-true-false"/>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlregisterns">
+ <cd:arguments>
+ <cd:argument><cd:constant type="cd:name"/></cd:argument>
+ <cd:argument><cd:constant type="cd:url"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlregisterns">
+ <cd:arguments>
+ <cd:argument><cd:constant type="cd:name"/></cd:argument>
+ <cd:argument><cd:constant type="cd:name"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlremapname">
+ <cd:arguments>
+ <cd:resolve name="xml-node-path"/>
+ <cd:argument><cd:constant type="cd:name"/></cd:argument>
+ <cd:argument><cd:constant type="cd:name"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlremapnamespace">
+ <cd:arguments>
+ <cd:resolve name="xml-node"/>
+ <cd:argument><cd:constant type="cd:name"/></cd:argument>
+ <cd:argument><cd:constant type="cd:name"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlchecknamespace">
+ <cd:arguments>
+ <cd:resolve name="xml-node"/>
+ <cd:argument><cd:constant type="cd:name"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlmapvalue">
+ <cd:arguments>
+ <cd:argument><cd:constant type="cd:category"/></cd:argument>
+ <cd:argument><cd:constant type="cd:name"/></cd:argument>
+ <cd:argument><cd:constant type="cd:text"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlvalue">
+ <cd:arguments>
+ <cd:argument><cd:constant type="cd:category"/></cd:argument>
+ <cd:argument><cd:constant type="cd:name"/></cd:argument>
+ <cd:argument><cd:constant type="cd:text"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmldoifelsevalue">
+ <cd:arguments>
+ <cd:argument><cd:constant type="cd:category"/></cd:argument>
+ <cd:argument><cd:constant type="cd:name"/></cd:argument>
+ <cd:resolve name="xml-true-false"/>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlloaddirectives">
+ <cd:arguments>
+ <cd:argument><cd:constant type="cd:file"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlsave">
+ <cd:arguments>
+ <cd:resolve name="xml-node"/>
+ <cd:argument><cd:constant type="cd:file"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmltofile">
+ <cd:arguments>
+ <cd:resolve name="xml-node-path"/>
+ <cd:argument><cd:constant type="cd:file"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmltobuffer">
+ <cd:arguments>
+ <cd:resolve name="xml-node-path"/>
+ <cd:argument><cd:constant type="cd:buffer"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmltobufferverbose">
+ <cd:arguments>
+ <cd:resolve name="xml-node-path"/>
+ <cd:argument><cd:constant type="cd:buffer"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <!-- not public cq. might disappear
+
+ <cd:command name="xmltoparameters">
+ <cd:arguments>
+ <cd:resolve name="xml-node-path"/>
+ <cd:argument><cd:constant type="cd:buffer"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ -->
+
+ <cd:command name="xmladdindex">
+ <cd:arguments><cd:resolve name="xml-node"/></cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlinclusion">
+ <cd:arguments><cd:resolve name="xml-node"/></cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlinclusions">
+ <cd:arguments><cd:resolve name="xml-node"/></cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlbadinclusions">
+ <cd:arguments><cd:resolve name="xml-node"/></cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlraw">
+ <cd:arguments><cd:resolve name="xml-node"/></cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlraw" type="environment" />
+
+ <!-- injectors -->
+
+ <cd:command name="xmlresetinjectors"/>
+
+ <cd:command name="xmlsetinjectors">
+ <cd:arguments>
+ <cd:keywords list="yes"><cd:constant type="cd:name"/></cd:keywords>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlinjector">
+ <cd:arguments>
+ <cd:argument><cd:constant type="cd:name"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmlapplyselectors">
+ <cd:arguments>
+ <cd:argument><cd:constant type="cd:node"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <!-- entities -->
+
+ <cd:command name="xmlsetentity">
+ <cd:arguments>
+ <cd:argument><cd:constant type="cd:name"/></cd:argument>
+ <cd:argument><cd:constant type="cd:text"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmltexentity">
+ <cd:arguments>
+ <cd:argument><cd:constant type="cd:name"/></cd:argument>
+ <cd:argument><cd:constant type="cd:text"/></cd:argument>
+ </cd:arguments>
+ </cd:command>
+
+ <!-- general setup -->
+
+ <cd:command name="setupxml">
+ <cd:arguments>
+ <cd:assignments list="yes">
+ <cd:parameter name="default">
+ <cd:constant type="hidden"/>
+ <cd:constant type="none"/>
+ <cd:constant type="text"/>
+ </cd:parameter>
+ <cd:parameter name="compress">
+ <cd:constant type="yes"/>
+ <cd:constant type="no"/>
+ </cd:parameter>
+ </cd:assignments>
+ </cd:arguments>
+ </cd:command>
+
+ <cd:command name="xmldefaulttotext">
+ <cd:arguments><cd:resolve name="xml-node"/></cd:arguments>
+ </cd:command>
+
+</cd:interface>
diff --git a/tex/context/modules/mkiv/x-set-11.mkiv b/tex/context/modules/mkiv/x-set-11.mkiv
index 91979cbbe..3e9dfed8c 100644
--- a/tex/context/modules/mkiv/x-set-11.mkiv
+++ b/tex/context/modules/mkiv/x-set-11.mkiv
@@ -557,7 +557,11 @@
\startxmlsetups xml:setups:assemblename
\doifelse {\xmlatt{#1}{type}} {environment} {
- \let\currentSETUPprefix\e!start
+ \doifsomethingelse {\xmlatt{#1}{begin}} {
+ \edef\currentSETUPprefix{\xmllastatt}%
+ } {
+ \let\currentSETUPprefix\e!start
+ }
} {
\let\currentSETUPprefix\empty
}