summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2021-06-27 17:38:44 +0200
committerContext Git Mirror Bot <phg@phi-gamma.net>2021-06-27 17:38:44 +0200
commit070c533456efeba3c0c97908ab9930f00ae7b61c (patch)
treee4ca9afb3906c2df0be8c89a88d040160b713826
parent1586f911ab2a59c70e15db58a5beb3d74f44dd7a (diff)
downloadcontext-070c533456efeba3c0c97908ab9930f00ae7b61c.tar.gz
2021-06-27 16:56:00
-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/mkiv/cont-new.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkiv2
-rw-r--r--tex/context/base/mkiv/font-oup.lua14
-rw-r--r--tex/context/base/mkiv/node-tsk.lua1
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin23594 -> 23617 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin248100 -> 248307 bytes
-rw-r--r--tex/context/base/mkxl/back-exp.lmt123
-rw-r--r--tex/context/base/mkxl/back-exp.mkxl102
-rw-r--r--tex/context/base/mkxl/back-ini.mkxl7
-rw-r--r--tex/context/base/mkxl/colo-ini.mkxl4
-rw-r--r--tex/context/base/mkxl/cont-new.mkxl2
-rw-r--r--tex/context/base/mkxl/context.mkxl2
-rw-r--r--tex/context/base/mkxl/lpdf-col.lmt12
-rw-r--r--tex/context/base/mkxl/lpdf-emb.lmt10
-rw-r--r--tex/context/base/mkxl/lpdf-ini.lmt4
-rw-r--r--tex/context/base/mkxl/lpdf-lmt.lmt8
-rw-r--r--tex/context/base/mkxl/lpdf-tag.lmt10
-rw-r--r--tex/context/base/mkxl/lpdf-wid.lmt16
-rw-r--r--tex/context/base/mkxl/math-tag.lmt102
-rw-r--r--tex/context/base/mkxl/node-acc.lmt8
-rw-r--r--tex/context/base/mkxl/node-fin.lmt395
-rw-r--r--tex/context/base/mkxl/node-nut.lmt1
-rw-r--r--tex/context/base/mkxl/node-pro.lmt4
-rw-r--r--tex/context/base/mkxl/node-shp.lmt40
-rw-r--r--tex/context/base/mkxl/node-tsk.lmt1
-rw-r--r--tex/context/base/mkxl/strc-tag.lmt4
-rw-r--r--tex/context/base/mkxl/strc-tag.mkxl18
-rw-r--r--tex/context/base/mkxl/typo-bld.lmt14
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua11
31 files changed, 425 insertions, 496 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index 7be29328f..430e4c2a7 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{2021.06.25 22:44}
+\newcontextversion{2021.06.27 16:54}
%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 787df8bda..bc85e355b 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{2021.06.25 22:44}
+\edef\contextversion{2021.06.27 16:54}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index a75fb7ae8..28dd93980 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{2021.06.25 22:44}
+\newcontextversion{2021.06.27 16:54}
%D This file is loaded at runtime, thereby providing an excellent place for hacks,
%D patches, extensions and new features. There can be local overloads in cont-loc
diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv
index 3df274b35..d5bef984a 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{2021.06.25 22:44}
+\edef\contextversion{2021.06.27 16:54}
%D Kind of special:
diff --git a/tex/context/base/mkiv/font-oup.lua b/tex/context/base/mkiv/font-oup.lua
index 975e62f64..6733b6efb 100644
--- a/tex/context/base/mkiv/font-oup.lua
+++ b/tex/context/base/mkiv/font-oup.lua
@@ -40,13 +40,13 @@ local f_character_n = formatters["[ %C ]"]
local check_duplicates = true -- can become an option (pseudo feature) / always needed anyway
local check_soft_hyphen = true -- can become an option (pseudo feature) / needed for tagging
-if CONTEXTLMTXMODE and CONTEXTLMTXMODE > 0 then
- check_soft_hyphen = false -- solved better elsewhere
-else
- directives.register("otf.checksofthyphen",function(v)
- check_soft_hyphen = v
- end)
-end
+-- if CONTEXTLMTXMODE and CONTEXTLMTXMODE > 0 then
+-- check_soft_hyphen = false -- solved better elsewhere
+-- else
+-- directives.register("otf.checksofthyphen",function(v)
+-- check_soft_hyphen = v
+-- end)
+-- end
local function replaced(list,index,replacement)
if type(list) == "number" then
diff --git a/tex/context/base/mkiv/node-tsk.lua b/tex/context/base/mkiv/node-tsk.lua
index ca7c7fee4..9e263df91 100644
--- a/tex/context/base/mkiv/node-tsk.lua
+++ b/tex/context/base/mkiv/node-tsk.lua
@@ -663,6 +663,7 @@ tasks.new {
"before",
"normalizers",
"builders",
+ "finalizers",
"after",
},
templates = {
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 5de1fae5b..5bf31dc0f 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 4a947eb3f..2273d06c0 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/mkxl/back-exp.lmt b/tex/context/base/mkxl/back-exp.lmt
index 81a0bf7d5..01a885471 100644
--- a/tex/context/base/mkxl/back-exp.lmt
+++ b/tex/context/base/mkxl/back-exp.lmt
@@ -137,7 +137,6 @@ local currentdepth = 0
local wrapups = { }
local tree = { data = { }, fulltag == "root" } -- root
-local treeroot = tree
local treehash = { }
local extras = { }
local checks = { }
@@ -845,9 +844,9 @@ do
used[element][detail or ""] = { nature, specification.parents } -- for template css
-- also in last else ?
local metadata = specification.metadata
- if metadata then
+ if metadata and next(metadata) then
result[#result+1] = f_metadata_begin(depth)
- for k, v in table.sortedpairs(metadata) do
+ for k, v in sortedhash(metadata) do
if v ~= "" then
result[#result+1] = f_metadata(depth+1,k,lpegmatch(p_entity,v))
end
@@ -1923,7 +1922,11 @@ do
local xmlcollected = xml.collected
local xmlsetcomment = xml.setcomment
-local xmlpreamble = [[
+local xmlpreamble_nop = [[
+<?xml version="1.0" encoding="UTF-8" standalone="%standalone%" ?>
+]]
+
+local xmlpreamble_yes = [[
<?xml version="1.0" encoding="UTF-8" standalone="%standalone%" ?>
<!--
@@ -1939,8 +1942,8 @@ local xmlpreamble = [[
local flushtree = wrapups.flushtree
- local function wholepreamble(standalone)
- return replacetemplate(xmlpreamble, {
+ local function wholepreamble(standalone,nocomment)
+ return replacetemplate(nocomment and xmlpreamble_nop or xmlpreamble_yes, {
standalone = standalone and "yes" or "no",
filename = tex.jobname,
date = included.date and os.fulltime(),
@@ -2068,13 +2071,20 @@ local htmltemplate = [[
return concat(result,"\n\n")
end
- local function allcontent(tree,embed)
- local result = { }
+ local function allcontent(tree)
+ local result = { }
+ local data = tree.data
+ for i=1,#data do
+ if data[i].tg ~= "document" then
+ data[i] = { }
+ end
+ end
flushtree(result,tree.data,"display") -- we need to collect images
result = concat(result)
-- no need to lpeg .. fast enough
result = gsub(result,"\n *\n","\n")
result = gsub(result,"\n +([^< ])","\n%1")
+ --
return result
end
@@ -2351,6 +2361,83 @@ local htmltemplate = [[
local embedfile = false directives.register("export.embed",function(v) embedfile = v end)
+ local justexport = nodes.handlers.export
+
+ local function wrapuptree(tree)
+ wrapups.fixtree(tree)
+ wrapups.collapsetree(tree)
+ wrapups.indextree(tree)
+ wrapups.checktree(tree)
+ wrapups.breaktree(tree)
+ wrapups.finalizetree(tree)
+ end
+
+ local function localexport(head)
+ starttiming(treehash)
+
+ local saved_treestack = treestack
+ local saved_nesting = nesting
+ local saved_currentdepth = currentdepth
+ local saved_tree = tree
+ local saved_treehash = treehash
+ local saved_nofbreaks = nofbreaks
+ local saved_show_comment = show_comment
+
+ treestack = { }
+ nesting = { }
+ currentdepth = 0
+ tree = { data = { }, fulltag == "root" } -- root
+ treehash = { }
+ nofbreaks = 0
+ show_comment = false
+
+ justexport(head)
+ finishexport()
+ wrapuptree(tree)
+
+ -- tree.data = tree.data[1].data
+
+ local result = concat {
+ wholepreamble(true,true),
+ allcontent(tree),
+ }
+
+ treestack = saved_treestack
+ nesting = saved_nesting
+ currentdepth = saved_currentdepth
+ tree = saved_tree
+ treehash = saved_treehash
+ nofbreaks = saved_nofbreaks
+ show_comment = saved_show_comment
+
+ stoptiming(treehash)
+
+ return result
+
+ end
+
+ structurestags.localexport = localexport
+
+ function structures.tags.exportbox(n,filename,buffername)
+ local list = nodes.nuts.getbox(n)
+ if n then
+ local e = localexport(list)
+ if filename and filename ~= "" then
+ io.savedata(filename,e)
+ elseif buffername then
+ buffers.assign(buffername == interfaces.variables.yes and "" or buffername,e)
+ else
+ return e
+ end
+ end
+ end
+
+ interfaces.implement {
+ name = "exportbox",
+ arguments = { "integer", "string", "string" },
+ actions = structures.tags.exportbox
+ }
+
function structurestags.finishexport()
if exporting then
@@ -2373,14 +2460,7 @@ local htmltemplate = [[
end
report_export("")
--
- wrapups.fixtree(tree)
- wrapups.collapsetree(tree)
- wrapups.indextree(tree)
- wrapups.checktree(tree)
- wrapups.breaktree(tree)
- wrapups.finalizetree(tree)
- --
- wrapups.hashlistdata()
+ wrapuptree(tree)
--
local askedname = finetuning.file
--
@@ -2474,14 +2554,7 @@ local htmltemplate = [[
-- representation that uses verbose element names and carries information in
-- attributes
- local data = tree.data
- for i=1,#data do
- if data[i].tg ~= "document" then
- data[i] = { }
- end
- end
-
- local result = allcontent(tree,embedmath) -- embedfile is for testing
+ local result = allcontent(tree)
-- ugly but so be it:
@@ -2523,7 +2596,7 @@ local htmltemplate = [[
os.remove(htmlfilename)
result = concat {
- wholepreamble(true),
+ wholepreamble(true,true),
"<!-- This export file is used for filtering runtime only! -->\n",
result,
}
diff --git a/tex/context/base/mkxl/back-exp.mkxl b/tex/context/base/mkxl/back-exp.mkxl
index b7dd0db70..82329cc6a 100644
--- a/tex/context/base/mkxl/back-exp.mkxl
+++ b/tex/context/base/mkxl/back-exp.mkxl
@@ -358,4 +358,106 @@
\fi
\to \everystartdocument
+%D This can replace the older (rather unknown) attachment feature because it
+%D is more immediate (same run). I can also use this then for manuals.
+%D
+%D \setuptagging[state=start] % mandate here
+%D
+%D \starttyping
+%D \startmathexport % [buffer=yes]
+%D test $ x = 1 + a $ test
+%D \stopmathexport
+%D
+%D \typebuffer
+%D
+%D \startmathexport[buffer=math]
+%D test $ x = 1 + a^2 $ test
+%D test $ x = 1 + a $ test
+%D test $ x = z + \sqrt{a} $ test
+%D \stopmathexport
+%D
+%D \typebuffer[math]
+%D
+%D \startmathexport[filename=foo.xml]
+%D test $ x = z + \sqrt{a} $ test
+%D \stopmathexport
+%D
+%D \dorecurse{\collectedmath} {\page \collectedmath #1 \page}
+%D \stoptyping
+%D
+%D This one also does buffers and files:
+%D
+%D \starttyping
+%D \startboxexport
+%D \startparagraph
+%D \input tufte
+%D \stopparagraph
+%D \startitemize
+%D \startitem item one \stopitem
+%D \startitem item two \stopitem
+%D \stopitemize
+%D \startparagraph
+%D \input tufte
+%D \stopparagraph
+%D \stopboxexport
+%D
+%D \typebuffer
+%D \stoptyping
+
+\installcorenamespace {boxexport}
+\installcorenamespace {mathexport}
+
+\installsetuponlycommandhandler \??boxexport {boxexport}
+\installsetuponlycommandhandler \??mathexport {mathexport}
+
+% \permanent\tolerant\protected\def\startboxexport[#1]%
+% {\dowithnextbox{\strc_export_box{#1}}\vbox\bgroup}
+%
+% \permanent\protected\def\stopboxexport
+% {\egroup}
+%
+% \def\strc_export_box#1%
+% {\ctxlua{buffers.assign("#1",structures.tags.exportbox(\number\nextbox))}}
+
+\permanent\tolerant\protected\def\startboxexport[#1]%
+ {\begingroup
+ \iftok{#1}\emptytoks
+ \letboxexportparameter\c!buffer\v!yes
+ \orelse\ifhastok={#1}\relax
+ \setupmathexport[#1]%
+ \else
+ \setboxexportparameter\c!buffer{#1}%
+ \fi
+ \setbox\nextbox\vbox\bgroup}
+
+\permanent\protected\def\stopboxexport
+ {\egroup
+ \clf_exportbox \nextbox
+ {\boxexportparameter\c!file}%
+ {\boxexportparameter\c!buffer}%
+ \endgroup}
+
+\permanent\tolerant\protected\def\startmathexport[#1]%
+ {\begingroup
+ \iftok{#1}\emptytoks
+ \letboxexportparameter\c!buffer\v!yes
+ \orelse\ifhastok={#1}\relax
+ \setupmathexport[#1]%
+ \else
+ \setboxexportparameter\c!buffer{#1}%
+ \fi
+ \clf_startcollectingmath}
+
+\permanent\protected\def\stopmathexport
+ {\clf_stopcollectingmath
+ \clf_processcollectedmath
+ {\boxexportparameter\c!file}
+ {\boxexportparameter\c!buffer}%
+ \endgroup}
+
+% Defined at the \LUA\ end:
+%
+% \the\collectedmath : number of snippets
+% \collectedmath n : specific snippet
+
\protect \endinput
diff --git a/tex/context/base/mkxl/back-ini.mkxl b/tex/context/base/mkxl/back-ini.mkxl
index fad9c1e70..8a4b9d894 100644
--- a/tex/context/base/mkxl/back-ini.mkxl
+++ b/tex/context/base/mkxl/back-ini.mkxl
@@ -50,6 +50,13 @@
\clf_setrealspaces{\backendparameter\c!space}%
\to \everysetupbackend
+\appendtoks
+ \clf_setsofthyphens{\backendparameter\c!hyphen}%
+\to \everysetupbackend
+
+\setupbackend
+ [\c!hyphen=\v!yes]
+
%D For the moment this is an experiment (defauls is pdf, but we also
%D have lua, json and mps).
%D
diff --git a/tex/context/base/mkxl/colo-ini.mkxl b/tex/context/base/mkxl/colo-ini.mkxl
index 2c9c93950..cccbb218e 100644
--- a/tex/context/base/mkxl/colo-ini.mkxl
+++ b/tex/context/base/mkxl/colo-ini.mkxl
@@ -288,10 +288,10 @@
\let\v_colo_freeze_state\s!false
-\setvalue{\??colorconversions\v!yes}%
+\defcsname\??colorconversions\v!yes\endcsname
{\settrue \c_colo_convert_gray}
-\setvalue{\??colorconversions\v!always}%
+\defcsname\??colorconversions\v!always\endcsname
{\settrue \c_colo_convert_gray
\setfalse\c_colo_rgb_supported
\setfalse\c_colo_cmyk_supported}
diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl
index b1c57cd7a..2716055d2 100644
--- a/tex/context/base/mkxl/cont-new.mkxl
+++ b/tex/context/base/mkxl/cont-new.mkxl
@@ -13,7 +13,7 @@
% \normalend % uncomment this to get the real base runtime
-\newcontextversion{2021.06.25 22:44}
+\newcontextversion{2021.06.27 16:54}
%D This file is loaded at runtime, thereby providing an excellent place for hacks,
%D patches, extensions and new features. There can be local overloads in cont-loc
diff --git a/tex/context/base/mkxl/context.mkxl b/tex/context/base/mkxl/context.mkxl
index e28506a3a..4976f4ffe 100644
--- a/tex/context/base/mkxl/context.mkxl
+++ b/tex/context/base/mkxl/context.mkxl
@@ -29,7 +29,7 @@
%D {YYYY.MM.DD HH:MM} format.
\immutable\edef\contextformat {\jobname}
-\immutable\edef\contextversion{2021.06.25 22:44}
+\immutable\edef\contextversion{2021.06.27 16:54}
%overloadmode 1 % check frozen / warning
%overloadmode 2 % check frozen / error
diff --git a/tex/context/base/mkxl/lpdf-col.lmt b/tex/context/base/mkxl/lpdf-col.lmt
index 28413fd9a..ed6a4fa7b 100644
--- a/tex/context/base/mkxl/lpdf-col.lmt
+++ b/tex/context/base/mkxl/lpdf-col.lmt
@@ -36,18 +36,6 @@ local pdfdelayedobject = lpdf.delayedobject
local pdfflushstreamobject = lpdf.flushstreamobject
local pdfshareobjectreference = lpdf.shareobjectreference
--- local pdfflushobject
--- local pdfdelayedobject
--- local pdfflushstreamobject
--- local pdfshareobjectreference
---
--- updaters.register("backend.update.lpdf",function()
--- pdfflushobject = lpdf.flushobject
--- pdfdelayedobject = lpdf.delayedobject
--- pdfflushstreamobject = lpdf.flushstreamobject
--- pdfshareobjectreference = lpdf.shareobjectreference
--- end)
-
local addtopageattributes = lpdf.addtopageattributes
local adddocumentcolorspace = lpdf.adddocumentcolorspace
local adddocumentextgstate = lpdf.adddocumentextgstate
diff --git a/tex/context/base/mkxl/lpdf-emb.lmt b/tex/context/base/mkxl/lpdf-emb.lmt
index 4781b5bad..f9fb7d3c2 100644
--- a/tex/context/base/mkxl/lpdf-emb.lmt
+++ b/tex/context/base/mkxl/lpdf-emb.lmt
@@ -51,16 +51,6 @@ local pdfreserveobject = lpdf.reserveobject
local pdfflushobject = lpdf.flushobject
local pdfflushstreamobject = lpdf.flushstreamobject
--- local pdfreserveobject
--- local pdfflushobject
--- local pdfflushstreamobject
---
--- updaters.register("backend.update.lpdf",function()
--- pdfreserveobject = lpdf.reserveobject
--- pdfflushobject = lpdf.flushobject
--- pdfflushstreamobject = lpdf.flushstreamobject
--- end)
-
local report_fonts = logs.reporter("backend","fonts")
local trace_fonts = false
diff --git a/tex/context/base/mkxl/lpdf-ini.lmt b/tex/context/base/mkxl/lpdf-ini.lmt
index 3b2ee17ac..35ed22222 100644
--- a/tex/context/base/mkxl/lpdf-ini.lmt
+++ b/tex/context/base/mkxl/lpdf-ini.lmt
@@ -111,8 +111,8 @@ local pdfreserveobject
local pdfimmediateobject
updaters.register("backend.update.lpdf",function()
- pdfreserveobject = lpdf.reserveobject
- pdfimmediateobject = lpdf.immediateobject
+ pdfreserveobject = lpdf.reserveobject
+ pdfimmediateobject = lpdf.immediateobject
end)
do
diff --git a/tex/context/base/mkxl/lpdf-lmt.lmt b/tex/context/base/mkxl/lpdf-lmt.lmt
index 3c9877008..fc488297f 100644
--- a/tex/context/base/mkxl/lpdf-lmt.lmt
+++ b/tex/context/base/mkxl/lpdf-lmt.lmt
@@ -631,7 +631,7 @@ do
local move = calc_pdfpos(pos_h,pos_v)
if trace_threshold then
- report(
+ report_fonts(
"before: font %i, char %C, factor %i, naturalwidth %p, move %l, tm %l, hpos %p, delta %p, threshold %p, cw %p",
font,char,factor,naturalwidth[char],move,need_tm,pos_h,tj_delta,threshold,cw
)
@@ -676,7 +676,7 @@ do
end
if trace_threshold then
- report(
+ report_fonts(
"after : font %i, char %C, factor %i, naturalwidth %p, move %l, tm %l, hpos %p, delta %p, threshold %p, cw %p",
font,char,factor,naturalwidth[char],move,need_tm,pos_h,tj_delta,threshold,cw
)
@@ -2488,7 +2488,7 @@ local openfile, closefile do
else
f = io.open(filename,"wb")
if not f then
- -- message
+ report("quitting because file %a cannot be opened for writing",filename)
os.exit()
end
-- f:setvbuf("full",64*1024)
@@ -3010,7 +3010,7 @@ do
lpdf.finalizepage(true)
end
end)
- -- --
+ --
lpdf.registerdocumentfinalizer(wrapup,nil,"wrapping up")
--
statistics.register("result saved in file", function()
diff --git a/tex/context/base/mkxl/lpdf-tag.lmt b/tex/context/base/mkxl/lpdf-tag.lmt
index e1bfcf955..21f5b246d 100644
--- a/tex/context/base/mkxl/lpdf-tag.lmt
+++ b/tex/context/base/mkxl/lpdf-tag.lmt
@@ -43,16 +43,6 @@ local pdfflushobject = lpdf.flushobject
local pdfreserveobject = lpdf.reserveobject
local pdfpagereference = lpdf.pagereference
--- local pdfflushobject
--- local pdfreserveobject
--- local pdfpagereference
---
--- updaters.register("backend.update.lpdf",function()
--- pdfflushobject = lpdf.flushobject
--- pdfreserveobject = lpdf.reserveobject
--- pdfpagereference = lpdf.pagereference
--- end)
-
local texgetcount = tex.getcount
local nodecodes = nodes.nodecodes
diff --git a/tex/context/base/mkxl/lpdf-wid.lmt b/tex/context/base/mkxl/lpdf-wid.lmt
index 2309d1686..1bccd9fc9 100644
--- a/tex/context/base/mkxl/lpdf-wid.lmt
+++ b/tex/context/base/mkxl/lpdf-wid.lmt
@@ -79,22 +79,6 @@ local pdfreserveobject = lpdf.reserveobject
local pdfpagereference = lpdf.pagereference
local pdfshareobjectreference = lpdf.shareobjectreference
--- local pdfflushobject
--- local pdfflushstreamobject
--- local pdfflushstreamfileobject
--- local pdfreserveobject
--- local pdfpagereference
--- local pdfshareobjectreference
---
--- updaters.register("backend.update.lpdf",function()
--- pdfflushobject = lpdf.flushobject
--- pdfflushstreamobject = lpdf.flushstreamobject
--- pdfflushstreamfileobject = lpdf.flushstreamfileobject
--- pdfreserveobject = lpdf.reserveobject
--- pdfpagereference = lpdf.pagereference
--- pdfshareobjectreference = lpdf.shareobjectreference
--- end)
-
-- symbols
local presets = { } -- xforms
diff --git a/tex/context/base/mkxl/math-tag.lmt b/tex/context/base/mkxl/math-tag.lmt
index 80e78b328..fa10c51c2 100644
--- a/tex/context/base/mkxl/math-tag.lmt
+++ b/tex/context/base/mkxl/math-tag.lmt
@@ -195,6 +195,15 @@ end
-- )
-- end
+-- I need to bring this in sync with new or removed mathml 3, not that there has
+-- been many changes. It will happen in sync with other mathml updates in context
+-- where we also keep adapting to a cycling between either or not support in
+-- browsers, the come-and-go of alternatives like ascii math and mathjax. It's the
+-- web and browser support that drives this, not tex and its community. So, maybe
+-- I'll add some more detail here, nto that it matters much in the long run where we
+-- only focus on structure and let the engine deal with the details. Another reason
+-- to update this is that we can add some tracing (lmtx only).
+
process = function(start) -- we cannot use the processor as we have no finalizers (yet)
local mtexttag = nil
for start, id, subtype in nextnode, start do -- current
@@ -583,3 +592,96 @@ function noads.handlers.tags(head,style,penalties)
stop_tagged()
stop_tagged()
end
+
+do
+
+ -- This one is meant for tracing (in m4all/m4mbo where it complements some other
+ -- tracing) but it actually can also replace the embedding feature although that
+ -- one might be better when we have more complex code with dependencies outside
+ -- the blob. I'll deal with that when it's needed (trivial). The current
+ -- interface is rather minimalistic.
+
+ local enabled = false
+ local export = false
+ local allmath = false
+ local warned = false
+
+ function mathematics.startcollecting()
+ if structures.tags.enabled() then
+ if not enabled then
+ nodes.tasks.enableaction("math", "noads.handlers.export")
+ end
+ enabled = true
+ export = structures.tags.localexport
+ allmath = { }
+ elseif not warned then
+ report_tags("math collecting only works when tagging is enabled")
+ warned = true
+ end
+ end
+
+ function mathematics.stopcollecting()
+ export = false
+ end
+
+ local function collected(asstring)
+ local a = allmath or { }
+ return asstring and concat(a) or a
+ end
+
+ mathematics.collected = collected
+
+ interfaces.implement {
+ name = "startcollectingmath",
+ -- public = true,
+ protected = true,
+ actions = mathematics.startcollecting
+ }
+
+ interfaces.implement {
+ name = "stopcollectingmath",
+ -- public = true,
+ protected = true,
+ actions = mathematics.stopcollecting
+ }
+
+ interfaces.implement {
+ name = "processcollectedmath",
+ -- public = true,
+ protected = true,
+ arguments = "2 strings",
+ actions = function(filename,buffername)
+ if filename and filename ~= "" then
+ io.savedata(filename,collected(true))
+ elseif buffername then
+ buffers.assign(buffername == interfaces.variables.yes and "" or buffername,collected(true))
+ else
+ return collected
+ end
+ end
+ }
+
+ interfaces.implement {
+ name = "collectedmath",
+ usage = "value",
+ protected = true,
+ public = true,
+ actions = function(what)
+ if what == "value" then
+ return tokens.values.integer, allmath and #allmath or 0
+ else
+ context(allmath and allmath[tokens.scanners.integer()] or nil)
+ end
+ end
+ }
+
+ function noads.handlers.export(head)
+ if export then
+ allmath[#allmath+1] = export(head)
+ end
+ return head
+ end
+
+ nodes.tasks.appendaction("math", "finalizers", "noads.handlers.export", nil, "nonut", "disabled")
+
+end
diff --git a/tex/context/base/mkxl/node-acc.lmt b/tex/context/base/mkxl/node-acc.lmt
index 328074428..05de3c851 100644
--- a/tex/context/base/mkxl/node-acc.lmt
+++ b/tex/context/base/mkxl/node-acc.lmt
@@ -26,12 +26,10 @@ local getnext = nuts.getnext
local setattr = nuts.setattr
local setlink = nuts.setlink
local setchar = nuts.setchar
-local setsubtype = nuts.setsubtype
local getwidth = nuts.getwidth
local setwidth = nuts.setwidth
local nextglyph = nuts.traversers.glyph
-local nextnode = nuts.traversers.node
local copy_node = nuts.copy
@@ -43,7 +41,6 @@ local glyph_code = nodecodes.glyph
local hlist_code = nodecodes.hlist
local vlist_code = nodecodes.vlist
-local userskip_code = gluecodes.user
local spaceskip_code = gluecodes.spaceskip
local xspaceskip_code = gluecodes.xspaceskip
@@ -62,7 +59,8 @@ local slot = nil
local function injectspaces(head)
-- This can become two fast loops or we just move this to the backend where we can
-- also check for spaces (it actually is rather old code that relates to tagging
- -- and so, which was implemented rather early in the mkiv saga).
+ -- and so, which was implemented rather early in the mkiv saga). It can also become
+ -- a helper.
local p, p_id
local n = head
while n do
@@ -75,7 +73,7 @@ local function injectspaces(head)
local a = getattr(n,a_characters)
setchar(g,slot)
setlink(p,g,n)
- setwidth(n,getwidth(n) - getwidth(g))
+ setwidth(n,getwidth(n) - getwidth(g)) -- use criterium
if a then
setattr(g,a_characters,a)
end
diff --git a/tex/context/base/mkxl/node-fin.lmt b/tex/context/base/mkxl/node-fin.lmt
index ffabd25ea..a7086b5b1 100644
--- a/tex/context/base/mkxl/node-fin.lmt
+++ b/tex/context/base/mkxl/node-fin.lmt
@@ -7,11 +7,6 @@ if not modules then modules = { } end modules ['node-fin'] = {
license = "see context related readme files",
}
--- this module is being reconstructed
--- local functions, only slightly slower
---
--- leaders are also triggers ... see colo-ext for an example (negate a box)
-
local next, type, format = next, type, string.format
local setmetatableindex = table.setmetatableindex
@@ -36,7 +31,6 @@ local setlist = nuts.setlist
local setleader = nuts.setleader
local copy_node = nuts.copy
------ find_tail = nuts.tail
local insertnodebefore = nuts.insertbefore
local insertnodeafter = nuts.insertafter
local appendaftertail = nuts.appendaftertail
@@ -65,8 +59,6 @@ local texgetnest = tex.getnest
local states = attributes.states
local numbers = attributes.numbers
------ a_trigger = attributes.private('trigger')
------ triggering = false
local implement = interfaces.implement
@@ -140,7 +132,7 @@ end
-- the injectors
-local nsdata, nsnone, nslistwise, nsforced, nsselector -- , nstrigger
+local nsdata, nsnone, nslistwise, nsforced, nsselector
local current, current_selector = 0, 0 -- nb, stack has a local current !
local nsbegin, nsend, nsreset
@@ -150,7 +142,6 @@ function states.initialize(namespace,attribute,head)
nsforced = namespace.forced
nsselector = namespace.selector
nslistwise = namespace.listwise
- -- nstrigger = triggering and namespace.triggering and a_trigger
current = 0
current_selector = 0
nsstep = namespace.resolve_step
@@ -169,14 +160,9 @@ function states.finalize(namespace,attribute,head) -- is this one ok?
if id == hlist_code or id == vlist_code then
local content = getlist(head)
if content then
--- local list = insertnodeafter(content,find_tail(content),copy_node(nsnone)) -- two return values
--- if list ~= content then
--- setlist(head,list)
--- end
appendaftertail(content,copy_node(nsnone))
end
else
--- head = insertnodeafter(find_tail(head),head,copy_node(nsnone))
appendaftertail(head,copy_node(nsnone))
end
return head, true
@@ -198,11 +184,6 @@ local function process(attribute,head,inheritance,default) -- one attribute
elseif id == hlist_code or id == vlist_code then
-- tricky checking
local outer
--- if subtype == container_code then
--- check = true
--- current = 0
--- end
--- if getorientation(stack) then
if subtype == container_code or getorientation(stack) then
outer = getattr(stack,attribute)
if outer then
@@ -225,27 +206,10 @@ local function process(attribute,head,inheritance,default) -- one attribute
current = 0
end
end
- -- begin nested --
- --
- -- local list
- -- if nstrigger and getattr(stack,nstrigger) then
- -- if not outer then
- -- outer = getattr(stack,attribute)
- -- end
- -- if outer ~= inheritance then
- -- list = process(attribute,content,inheritance,outer)
- -- else
- -- list = process(attribute,content,inheritance,default)
- -- end
- -- else
- -- list = process(attribute,content,inheritance,default)
- -- end
- --
local list = process(attribute,content,inheritance,default)
if content ~= list then
setlist(stack,list)
end
- -- end nested --
elseif id == rule_code then
check = hasdimensions(stack)
end
@@ -271,25 +235,10 @@ local function process(attribute,head,inheritance,default) -- one attribute
-- for improvement here
current = 0
end
- -- begin nested --
- --
- -- local list
- -- if nstrigger and getattr(stack,nstrigger) then
- -- local outer = getattr(stack,attribute)
- -- if outer ~= inheritance then
- -- list = process(attribute,leader,inheritance,outer)
- -- else
- -- list = process(attribute,leader,inheritance,default)
- -- end
- -- else
- -- list = process(attribute,leader,inheritance,default)
- -- end
- --
local list = process(attribute,leader,inheritance,default)
if leader ~= list then
setleader(stack,list)
end
- -- end nested --
current = savedcurrent
leader = false
end
@@ -322,11 +271,6 @@ local function simple(attribute,head)
check = true
leader = content
elseif id == hlist_code or id == vlist_code then
--- if subtype == container_code then
--- check = true
--- current = 0
--- end
--- if getorientation(stack) then
if subtype == container_code or getorientation(stack) then
local outer = getattr(stack,attribute)
if outer then
@@ -386,137 +330,13 @@ states.simple = function(namespace,attribute,head,default)
return simple(attribute,head,default)
end
--- we can force a selector, e.g. document wide color spaces, saves a little
--- watch out, we need to check both the selector state (like colorspace) and
--- the main state (like color), otherwise we get into troubles when a selector
--- state changes while the main state stays the same (like two glyphs following
--- each other with the same color but different color spaces e.g. \showcolor)
-
--- local function selective(attribute,head,inheritance,default) -- two attributes
--- local check = false
--- local leader = nil
--- for stack, id, subtype, content in nextcontent, head do
--- if id == glyph_code or id == disc_code then
--- check = true
--- elseif id == glue_code then
--- check = true
--- leader = content -- getleader(stack)
--- elseif id == hlist_code or id == vlist_code then
--- -- tricky checking
--- if subtype == container_code then
--- check = true
--- current = 0
--- end
--- local outer
--- if getorientation(stack) then
--- outer = getattr(stack,attribute)
--- if outer then
--- if default and outer == inheritance then
--- if current ~= default then
--- local data = nsdata[default]
--- head = insertnodebefore(head,stack,copy_node(data[nsforced or getattr(stack,nsselector) or nsselector]))
--- current = default
--- end
--- else
--- local s = getattr(stack,nsselector)
--- -- local s = nsforced or getattr(stack,nsselector)
--- if current ~= outer or current_selector ~= s then
--- local data = nsdata[outer]
--- head = insertnodebefore(head,stack,copy_node(data[nsforced or s or nsselector]))
--- current = outer
--- current_selector = s
--- end
--- end
--- elseif default and inheritance then
--- if current ~= default then
--- local data = nsdata[default]
--- head = insertnodebefore(head,stack,copy_node(data[nsforced or getattr(stack,nsselector) or nsselector]))
--- current = default
--- end
--- elseif current > 0 then
--- head = insertnodebefore(head,stack,copy_node(nsnone))
--- current, current_selector = 0, 0
--- end
--- end
--- -- begin nested
--- local list
--- if nstrigger and getattr(stack,nstrigger) then
--- if not outer then
--- outer = getattr(stack,attribute)
--- end
--- if outer ~= inheritance then
--- list = selective(attribute,content,inheritance,outer)
--- else
--- list = selective(attribute,content,inheritance,default)
--- end
--- else
--- list = selective(attribute,content,inheritance,default)
--- end
--- if content ~= list then
--- setlist(stack,list)
--- end
--- -- end nested
--- elseif id == rule_code then
--- if subtype == boxrule_code or subtype == imagerule_code or subtype == emptyrule_code then
--- -- so no redundant color stuff (only here, layers for instance should obey)
--- check = false
--- else
--- check = hasdimensions(stack)
--- end
--- end
--- if check then
--- local c = getattr(stack,attribute)
--- if c then
--- if default and c == inheritance then
--- if current ~= default then
--- local data = nsdata[default]
--- head = insertnodebefore(head,stack,copy_node(data[nsforced or getattr(stack,nsselector) or nsselector]))
--- current = default
--- end
--- else
--- local s = getattr(stack,nsselector)
--- -- local s = nsforced or getattr(stack,nsselector)
--- if current ~= c or current_selector ~= s then
--- local data = nsdata[c]
--- head = insertnodebefore(head,stack,copy_node(data[nsforced or s or nsselector]))
--- current = c
--- current_selector = s
--- end
--- end
--- if leader then
--- -- begin nested
--- local list
--- if nstrigger and getattr(stack,nstrigger) then
--- local outer = getattr(stack,attribute)
--- if outer ~= inheritance then
--- list = selective(attribute,leader,inheritance,outer)
--- else
--- list = selective(attribute,leader,inheritance,default)
--- end
--- else
--- list = selective(attribute,leader,inheritance,default)
--- end
--- if leader ~= list then
--- setleader(stack,list)
--- end
--- -- end nested
--- leader = false
--- end
--- elseif default and inheritance then
--- if current ~= default then
--- local data = nsdata[default]
--- head = insertnodebefore(head,stack,copy_node(data[nsforced or getattr(stack,nsselector) or nsselector]))
--- current = default
--- end
--- elseif current > 0 then
--- head = insertnodebefore(head,stack,copy_node(nsnone))
--- current, current_selector = 0, 0
--- end
--- check = false
--- end
--- end
--- return head
--- end
+-- We can force a selector, e.g. document wide color spaces, saves a little watch
+-- out, we need to check both the selector state (like colorspace) and the main
+-- state (like color), otherwise we get into troubles when a selector state changes
+-- while the main state stays the same (like two glyphs following each other with
+-- the same color but different color spaces e.g. \showcolor). The triggering
+-- mechanism has been removed because it was never really used, but the original can
+-- be seen in the mkiv (lua) code.
local function selective(attribute,head,inheritance,default) -- two attributes
local check = false
@@ -526,34 +346,34 @@ local function selective(attribute,head,inheritance,default) -- two attributes
check = true
elseif id == glue_code then
check = true
- leader = content -- getleader(stack)
+ leader = content
elseif id == hlist_code or id == vlist_code then
local outer, s
- -- tricky checking
--- if subtype == container_code then
--- check = true
--- current = 0
--- end
--- if getorientation(stack) then
-if subtype == container_code or getorientation(stack) then
+ if subtype == container_code or getorientation(stack) then
outer, s = getattrs(stack,attribute,nsselector)
if outer then
if default and outer == inheritance then
if current ~= default then
- local data = nsdata[default]
- head = insertnodebefore(head,stack,copy_node(data[nsforced or nsselector]))
+ local data = nsdata[default][nsforced or nsselector]
+ if data then
+ head = insertnodebefore(head,stack,copy_node(data))
+ end
current = default
end
elseif current ~= outer or current_selector ~= s then
- local data = nsdata[outer]
- head = insertnodebefore(head,stack,copy_node(data[nsforced or s or nsselector]))
+ local data = nsdata[outer][nsforced or s or nsselector]
+ if data then
+ head = insertnodebefore(head,stack,copy_node(data))
+ end
current = outer
current_selector = s
end
elseif default and inheritance then
if current ~= default then
- local data = nsdata[default]
- head = insertnodebefore(head,stack,copy_node(data[nsforced or s or nsselector]))
+ local data = nsdata[default][nsforced or s or nsselector]
+ if data then
+ head = insertnodebefore(head,stack,copy_node(data))
+ end
current = default
end
elseif current > 0 then
@@ -561,27 +381,10 @@ if subtype == container_code or getorientation(stack) then
current, current_selector = 0, 0
end
end
- -- begin nested
- --
- -- local list
- -- if nstrigger and getattr(stack,nstrigger) then
- -- if not outer then
- -- outer = getattr(stack,attribute)
- -- end
- -- if outer ~= inheritance then
- -- list = selective(attribute,content,inheritance,outer)
- -- else
- -- list = selective(attribute,content,inheritance,default)
- -- end
- -- else
- -- list = selective(attribute,content,inheritance,default)
- -- end
- --
local list = selective(attribute,content,inheritance,default)
if content ~= list then
setlist(stack,list)
end
- -- end nested
elseif id == rule_code then
if subtype == boxrule_code or subtype == imagerule_code or subtype == emptyrule_code then
-- so no redundant color stuff (only here, layers for instance should obey)
@@ -595,42 +398,33 @@ if subtype == container_code or getorientation(stack) then
if c then
if default and c == inheritance then
if current ~= default then
- local data = nsdata[default]
- head = insertnodebefore(head,stack,copy_node(data[nsforced or s or nsselector]))
+ local data = nsdata[default][nsforced or s or nsselector]
+ if data then
+ head = insertnodebefore(head,stack,copy_node(data))
+ end
current = default
end
elseif current ~= c or current_selector ~= s then
- local data = nsdata[c]
- head = insertnodebefore(head,stack,copy_node(data[nsforced or s or nsselector]))
+ local data = nsdata[c][nsforced or s or nsselector]
+ if data then
+ head = insertnodebefore(head,stack,copy_node(data))
+ end
current = c
current_selector = s
end
if leader then
- -- begin nested
- --
- -- local list
- -- if nstrigger and getattr(stack,nstrigger) then
- -- local outer = getattr(stack,attribute)
- -- if outer ~= inheritance then
- -- list = selective(attribute,leader,inheritance,outer)
- -- else
- -- list = selective(attribute,leader,inheritance,default)
- -- end
- -- else
- -- list = selective(attribute,leader,inheritance,default)
- -- end
- --
local list = selective(attribute,leader,inheritance,default)
if leader ~= list then
setleader(stack,list)
end
- -- end nested
leader = false
end
elseif default and inheritance then
if current ~= default then
- local data = nsdata[default]
- head = insertnodebefore(head,stack,copy_node(data[nsforced or s or nsselector]))
+ local data = nsdata[default][nsforced or s or nsselector]
+ if data then
+ head = insertnodebefore(head,stack,copy_node(data))
+ end
current = default
end
elseif current > 0 then
@@ -656,7 +450,7 @@ end
-- Todo: make a better stacker. Keep track (in attribute) about nesting level. Not
-- entirely trivial and a generic solution is nicer (compares to the exporter).
-local function stacked(attribute,head,default) -- no triggering, no inheritance, but list-wise
+local function stacked(attribute,head,default) -- no inheritance, but list-wise
local stack = head
local current = default or 0
local depth = 0
@@ -677,8 +471,8 @@ local function stacked(attribute,head,default) -- no triggering, no inheritance,
-- the problem is that broken lines gets the attribute which can be a later one
local list
if subtype == container_code then
- check = true
-current = 0
+ check = true
+ current = 0
end
if nslistwise then
local a = getattr(stack,attribute)
@@ -742,119 +536,13 @@ states.stacked = function(namespace,attribute,head,default)
return stacked(attribute,head,default)
end
--- experimental
-
--- local function stacker(attribute,head,default) -- no triggering, no inheritance, but list-wise
---
--- -- nsbegin()
--- local stacked = false
---
--- local current = head
--- local previous = head
--- local attrib = default or unsetvalue
--- local check = false
--- local leader = false
---
--- while current do
--- local id = getid(current)
--- if id == glyph_code then
--- check = true
--- elseif id == glue_code then
--- leader = getleader(current)
--- if leader then
--- check = true
--- end
--- elseif id == hlist_code or id == vlist_code then
--- local content = getlist(current)
--- if content then
--- local list
--- if subtype == container_code then
--- check = true
--- current = 0
--- end
--- if nslistwise then
--- local a = getattr(current,attribute)
--- if a and attrib ~= a and nslistwise[a] then -- viewerlayer
--- head = insertnodebefore(head,current,copy_node(nsdata[a]))
--- list = stacker(attribute,content,a)
--- if list ~= content then
--- setlist(current,list)
--- end
--- head, current = insertnodeafter(head,current,copy_node(nsnone))
--- else
--- list = stacker(attribute,content,attrib)
--- if list ~= content then
--- setlist(current,list)
--- end
--- end
--- else
--- list = stacker(attribute,content,default)
--- if list ~= content then
--- setlist(current,list)
--- end
--- end
--- end
--- elseif id == rule_code then
--- check = hasdimensions(current)
--- end
---
--- if check then
--- local a = getattr(current,attribute) or unsetvalue
--- if a ~= attrib then
--- if not stacked then
--- stacked = true
--- nsbegin()
--- end
--- local n = nsstep(a)
--- if n then
--- head = insertnodebefore(head,current,n) -- a
--- end
--- attrib = a
--- if leader then
--- -- tricky as a leader has to be a list so we cannot inject before
--- -- local list = stacker(attribute,leader,attrib)
--- -- leader = false
---
--- local content = getlist(leader)
--- if content then
--- local list = stacker(attribute,leader,attrib)
--- if leader ~= list then
--- setleader(current,list)
--- end
--- end
---
--- leader = false
--- end
--- end
--- check = false
--- end
---
--- previous = current
--- current = getnext(current)
--- end
---
--- if stacked then
--- local n = nsend()
--- while n do
--- head = insertnodeafter(head,previous,n)
--- n = nsend()
--- end
--- end
---
--- return head
--- end
-
-local function stacker(attribute,head,default) -- no triggering, no inheritance, but list-wise
-
- -- nsbegin()
+local function stacker(attribute,head,default) -- no inheritance, but list-wise
local stacked = false
-
local current = head
local previous = head
local attrib = default or unsetvalue
local check = false
local leader = false
-
for current, id, subtype, content in nextcontent, head do
if id == glyph_code then
check = true
@@ -865,7 +553,6 @@ local function stacker(attribute,head,default) -- no triggering, no inheritance,
local list
if subtype == container_code then
check = true
--- attrib = default or unsetvalue -- or just umsetvalue
end
if nslistwise then
local a = getattr(current,attribute)
@@ -896,7 +583,6 @@ local function stacker(attribute,head,default) -- no triggering, no inheritance,
check = hasdimensions(current)
end
end
-
if check then
local a = getattr(current,attribute) or unsetvalue
if a ~= attrib then
@@ -911,9 +597,6 @@ local function stacker(attribute,head,default) -- no triggering, no inheritance,
attrib = a
if leader then
-- tricky as a leader has to be a list so we cannot inject before
- -- local list = stacker(attribute,leader,attrib)
- -- leader = false
-
local content = getlist(leader)
if content then
local list = stacker(attribute,leader,attrib)
@@ -930,7 +613,6 @@ local function stacker(attribute,head,default) -- no triggering, no inheritance,
previous = current
end
-
if stacked then
local n = nsend()
while n do
@@ -938,7 +620,6 @@ local function stacker(attribute,head,default) -- no triggering, no inheritance,
n = nsend()
end
end
-
return head
end
diff --git a/tex/context/base/mkxl/node-nut.lmt b/tex/context/base/mkxl/node-nut.lmt
index 27c65c5b5..004da72af 100644
--- a/tex/context/base/mkxl/node-nut.lmt
+++ b/tex/context/base/mkxl/node-nut.lmt
@@ -67,6 +67,7 @@ local nuts = {
findnode = direct.findnode,
firstglyph = direct.firstglyph,
flattendiscretionaries = direct.flattendiscretionaries,
+ softenhyphens = direct.softenhyphens,
flush = d_flushnode,
flushlist = direct.flushlist,
flushnode = d_flushnode,
diff --git a/tex/context/base/mkxl/node-pro.lmt b/tex/context/base/mkxl/node-pro.lmt
index 0376292a2..9a60e2fb1 100644
--- a/tex/context/base/mkxl/node-pro.lmt
+++ b/tex/context/base/mkxl/node-pro.lmt
@@ -48,6 +48,10 @@ do
before = false
end
+ local prependaction = tasks.prependaction
+ local appendaction = tasks.appendaction
+ local enableaction = tasks.enableaction
+
trackers.register("nodes.callbacks", function(v)
if not v then
disableaction("processors","nodes.processors.trace_glyph_run_b")
diff --git a/tex/context/base/mkxl/node-shp.lmt b/tex/context/base/mkxl/node-shp.lmt
index 983d2dbbe..6cae39517 100644
--- a/tex/context/base/mkxl/node-shp.lmt
+++ b/tex/context/base/mkxl/node-shp.lmt
@@ -28,6 +28,8 @@ local getbox = nuts.getbox
local implement = interfaces.implement
+local v_yes = interfaces.variables.yes
+
local actions = tasks.actions("shipouts")
handlers.finalizelist = actions
@@ -36,7 +38,43 @@ function handlers.finalizebox(box)
actions(getbox(box)) -- nut
end
-handlers.cleanuppage = nuts.flattendiscretionaries
+do
+
+ local flattendiscretionaries = nuts.flattendiscretionaries
+ local softenhyphens = nuts.softenhyphens
+
+ local report = logs.reporter("shipout")
+
+ local trace = false trackers.register("backend", "cleanup", function(v) trace = v end)
+
+ local flatten = true -- always true
+ local soften = true -- true by default
+
+ nodes.handlers.cleanuppage = function(head)
+ local count = 0
+ local found = 0
+ local replaced = 0
+ if flatten then
+ head, count = flattendiscretionaries(head)
+ end
+ if soften then
+ head, found, replaced = softenhyphens(head) -- could have been a lua loop
+ end
+ if trace then
+ report("%i discretionaries flattened, %i of %i discretionary hyphens softened",count,replaced,found)
+ end
+ return head
+ end
+
+ implement {
+ name = "setsofthyphens",
+ arguments = "string",
+ actions = function(v)
+ soften = v == v_yes
+ end
+ }
+
+end
-- interface
diff --git a/tex/context/base/mkxl/node-tsk.lmt b/tex/context/base/mkxl/node-tsk.lmt
index a06507b15..785d0ecbf 100644
--- a/tex/context/base/mkxl/node-tsk.lmt
+++ b/tex/context/base/mkxl/node-tsk.lmt
@@ -769,6 +769,7 @@ tasks.new {
"before",
"normalizers",
"builders",
+ "finalizers",
"after",
},
templates = {
diff --git a/tex/context/base/mkxl/strc-tag.lmt b/tex/context/base/mkxl/strc-tag.lmt
index 96510f24e..2a0699924 100644
--- a/tex/context/base/mkxl/strc-tag.lmt
+++ b/tex/context/base/mkxl/strc-tag.lmt
@@ -330,6 +330,10 @@ function tags.getextradata()
return extradata
end
+function tags.enabled()
+ return enabled
+end
+
function tags.start(tag,specification)
if not enabled then
codeinjections.enabletags()
diff --git a/tex/context/base/mkxl/strc-tag.mkxl b/tex/context/base/mkxl/strc-tag.mkxl
index c25970747..96371b6b5 100644
--- a/tex/context/base/mkxl/strc-tag.mkxl
+++ b/tex/context/base/mkxl/strc-tag.mkxl
@@ -206,21 +206,6 @@
\installsetuponlycommandhandler \??tagging {tagging}
-\def\strc_tags_report_hyphen#1%
- {\writestatus\m!languages{setting #1 to U+00AD}}
-
-\protected\def\strc_tags_patch_hyphen
- {% for the moment here
- \ifnum\languageparameter\s!lefthyphenchar>\zerocount
- \setuplanguage[\s!default][\s!lefthyphenchar="AD]%
- \strc_tags_report_hyphen\s!lefthyphenchar
- \fi
- \ifnum\languageparameter\s!righthyphenchar>\zerocount
- \setuplanguage[\s!default][\s!righthyphenchar="AD]%
- \strc_tags_report_hyphen\s!righthyphenchar
- \fi
- \let\strc_tags_report_hyphen\gobbleoneargument}
-
% It makes no sense to have labels ... maybe some day as a last 'replace' in the export
% which might be more efficient then ... okay, we now cannot overload but who cares.
@@ -245,8 +230,7 @@
\fi}
\protected\def\strc_tags_enable_elements
- {\strc_tags_patch_hyphen
- \enforced\let\startelement \strc_tags_element_start_yes
+ {\enforced\let\startelement \strc_tags_element_start_yes
\enforced\let\stopelement \strc_tags_element_stop_yes
\enforced\let\dosettagproperty\strc_tags_set_aspect}
diff --git a/tex/context/base/mkxl/typo-bld.lmt b/tex/context/base/mkxl/typo-bld.lmt
index 78bdd8214..9bd5172e7 100644
--- a/tex/context/base/mkxl/typo-bld.lmt
+++ b/tex/context/base/mkxl/typo-bld.lmt
@@ -52,7 +52,6 @@ local hpack_node = nodes.hpack
local nuts = nodes.nuts
local tonode = nodes.tonode
local tonut = nodes.tonut
-local count_nodes = nuts.countall
local getattr = nuts.getattr
local starttiming = statistics.starttiming
@@ -177,9 +176,7 @@ local function processor(head,followed_by_display)
-- todo: not again in otr so we need to flag
if enabled then
starttiming(parbuilders)
- head = tonut(head)
head = actions(head,followed_by_display)
- head = tonode(head)
stoptiming(parbuilders)
return head
else
@@ -207,16 +204,7 @@ function builders.vpack_filter(head,groupcode,size,packtype,maxdepth,direction)
local done = false
if head then
starttiming(builders)
- head = tonut(head)
- if trace_vbox_builder then
- local before = count_nodes(head)
- head, done = vboxactions(head,groupcode,size,packtype,maxdepth,direction)
- local after = count_nodes(head)
- nodes.processors.tracer("vpack",head,groupcode,before,after,done)
- else
- head, done = vboxactions(head,groupcode)
- end
- head = tonode(head)
+ head, done = vboxactions(head,groupcode)
stoptiming(builders)
end
return head, done
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index 7b4602115..48cd432b5 100644
--- a/tex/generic/context/luatex/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua
-- parent file : c:/data/develop/context/sources/luatex-fonts.lua
--- merge date : 2021-06-25 22:44
+-- merge date : 2021-06-27 16:54
do -- begin closure to overcome local limits and interference
@@ -23537,14 +23537,7 @@ local f_index=formatters["I%05X"]
local f_character_y=formatters["%C"]
local f_character_n=formatters["[ %C ]"]
local check_duplicates=true
-local check_soft_hyphen=true
-if CONTEXTLMTXMODE and CONTEXTLMTXMODE>0 then
- check_soft_hyphen=false
-else
- directives.register("otf.checksofthyphen",function(v)
- check_soft_hyphen=v
- end)
-end
+local check_soft_hyphen=true
local function replaced(list,index,replacement)
if type(list)=="number" then
return replacement