summaryrefslogtreecommitdiff
path: root/tex/context/base/mkxl
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/mkxl')
-rw-r--r--tex/context/base/mkxl/anch-pos.mkxl3
-rw-r--r--tex/context/base/mkxl/back-lua.lmt10
-rw-r--r--tex/context/base/mkxl/buff-ini.lmt116
-rw-r--r--tex/context/base/mkxl/buff-ini.mkxl54
-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/file-mod.lmt6
-rw-r--r--tex/context/base/mkxl/file-mod.mklx3
-rw-r--r--tex/context/base/mkxl/font-chk.lmt6
-rw-r--r--tex/context/base/mkxl/font-ctx.lmt2
-rw-r--r--tex/context/base/mkxl/grph-fig.mkxl4
-rw-r--r--tex/context/base/mkxl/lang-def.mkxl3
-rw-r--r--tex/context/base/mkxl/lpdf-mis.lmt29
-rw-r--r--tex/context/base/mkxl/lpdf-wid.lmt15
-rw-r--r--tex/context/base/mkxl/luat-log.lmt25
-rw-r--r--tex/context/base/mkxl/mlib-fio.lmt1
-rw-r--r--tex/context/base/mkxl/mult-def.mkxl16
-rw-r--r--tex/context/base/mkxl/pack-mrl.mkxl2
-rw-r--r--tex/context/base/mkxl/scrn-ini.lmt54
-rw-r--r--tex/context/base/mkxl/scrn-ini.mklx55
-rw-r--r--tex/context/base/mkxl/strc-blk.mkxl2
-rw-r--r--tex/context/base/mkxl/strc-con.mklx15
-rw-r--r--tex/context/base/mkxl/strc-des.mklx12
-rw-r--r--tex/context/base/mkxl/strc-enu.mklx28
-rw-r--r--tex/context/base/mkxl/strc-lab.mkxl4
-rw-r--r--tex/context/base/mkxl/strc-not.mklx45
-rw-r--r--tex/context/base/mkxl/strc-sec.mkxl2
-rw-r--r--tex/context/base/mkxl/strc-usr.mkxl53
-rw-r--r--tex/context/base/mkxl/typo-shp.mkxl41
29 files changed, 387 insertions, 223 deletions
diff --git a/tex/context/base/mkxl/anch-pos.mkxl b/tex/context/base/mkxl/anch-pos.mkxl
index e5acca5c3..2bf7fab6f 100644
--- a/tex/context/base/mkxl/anch-pos.mkxl
+++ b/tex/context/base/mkxl/anch-pos.mkxl
@@ -286,6 +286,9 @@
% beware we need to pass \somethingexpanded or { }
+% Is this really always needed? We use \enabletextarearegistration for page areas so why
+% not also for this.
+
\protected\def\anch_mark_column_box#1#2% box n
{\global\advance\c_anch_column\plusone
\clf_markregionboxtaggedn#1{columnarea:\the\c_anch_column}#2\relax} % extra height
diff --git a/tex/context/base/mkxl/back-lua.lmt b/tex/context/base/mkxl/back-lua.lmt
index dc836f12b..f74dfaeb5 100644
--- a/tex/context/base/mkxl/back-lua.lmt
+++ b/tex/context/base/mkxl/back-lua.lmt
@@ -67,16 +67,16 @@ end
local function result()
-- todo: we're now still in the pdf backend but need different codeinjections
local codeinjections = backends.pdf.codeinjections
- local getvariable = codeinjections.getidentityvariable or function() end
+ local identity = interactions.general.getidentity()
local jobname = environment.jobname or tex.jobname or "unknown"
return {
metadata = {
unit = "bp",
jobname = jobname,
- title = getvariable("title") or jobname,
- subject = getvariable("subject"),
- author = getvariable("author"),
- keywords = getvariable("keywords"),
+ title = identity.title,
+ subject = identity.subject,
+ author = identity.author,
+ keywords = identity.keywords,
time = os.date("%Y-%m-%d %H:%M"),
engine = environment.luatexengine .. " " .. environment.luatexversion,
context = environment.version,
diff --git a/tex/context/base/mkxl/buff-ini.lmt b/tex/context/base/mkxl/buff-ini.lmt
index 107ff3fdd..a646962e5 100644
--- a/tex/context/base/mkxl/buff-ini.lmt
+++ b/tex/context/base/mkxl/buff-ini.lmt
@@ -8,9 +8,10 @@ if not modules then modules = { } end modules ['buff-ini'] = {
local concat = table.concat
local type, next, load = type, next, load
-local sub, format = string.sub, string.format
+local sub, format, find, match = string.sub, string.format, string.find, string.match
local splitlines, validstring, replacenewlines = string.splitlines, string.valid, string.replacenewlines
-local P, Cs, patterns, lpegmatch = lpeg.P, lpeg.Cs, lpeg.patterns, lpeg.match
+local P, S, C, Ct, Cs = lpeg.P, lpeg.S, lpeg.C, lpeg.Ct, lpeg.Cs
+local patterns, lpegmatch = lpeg.patterns, lpeg.match
local utfchar = utf.char
local nameonly = file.nameonly
local totable = string.totable
@@ -54,6 +55,7 @@ local replacesuffix = file.replacesuffix
local registertempfile = luatex.registertempfile
local v_yes = variables.yes
+local v_append = variables.append
local eol = patterns.eol
local space = patterns.space
@@ -86,33 +88,63 @@ local function erase(name)
cache[name] = nil
end
-local function assign(name,str,catcodes)
- cache[name] = {
- data = str,
- catcodes = catcodes,
- typeset = false,
- }
-end
-
-local function combine(name,str,prepend)
- local buffer = cache[name]
- if buffer then
- buffer.data = prepend and (str .. buffer.data) or (buffer.data .. str)
- buffer.typeset = false
- else
+local assign do
+
+ -- Ther eis no gain in an immediate concatenating lpeg
+
+ local action = whitespace^0 * C(P("+")^1 + P("*")) * whitespace^0
+ local equal = whitespace^0 * patterns.equal * whitespace^0
+ local name = C((1-action)^1)
+ local pattern = C((1-equal)^1) * equal * Ct((action + name)^1)
+
+ assign = function(name,str,catcodes)
+ local target, content = lpegmatch(pattern,name)
+ if target and content then
+ for i=1,#content do
+ local c = content[i]
+ if c == "+" then
+ content[i] = ""
+ elseif c == "++" then
+ content[i] = " "
+ elseif c == "+++" then
+ content[i] = "\r\r"
+ elseif c == "*" then
+ content[i] = str
+ else
+ local s = cache[c]
+ content[i] = s and s.data or ""
+ end
+ end
+ name = target
+ str = concat(content)
+ end
cache[name] = {
data = str,
+ catcodes = catcodes,
typeset = false,
}
end
-end
-local function prepend(name,str)
- combine(name,str,true)
end
-local function append(name,str)
- combine(name,str)
+local prepend, append do
+
+ local function combine(name,str,prepend)
+ local buffer = cache[name]
+ if buffer then
+ buffer.data = prepend and (str .. buffer.data) or (buffer.data .. str)
+ buffer.typeset = false
+ else
+ cache[name] = {
+ data = str,
+ typeset = false,
+ }
+ end
+ end
+
+ prepend = function(name,str) combine(name,str,true) end
+ append = function(name,str) combine(name,str) end
+
end
local function exists(name)
@@ -124,6 +156,14 @@ local function getcontent(name)
return buffer and buffer.data or ""
end
+local function empty(name)
+ if find(getcontent(name),"%S") then
+ return false
+ else
+ return true
+ end
+end
+
local function getlines(name)
local buffer = name and cache[name]
return buffer and splitlines(buffer.data)
@@ -200,6 +240,7 @@ buffers.assign = assign
buffers.prepend = prepend
buffers.append = append
buffers.exists = exists
+buffers.empty = empty
buffers.getcontent = getcontent
buffers.getlines = getlines
buffers.collectcontent = collectcontent
@@ -642,7 +683,7 @@ implement {
end
}
-local function savebuffer(list,name,prefix) -- name is optional
+local function savebuffer(list,name,prefix,option,directory) -- name is optional
if not list or list == "" then
list = name
end
@@ -656,13 +697,16 @@ local function savebuffer(list,name,prefix) -- name is optional
if prefix == v_yes then
name = addsuffix(tex.jobname .. "-" .. name,"tmp")
end
- io.savedata(name,replacenewlines(content))
+ if directory ~= "" and dir.makedirs(directory) then
+ name = file.join(directory,name)
+ end
+ io.savedata(name,replacenewlines(content),"\n",option == v_append)
end
implement {
name = "savebuffer",
actions = savebuffer,
- arguments = "3 strings",
+ arguments = "5 strings",
}
-- we can consider adding a size to avoid unlikely clashes
@@ -675,10 +719,11 @@ local runner = sandbox.registerrunner {
name = "run buffer",
program = "context",
method = "execute",
- template = jit and "--purgeall --jit %filename%" or "--purgeall %filename%",
+ template = [[--purgeall %?path: --path=%path% ?% %filename%]],
reporter = report_typeset,
checkers = {
filename = "readable",
+ path = "string",
}
}
@@ -769,7 +814,10 @@ local function runbuffer(name,encapsulate,runnername,suffixes)
end
savedata(filename,content)
report_typeset("processing saved buffer %a\n",filename)
- runner { filename = filename }
+ runner {
+ filename = filename,
+ path = environment.arguments.path, -- maybe take all set paths
+ }
end
new[tag] = (new[tag] or 0) + 1
report_typeset("no changes in %a, processing skipped",name)
@@ -846,6 +894,16 @@ implement {
implement {
name = "doifelsebuffer",
actions = { exists, commands.doifelse },
+ public = true,
+ -- protected = false,
+ arguments = "string"
+}
+
+implement {
+ name = "doifelsebufferempty",
+ actions = { empty, commands.doifelse },
+ public = true,
+ protected = true,
arguments = "string"
}
@@ -885,10 +943,10 @@ end
-- moved here:
function buffers.samplefile(name)
- if not buffers.exists(name) then
- buffers.assign(name,io.loaddata(resolvers.findfile(name)))
+ if not exists(name) then
+ assign(name,io.loaddata(resolvers.findfile(name)))
end
- buffers.get(name)
+ getbuffer(name)
end
implement {
diff --git a/tex/context/base/mkxl/buff-ini.mkxl b/tex/context/base/mkxl/buff-ini.mkxl
index 7512dea02..a91e3272b 100644
--- a/tex/context/base/mkxl/buff-ini.mkxl
+++ b/tex/context/base/mkxl/buff-ini.mkxl
@@ -24,7 +24,8 @@
\mutable\let\currentbuffer\empty
-\permanent\def\doifelsebuffer#1{\clf_doifelsebuffer{#1}} % expandable, todo: use public implementor
+% \doifelsebuffer {#1} % expandable
+% \doifelsebufferempty {#1} % non expandable
\aliased\let\doifbufferelse\doifelsebuffer
@@ -188,12 +189,14 @@
% \savebufferinfile[x][temp.log] % gets name: temp.log
\installcorenamespace{savebuffer}
+\installcorenamespace{savebuffercounter}
-\installsetuponlycommandhandler \??savebuffer {savebuffer}
+\installcommandhandler \??savebuffer {savebuffer} \??savebuffer
\setupsavebuffer
[\c!list=,
\c!file=,
+ \c!directory=,
\c!prefix=\v!yes]
\permanent\tolerant\protected\def\savebuffer[#1]#*[#2]%
@@ -203,9 +206,54 @@
\else
\setupcurrentsavebuffer[\c!list={#1},\c!file=#2]%
\fi
- \clf_savebuffer{\directsavebufferparameter\c!list}{\directsavebufferparameter\c!file}{\directsavebufferparameter\c!prefix}%
+ \clf_savebuffer % will become key/value
+ {\savebufferparameter\c!list}%
+ {\savebufferparameter\c!file}%
+ {\savebufferparameter\c!prefix}%
+ {\savebufferparameter\c!option}%
+ {\savebufferparameter\c!directory}%
\endgroup}
+%D \starttyping
+%D \definesavebuffer[slide]
+%D
+%D \starttext
+%D \startslide
+%D \starttext
+%D \stopslide
+%D \startslide
+%D slide 1
+%D \stopslide
+%D text 1 \par
+%D \startslide
+%D slide 2
+%D \stopslide
+%D text 2 \par
+%D \startslide
+%D \stoptext
+%D \stopslide
+%D \stoptext
+%D \stoptyping
+
+\appendtoks
+ \ifcsname\e!stop\currentsavebuffer\endcsname\else
+ \definebuffer[\currentsavebuffer]%
+ \expandafter\newcount\csname\??savebuffercounter\currentsavebuffer\endcsname
+ \protected\edefcsname\e!stop\currentsavebuffer\endcsname{\buff_stop_save_buffer{\currentsavebuffer}}%
+ \setsavebufferparameter\c!file{\currentsavebuffer.tex}%
+ \fi
+\to \everydefinesavebuffer
+
+\protected\def\buff_stop_save_buffer#1%
+ {\edef\currentsavebuffer{#1}%
+ \global\advance\csname\??savebuffercounter\currentsavebuffer\endcsname\plusone
+ \clf_savebuffer % will become key/value
+ {\thedefinedbuffer{\currentsavebuffer}}%
+ {\savebufferparameter\c!file}%
+ {\savebufferparameter\c!prefix}%
+ {\ifnum\csname\??savebuffercounter\currentsavebuffer\endcsname>\plusone\v!append\fi}%
+ {\savebufferparameter\c!directory}}
+
%D Experimental: no expansion of commands in buffer!
% \startbuffer[what]
diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl
index 3d35f23e0..3b0b1b446 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.07.30 00:41}
+\newcontextversion{2021.08.04 17:48}
%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 3a28a1a84..d90cbc657 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.07.30 00:41}
+\immutable\edef\contextversion{2021.08.04 17:48}
%overloadmode 1 % check frozen / warning
%overloadmode 2 % check frozen / error
diff --git a/tex/context/base/mkxl/file-mod.lmt b/tex/context/base/mkxl/file-mod.lmt
index 6af5d8816..d10abf533 100644
--- a/tex/context/base/mkxl/file-mod.lmt
+++ b/tex/context/base/mkxl/file-mod.lmt
@@ -177,7 +177,11 @@ function environment.usemodules(prefix,askedname,truename)
for i=1,#prefixes do
-- todo: reconstruct name i.e. basename
local thename = prefixes[i] .. "-" .. truename
- if usemodule(thename) then
+ if thename == tex.jobname then
+ -- in case we process a module
+ status = 1
+ break
+ elseif usemodule(thename) then
status = 1
break
end
diff --git a/tex/context/base/mkxl/file-mod.mklx b/tex/context/base/mkxl/file-mod.mklx
index 24471e30f..ddcbcba3f 100644
--- a/tex/context/base/mkxl/file-mod.mklx
+++ b/tex/context/base/mkxl/file-mod.mklx
@@ -259,4 +259,7 @@
\aliased\let\fetchruntimecommand\fetchmodulecommand % obsolete
+% \permanent\protected\def\moduleoverloaded
+% {\enforced}
+
\protect \endinput
diff --git a/tex/context/base/mkxl/font-chk.lmt b/tex/context/base/mkxl/font-chk.lmt
index 1587919f0..801132daa 100644
--- a/tex/context/base/mkxl/font-chk.lmt
+++ b/tex/context/base/mkxl/font-chk.lmt
@@ -159,9 +159,9 @@ checkers.mapping = mapping
-- sure the dimensions are known at the lua and tex end. For previous variants see
-- the mkiv files or older lmtx files. I decided to just drop the old stuff here.
-function checkers.placeholder(font,char)
- local category = chardata[char].category or "lu" -- todo: unknown
- local fakedata = mapping[category]
+function checkers.placeholder(font,char,category)
+ local category = category or chardata[char].category or "lu" -- todo: unknown
+ local fakedata = mapping[category] or mapping.lu
local tfmdata = fontdata[font]
local units = tfmdata.parameters.units or 1000
local slant = (tfmdata.parameters.slant or 0)/65536
diff --git a/tex/context/base/mkxl/font-ctx.lmt b/tex/context/base/mkxl/font-ctx.lmt
index a6e962872..ed8c22f58 100644
--- a/tex/context/base/mkxl/font-ctx.lmt
+++ b/tex/context/base/mkxl/font-ctx.lmt
@@ -3033,7 +3033,7 @@ end
do
- local getfontoffamily = font.getfontoffamily
+ local getfontoffamily = tex.getfontoffamily
local new_glyph = nodes.pool.glyph
local fontproperties = fonts.hashes.properties
diff --git a/tex/context/base/mkxl/grph-fig.mkxl b/tex/context/base/mkxl/grph-fig.mkxl
index d06e185dd..4a717a8c9 100644
--- a/tex/context/base/mkxl/grph-fig.mkxl
+++ b/tex/context/base/mkxl/grph-fig.mkxl
@@ -78,7 +78,9 @@
\installcorenamespace{typesettingfile}
\tolerant\permanent\protected\def\definetypesetting[#1]#*[#2]#*[#3]% <name> options settings-a
- {\ifparameter#1\or\setuvalue{\??typesettingfile#1}{\grph_typesetting_process_indeed{#2}{#3}}\fi}
+ {\ifparameter#1\or
+ \frozen\instance\protected\defcsname\??typesettingfile#1\endcsname{\grph_typesetting_process_indeed{#2}{#3}}%
+ \fi}
\tolerant\permanent\protected\def\typesetfile[#1]#*[#2]#*[#3]% <name> filename settings-b | filename options settings
{\ifcsname\??typesettingfile#1\endcsname
diff --git a/tex/context/base/mkxl/lang-def.mkxl b/tex/context/base/mkxl/lang-def.mkxl
index cc94bf7ae..603935097 100644
--- a/tex/context/base/mkxl/lang-def.mkxl
+++ b/tex/context/base/mkxl/lang-def.mkxl
@@ -564,8 +564,7 @@
\c!rightquote=\upperrightsingleninequote, %U+2019,
\c!leftquotation=\upperleftdoublesixquote, %U+201C,
\c!rightquotation=\upperrightdoubleninequote, %U+201D,
- \c!date={\v!year,~m.,\space,\v!month,\space,\v!day,~d.},
- \c!date={\v!day-a\space de\space \v!month\space \v!year},
+ \c!date={\v!day,-a\space de\space,\v!month,\space \v!year},
\s!patterns=eo,
\s!lefthyphenmin=2,
\s!righthyphenmin=2]
diff --git a/tex/context/base/mkxl/lpdf-mis.lmt b/tex/context/base/mkxl/lpdf-mis.lmt
index 73f7bcf06..db8ad2cbe 100644
--- a/tex/context/base/mkxl/lpdf-mis.lmt
+++ b/tex/context/base/mkxl/lpdf-mis.lmt
@@ -186,21 +186,7 @@ end
lpdf.registerpagefinalizer (flushpageactions, "page actions")
lpdf.registerdocumentfinalizer(flushdocumentactions,"document actions")
---- info : this can change and move elsewhere
-
-local identity = { }
-
-function codeinjections.setupidentity(specification)
- for k, v in next, specification do
- if v ~= "" then
- identity[k] = v
- end
- end
-end
-
-function codeinjections.getidentityvariable(name)
- return identity[name]
-end
+-- the code above will move to scrn-ini
local done = false -- using "setupidentity = function() end" fails as the meaning is frozen in register
@@ -212,22 +198,21 @@ local function setupidentity()
local time = metadata.time
local jobname = environment.jobname or tex.jobname or "unknown"
--
+ local identity = interactions.general.getidentity()
+ --
local title = identity.title
- if not title or title == "" then
- title = tex.jobname
- end
addtoinfo("Title", pdfunicode(title), title)
- local subtitle = identity.subtitle or ""
+ local subtitle = identity.subtitle
if subtitle ~= "" then
addtoinfo("Subject", pdfunicode(subtitle), subtitle)
end
- local author = identity.author or ""
+ local author = identity.author
if author ~= "" then
addtoinfo("Author", pdfunicode(author), author) -- '/Author' in /Info, 'Creator' in XMP
end
addtoinfo("Creator", pdfunicode(creator), creator)
addtoinfo("CreationDate", pdfstring(formattedtimestamp(time)))
- local date = identity.date or ""
+ local date = identity.date
local pdfdate = date and formattedtimestamp(date)
if pdfdate then
addtoinfo("ModDate", pdfstring(pdfdate), date)
@@ -236,7 +221,7 @@ local function setupidentity()
-- and if not provided that way we use the creation time instead
addtoinfo("ModDate", pdfstring(formattedtimestamp(time)),time)
end
- local keywords = identity.keywords or ""
+ local keywords = identity.keywords
if keywords ~= "" then
keywords = concat(settings_to_array(keywords), " ")
addtoinfo("Keywords", pdfunicode(keywords), keywords)
diff --git a/tex/context/base/mkxl/lpdf-wid.lmt b/tex/context/base/mkxl/lpdf-wid.lmt
index a75053c94..fcc7b9c99 100644
--- a/tex/context/base/mkxl/lpdf-wid.lmt
+++ b/tex/context/base/mkxl/lpdf-wid.lmt
@@ -259,7 +259,7 @@ local function flushembeddedfiles()
for tag, reference in sortedhash(filestreams) do
if not reference then
report_attachment("unreferenced file, tag %a",tag)
- elseif referenced[tag] == "hidden" then
+ elseif referenced[tag] == "hidden" or referenced[tag] == "forced" then
e[#e+1] = pdfstring(tag)
e[#e+1] = reference -- already a reference
f[#f+1] = reference -- collect all file description references
@@ -369,6 +369,9 @@ function codeinjections.embedfile(specification)
}
local r = pdfreference(pdfflushobject(d))
filestreams[hash] = r
+ if specification.forcereference == true then
+ referenced[hash] = "forced"
+ end
return r
end
end
@@ -652,9 +655,6 @@ local function insertrenderingwindow(specification)
}
local width = specification.width or 0
local height = specification.height or 0
- if height == 0 or width == 0 then
- -- todo: sound needs no window
- end
context(nodeinjections.annotation(width,height,0,d(),r)) -- save ref
return pdfreference(r)
end
@@ -705,9 +705,10 @@ local function insertrendering(specification)
descriptor = pdfreference(pdfflushobject(descriptor))
elseif option[v_embed] then
descriptor = codeinjections.embedfile {
- file = filename,
- mimetype = mimetype, -- yes or no
- compress = false,
+ file = filename,
+ mimetype = mimetype, -- yes or no
+ compress = false,
+ forcereference = true,
}
end
local clip = pdfdictionary {
diff --git a/tex/context/base/mkxl/luat-log.lmt b/tex/context/base/mkxl/luat-log.lmt
index ee8ad4fa3..2b5b60dd9 100644
--- a/tex/context/base/mkxl/luat-log.lmt
+++ b/tex/context/base/mkxl/luat-log.lmt
@@ -14,7 +14,8 @@ if not modules then modules = { } end modules ['luat-log'] = {
-- mtxrun.
--
-- We use different targets: "terminal" "logfile", "both" and have no number
--- channel.
+-- channel. Actually, the log channels are now numeric (1,2,3) as with other
+-- symbolics.
local next, type, select, print = next, type, select, print
local format, gmatch, find = string.format, string.gmatch, string.find
@@ -120,21 +121,17 @@ do
status_yes = formatters["%-15s : %s\n"],
status_nop = formatters["%-15s :\n"],
},
- targets = setmetatableindex( {
--- logfile = "logfile",
--- log = "logfile",
--- file = "logfile",
--- console = "terminal",
--- terminal = "terminal",
--- both = "terminal_and_logfile",
+ targets = setmetatableindex( { -- 1, 2, 3,
logfile = 2,
log = 2,
file = 2,
console = 1,
terminal = 1,
both = 3,
--- }, function(t,k) local v = "terminal_and_logfile" t[k] = v return v end),
- }, function(t,k) local v = 3 t[k] = v return v end),
+ },
+ function(t,k)
+ local v = 3 t[k] = v return v
+ end),
},
ansi = {
formats = {
@@ -149,17 +146,13 @@ do
status_yes = formatters["%-15s : %s\n"],
status_nop = formatters["%-15s :\n"],
},
- targets = setmetatableindex( {
+ targets = setmetatableindex( { 1, 1, 1,
logfile = false,
log = false,
file = false,
--- console = "terminal",
--- terminal = "terminal",
--- both = "terminal",
console = 1,
terminal = 1,
both = 1,
--- }, function(t,k) local v = "terminal" t[k] = v return v end),
}, function(t,k) local v = 1 t[k] = v return v end),
}
}
@@ -261,7 +254,7 @@ do
whereto = "both"
target = targets[whereto]
end
- if target == "terminal" or target == "terminal_and_logfile" then
+ if target == targets.both or target == targets.terminal then
logs.flush = io.flush
else
logs.flush = ignore
diff --git a/tex/context/base/mkxl/mlib-fio.lmt b/tex/context/base/mkxl/mlib-fio.lmt
index d51b222cf..d0917392a 100644
--- a/tex/context/base/mkxl/mlib-fio.lmt
+++ b/tex/context/base/mkxl/mlib-fio.lmt
@@ -286,6 +286,7 @@ function mplib.new(specification)
-- random_seed = specification.seed,
utf8_mode = true,
text_mode = true,
+ show_mode = true,
-- not used
-- noninteractive = true;
-- ini_version = true,
diff --git a/tex/context/base/mkxl/mult-def.mkxl b/tex/context/base/mkxl/mult-def.mkxl
index 13e22dade..de57d93b9 100644
--- a/tex/context/base/mkxl/mult-def.mkxl
+++ b/tex/context/base/mkxl/mult-def.mkxl
@@ -15,14 +15,14 @@
\installcorenamespace{multilingual}
-\immutable\setvalue{\??multilingual czech}{cs}
-\immutable\setvalue{\??multilingual german}{de}
-\immutable\setvalue{\??multilingual english}{en}
-\immutable\setvalue{\??multilingual french}{fr}
-\immutable\setvalue{\??multilingual italian}{it}
-\immutable\setvalue{\??multilingual dutch}{nl}
-\immutable\setvalue{\??multilingual persian}{pe}
-\immutable\setvalue{\??multilingual romanian}{ro}
+\immutable\defcsname\??multilingual czech\endcsname{cs}
+\immutable\defcsname\??multilingual german\endcsname{de}
+\immutable\defcsname\??multilingual english\endcsname{en}
+\immutable\defcsname\??multilingual french\endcsname{fr}
+\immutable\defcsname\??multilingual italian\endcsname{it}
+\immutable\defcsname\??multilingual dutch\endcsname{nl}
+\immutable\defcsname\??multilingual persian\endcsname{pe}
+\immutable\defcsname\??multilingual romanian\endcsname{ro}
\permanent\def\userinterfacetag{\ifcsname\??multilingual\currentinterface\endcsname\lastnamedcs\else en\fi}
\permanent\def\userresponsestag{\ifcsname\??multilingual\currentresponses\endcsname\lastnamedcs\else en\fi}
diff --git a/tex/context/base/mkxl/pack-mrl.mkxl b/tex/context/base/mkxl/pack-mrl.mkxl
index 0e7540921..bd574be07 100644
--- a/tex/context/base/mkxl/pack-mrl.mkxl
+++ b/tex/context/base/mkxl/pack-mrl.mkxl
@@ -189,7 +189,7 @@
\s!height\linewidth
\s!depth \zeropoint}}
-% \let\dovlwdhtdp\pack_rule_vl_indeed % used elsewhere .. not any more
+\let\dovlwdhtdp\pack_rule_vl_indeed % used elsewhere .. in font manual
%D \macros
%D {hairline, thinrule, thinrules, setupthinrules}
diff --git a/tex/context/base/mkxl/scrn-ini.lmt b/tex/context/base/mkxl/scrn-ini.lmt
new file mode 100644
index 000000000..82b9bd02e
--- /dev/null
+++ b/tex/context/base/mkxl/scrn-ini.lmt
@@ -0,0 +1,54 @@
+if not modules then modules = { } end modules ['scrn-ini'] = {
+ version = 1.001,
+ comment = "companion to scrn-int.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+local next = next
+
+-- We delay preroll because it needs a font and don't want to force a font load (at
+-- startup) because we preset a field so some are tokenlists as we need to preserve
+-- catcodes.
+
+interactions = { }
+interactions.general = interactions.general or { }
+local general = interactions.general
+
+local expand_macro = token.expand_macro
+
+local prerolled = { }
+local identitydata = { }
+
+local function setidentityvariable(key,value)
+ prerolled[key] = value
+end
+
+table.setmetatableindex(identitydata, function(t,k)
+ if k == "keywords" then
+ k = "keyword"
+ end
+ -- fetch and process at the tex end (catcode etc)
+ expand_macro("scrn_identity_get",true,k)
+ -- return the registered return value
+ local v = prerolled[k] or ""
+ if k == "title" and v == "" then
+ v = tex.jobname
+ end
+ return v
+end)
+
+function general.getidentityvariable(name)
+ return identitydata[name]
+end
+
+function general.getidentity()
+ return identitydata
+end
+
+interfaces.implement {
+ name = "setidentityvariable",
+ actions = setidentityvariable,
+ arguments = "2 strings",
+}
diff --git a/tex/context/base/mkxl/scrn-ini.mklx b/tex/context/base/mkxl/scrn-ini.mklx
index c0246bc83..8a7f89c42 100644
--- a/tex/context/base/mkxl/scrn-ini.mklx
+++ b/tex/context/base/mkxl/scrn-ini.mklx
@@ -15,7 +15,7 @@
\unprotect
-\registerctxluafile{scrn-ini}{}
+\registerctxluafile{scrn-ini}{autosuffix}
%D There is no interaction at all unless enabled by saying:
%D
@@ -184,56 +184,11 @@
%D Identity
-% \newconditional\c_scrn_identity_preroll
-%
-% \installtexdirective
-% {interaction.identity.preroll}
-% {\settrue \c_scrn_identity_preroll}
-% {\setfalse\c_scrn_identity_preroll}
-%
-% \def\scrn_identity_prerolled#1%
-% {\begingroup
-% \edef\tempstring{\interactionparameter#1}%
-% \ifempty\tempstring
-% \endgroup
-% \else
-% \the\everypreroll
-% \nodestostring\tempstring{\tempstring}%
-% \normalexpanded{\endgroup\setexpandedinteractionparameter{#1}{\tempstring}}%
-% \fi}
-%
-% \def\scrn_identity_synchronize
-% {\begingroup
-% \ifconditional\c_scrn_identity_preroll
-% \scrn_identity_prerolled\c!title
-% \scrn_identity_prerolled\c!subtitle
-% \scrn_identity_prerolled\c!author
-% \scrn_identity_prerolled\c!date
-% \scrn_identity_prerolled\c!keyword
-% \fi
-% \clf_setupidentity
-% title {\interactionparameter\c!title}%
-% subtitle {\interactionparameter\c!subtitle}%
-% author {\interactionparameter\c!author}%
-% % creator {ConTeXt - \contextversion}%
-% date {\interactionparameter\c!date}%
-% keywords {\interactionparameter\c!keyword}%
-% \relax
-% \endgroup}
-
-\def\scrn_identity_synchronize
- {\clf_setupidentity
- title {\prerolltostring{\interactionparameter\c!title}}%
- subtitle {\prerolltostring{\interactionparameter\c!subtitle}}%
- author {\prerolltostring{\interactionparameter\c!author}}%
- % creator {ConTeXt - \contextversion}% fixed
- date {\prerolltostring{\interactionparameter\c!date}}%
- keywords {\prerolltostring{\interactionparameter\c!keyword}}%
- \relax}
+%D We want to delay the preroll as it needs fonts so we now actively fetch from
+%D the \LUA\ end. So this one gets called by the time we need the value.
-\appendtoks
- \scrn_identity_synchronize
-\to \everysetupinteraction
+\def\scrn_identity_get#1%
+ {\clf_setidentityvariable{#1}{\prerolltostring{\interactionparameter{#1}}}}
% this comes before starttext
diff --git a/tex/context/base/mkxl/strc-blk.mkxl b/tex/context/base/mkxl/strc-blk.mkxl
index 4cfbd51eb..6b1daa0cc 100644
--- a/tex/context/base/mkxl/strc-blk.mkxl
+++ b/tex/context/base/mkxl/strc-blk.mkxl
@@ -168,4 +168,6 @@
\permanent\protected\def\processblocks{\strc_blocks_select [process]}
\permanent\protected\def\selectblocks {\strc_blocks_select [use]}
+\permanent\protected\def\doifelseblocksempty{\clf_doifelsestructureblocksempty} % {name}{tag}{criterium}
+
\protect \endinput
diff --git a/tex/context/base/mkxl/strc-con.mklx b/tex/context/base/mkxl/strc-con.mklx
index d700899b3..ba9c62d48 100644
--- a/tex/context/base/mkxl/strc-con.mklx
+++ b/tex/context/base/mkxl/strc-con.mklx
@@ -146,22 +146,21 @@
\appendtoks
\ifconditional\c_strc_constructions_define_commands
- %% \protected\instance\edefcsname\e!start\currentconstruction\endcsname{\strc_constructions_start{\currentconstruction}}%
- \protected\instance\edefcsname\e!start\currentconstruction\endcsname{\strc_constructions_start[\currentconstruction]}%
- \protected\instance\edefcsname\e!stop \currentconstruction\endcsname{\strc_constructions_stop}%
+ \protected\instance\edefcsname\e!start\currentconstruction\endcsname{\startnamedconstruction[\currentconstruction]}%
+ \protected\instance \defcsname\e!stop \currentconstruction\endcsname{\stopnamedconstruction}%
\fi
\to \everydefineconstruction
%D Just a basic environment (mostly for testing). We will provide a 'setup' based
%D plugin once the rest is sorted out.
-\tolerant\protected\def\strc_constructions_start[#1]#*[#2]#*[#3]%
+\tolerant\permanent\protected\def\startnamedconstruction[#1]#*[#2]#*[#3]%
{\begingroup
\strc_constructions_initialize{#1}%
\strc_constructions_register[#3][\c!label={\constructionparameter\c!text},\c!reference=,\c!title=,\c!bookmark=,\c!list=,\c!referencetext=,#2]%
\csname\??constructionstarthandler\currentconstructionhandler\endcsname}
-\protected\def\strc_constructions_stop
+\permanent\protected\def\stopnamedconstruction
{\csname\??constructionstophandler\currentconstructionhandler\endcsname
\endgroup}
@@ -196,11 +195,11 @@
\newconditional\c_strc_constructions_number_state
\newconditional\c_strc_constructions_title_state
-\protected\setvalue{\??constructioninitializer\v!construction}%
+\protected\defcsname\??constructioninitializer\v!construction\endcsname
{\setfalse\c_strc_constructions_number_state
\setfalse\c_strc_constructions_title_state}
-\protected\setvalue{\??constructionfinalizer\v!construction}%
+\protected\defcsname\??constructionfinalizer\v!construction\endcsname
{}
%D We keep the command variant around but rather would move to the start-stop one.
@@ -331,7 +330,7 @@
% we also need to make sure that no stretch creeps in (new per 2015-02-02, for Alan)
\settrue\c_strc_constructions_distance_none}
-\protected\setvalue{\??constructionstarthandler\v!construction}% this will be redone (reorganized) .. too much boxing
+\protected\defcsname\??constructionstarthandler\v!construction\endcsname % this will be redone (reorganized) .. too much boxing
{\dostarttaggedchained\t!construction\currentconstruction\currentconstructionhash
% \dotagsetconstruction
\constructionparameter\c!before
diff --git a/tex/context/base/mkxl/strc-des.mklx b/tex/context/base/mkxl/strc-des.mklx
index 1eab07d7d..835c6807e 100644
--- a/tex/context/base/mkxl/strc-des.mklx
+++ b/tex/context/base/mkxl/strc-des.mklx
@@ -67,9 +67,9 @@
\defineconstruction[\currentdescription][\s!handler=\v!description,\c!level=1]%
\fi
% We can combine these but in tracing (or errors) using a different caller is nicer.
- \frozen\protected\instance\edefcsname \currentdescription\endcsname{\strc_descriptions_command[\currentdescription]}%
- \frozen\protected\instance\edefcsname\e!start\currentdescription\endcsname{\strc_descriptions_start [\currentdescription]}%
- \frozen\protected\instance\edefcsname\e!stop \currentdescription\endcsname{\strc_descriptions_stop}%
+ \frozen\protected\instance\edefcsname \currentdescription\endcsname{\nameddescription[\currentdescription]}%
+ \frozen\protected\instance\edefcsname\e!start\currentdescription\endcsname{\startnameddescription[\currentdescription]}%
+ \frozen\protected\instance \defcsname \e!stop\currentdescription\endcsname{\stopnameddescription}%
\to \everydefinedescription
\let\p_strc_constructions_title \empty
@@ -99,7 +99,7 @@
% A bit over the top, the optional title but mkii has it too.
-\tolerant\protected\def\strc_descriptions_start[#1]#*[#2]%
+\tolerant\permanent\protected\def\startnameddescription[#1]#*[#2]%
{\begingroup
\strc_constructions_initialize{#1}%
\ifhastok={#2}%
@@ -130,13 +130,13 @@
{\strc_constructions_register[][\c!label={\descriptionparameter\c!text},\c!reference={#1},\c!title=,\c!bookmark=,\c!list=,\c!referencetext=]%
\csname\??constructionstarthandler\currentconstructionhandler\endcsname}
-\protected\def\strc_descriptions_stop
+\permanent\protected\def\stopnameddescription
{\csname\??constructionstophandler\currentconstructionhandler\endcsname}
% \description [reference] text \par
% \description [reference] {title} text \par
-\tolerant\protected\def\strc_descriptions_command[#1]#*[#2]%
+\tolerant\permanent\protected\def\nameddescription[#1]#*[#2]%
{\begingroup
\strc_constructions_initialize{#1}%
\ifhastok={#2}%
diff --git a/tex/context/base/mkxl/strc-enu.mklx b/tex/context/base/mkxl/strc-enu.mklx
index 4bcdb6c4f..a6ba99ce7 100644
--- a/tex/context/base/mkxl/strc-enu.mklx
+++ b/tex/context/base/mkxl/strc-enu.mklx
@@ -131,15 +131,15 @@
\protected\def\strc_define_commands_enumeration#tag#level#parent%
{\doifelsenothing{#parent}
{\normalexpanded{\defineconstruction[#tag][\s!handler=\v!enumeration,\c!level=#level]}%
- \setevalue{\??enumeration#tag:\s!parent}{\??enumeration}}%
+ \edefcsname\??enumeration#tag:\s!parent\endcsname{\??enumeration}}%
{\normalexpanded{\defineconstruction[#tag][#parent][\s!handler=\v!enumeration,\c!level=#level]}%
- \setevalue{\??enumeration#tag:\s!parent}{\??enumeration#parent}}%
- \frozen\instance\setuevalue{\e!next #tag}{\strc_enumerations_next {#tag}{\number#level}}% obsolete
- \frozen\instance\setuevalue{\c!reset#tag}{\strc_enumerations_reset {#tag}{\number#level}}% obsolete
- %frozen\instance\setuevalue{\c!set #tag}{\strc_enumerations_set {#tag}{\number#level}}% obsolete
- \frozen\instance\setuevalue {#tag}{\strc_enumerations_command[#tag]}% we could pass level here as well (faster)
- \frozen\instance\setuevalue{\e!start#tag}{\strc_enumerations_start [#tag]}% we could pass level here as well (faster)
- \frozen\instance\setuevalue{\e!stop #tag}{\strc_enumerations_stop }}
+ \edefcsname\??enumeration#tag:\s!parent\endcsname{\??enumeration#parent}}%
+ \frozen\protected\instance\edefcsname\e!next #tag\endcsname{\strc_enumerations_next{#tag}{\number#level}}% obsolete
+ \frozen\protected\instance\edefcsname\c!reset#tag\endcsname{\strc_enumerations_reset{#tag}{\number#level}}% obsolete
+ %frozen\protected\instance\edefcsname\c!set #tag\endcsname{\strc_enumerations_set{#tag}{\number#level}}% obsolete
+ \frozen\protected\instance\edefcsname #tag\endcsname{\namedenumeration[#tag]}%
+ \frozen\protected\instance\edefcsname\e!start#tag\endcsname{\startnamedenumeration[#tag]}%
+ \frozen\protected\instance \defcsname\e!stop #tag\endcsname{\stopnamedenumeration}}
\let\m_strc_enumeration_sub\empty
@@ -180,7 +180,7 @@
\let\p_strc_constructions_title \empty
\let\p_strc_constructions_number\empty
-\protected\setvalue{\??constructioninitializer\v!enumeration}%
+\protected\defcsname\??constructioninitializer\v!enumeration\endcsname
{\let \currentenumeration \currentconstruction
\enforced\let\constructionparameter \enumerationparameter
\enforced\let\constructionnamespace \??enumeration
@@ -205,7 +205,7 @@
\setfalse\c_strc_constructions_title_state
\fi}
-\protected\setvalue{\??constructionfinalizer\v!enumeration}%
+\protected\defcsname\??constructionfinalizer\v!enumeration\endcsname
{\ifconditional\c_strc_constructions_number_state
\iftrialtypesetting
\strc_counters_restore\currentconstructionnumber
@@ -214,9 +214,9 @@
%D Interfaces:
-\let\strc_enumerations_command\strc_descriptions_command
-\let\strc_enumerations_start \strc_descriptions_start
-\let\strc_enumerations_stop \strc_descriptions_stop
+\let\namedenumeration \nameddescription
+\let\startnamedenumeration\startnameddescription
+\let\stopnamedenumeration \stopnameddescription
\protected\def\strc_enumerations_next {\strc_constructions_next_indeed \namedenumerationparameter} % #1#2
\protected\def\strc_enumerations_reset{\strc_constructions_reset_indeed\namedenumerationparameter} % #1#2
@@ -250,7 +250,7 @@
\letcsname\??constructionstarthandler \v!enumeration\expandafter\endcsname\csname\??constructionstarthandler \v!description\endcsname
\letcsname\??constructionstophandler \v!enumeration\expandafter\endcsname\csname\??constructionstophandler \v!description\endcsname
-\protected\setvalue{\??constructiontexthandler\v!enumeration}%
+\protected\defcsname\??constructiontexthandler\v!enumeration\endcsname
{\begingroup
\useconstructionstyleandcolor\c!headstyle\c!headcolor
\strc_enumerations_text
diff --git a/tex/context/base/mkxl/strc-lab.mkxl b/tex/context/base/mkxl/strc-lab.mkxl
index 3794fdca9..368a412a7 100644
--- a/tex/context/base/mkxl/strc-lab.mkxl
+++ b/tex/context/base/mkxl/strc-lab.mkxl
@@ -148,8 +148,8 @@
%D Interfaces:
-\protected\def\strc_labels_command{\setfalse\c_strc_constructions_number_keep\strc_descriptions_command}
-\protected\def\strc_labels_current{\settrue \c_strc_constructions_number_keep\strc_descriptions_command}
+\protected\def\strc_labels_command{\setfalse\c_strc_constructions_number_keep\nameddescription}
+\protected\def\strc_labels_current{\settrue \c_strc_constructions_number_keep\nameddescription}
\protected\def\strc_labels_next {\strc_constructions_next_indeed \namedlabelparameter} % #1#2
\protected\def\strc_labels_reset {\strc_constructions_reset_indeed\namedlabelparameter} % #1#2
diff --git a/tex/context/base/mkxl/strc-not.mklx b/tex/context/base/mkxl/strc-not.mklx
index 0adb23566..e9038b1b9 100644
--- a/tex/context/base/mkxl/strc-not.mklx
+++ b/tex/context/base/mkxl/strc-not.mklx
@@ -140,11 +140,11 @@
{\normalexpanded{\defineconstruction[#tag][#parent][\s!handler=\v!notation,\c!level=#level]}%
\edefcsname\??note #tag:\s!parent\endcsname{\??note#parent}% see later for \s!note
\edefcsname\??notation#tag:\s!parent\endcsname{\??notation#parent}}%
- \instance\protected\edefcsname\e!next #tag\endcsname{\strc_notations_next {#tag}{\number#level}}% obsolete
- \instance\protected\edefcsname\c!reset#tag\endcsname{\strc_notations_reset {#tag}{\number#level}}% obsolete
+ \instance\protected\edefcsname\e!next #tag\endcsname{\strc_notations_next{#tag}{\number#level}}% obsolete
+ \instance\protected\edefcsname\c!reset#tag\endcsname{\strc_notations_reset{#tag}{\number#level}}% obsolete
\instance\protected\edefcsname #tag\endcsname{\strc_notations_command[#tag]}%
- \instance\protected\edefcsname\e!start#tag\endcsname{\strc_notations_start [#tag]}%
- \instance\protected\edefcsname\e!stop #tag\endcsname{\strc_notations_stop }}
+ \instance\protected\edefcsname\e!start#tag\endcsname{\strc_notations_start[#tag]}%
+ \instance\protected\edefcsname\e!stop #tag\endcsname{\strc_notations_stop}}
\let\m_strc_notation_sub\empty
@@ -187,7 +187,7 @@
\let\p_strc_constructions_title \empty
\let\p_strc_constructions_number\empty
-\protected\setvalue{\??constructioninitializer\v!notation}%
+\protected\defcsname\??constructioninitializer\v!notation\endcsname
{\let \currentnotation \currentconstruction
\enforced\let\constructionparameter \notationparameter
\enforced\let\constructionnamespace \??notation
@@ -212,7 +212,7 @@
\setfalse\c_strc_constructions_title_state
\fi}
-\protected\setvalue{\??constructionfinalizer\v!notation}%
+\protected\defcsname\??constructionfinalizer\v!notation\endcsname
{\ifconditional\c_strc_constructions_number_state
\iftrialtypesetting
\strc_counters_restore\currentconstructionnumber
@@ -280,32 +280,45 @@
\strc_constructions_finalize
\strc_notations_finalize}
-\tolerant\protected\def\strc_notations_start[#1]#*[#2]%
+\tolerant\protected\def\strc_notations_start
+ {\strc_notations_start_indeed{\csname\e!stop\currentnotation\endcsname}}
+
+\tolerant\protected\defcsname\e!start\e!namednotation\endcsname
+ {\strc_notations_start_indeed{\csname\e!stop\e!namednotation\endcsname}}
+
+\ifdefined\startnamednotation
+ % we're in the english interface
+\else
+ \tolerant\protected\def\startnamednotation
+ {\strc_notations_start_indeed\stopnamednotation}
+\fi
+
+\tolerant\protected\def\strc_notations_start_indeed#1#*[#2]#*[#3]%
{\begingroup
- \edef\currentnote{#1}%
- \strc_constructions_initialize{#1}%
+ \edef\currentnote{#2}%
+ \strc_constructions_initialize{#2}%
\strc_notes_synchronize
\ifnotesenabled
\strc_counters_increment_sub\currentconstructionnumber\currentconstructionlevel
\fi
- \ifhastok={#2}%
+ \ifhastok={#3}%
\expandafter\strc_notations_start_setups
\else
\expandafter\strc_notations_start_reference
- \fi[#2]}
+ \fi#1[#2]}
\let\strc_notations_pickup_yes\relax
-\protected\def\strc_notations_start_setups[#1]%
- {\normalexpanded{\def\noexpand\strc_notations_pickup_yes##/\csname\e!stop\currentconstruction\endcsname{\strc_notations_start_setups_indeed[#1]{##1}}}%
+\protected\def\strc_notations_start_setups#1[#2]%
+ {\normalexpanded{\def\noexpand\strc_notations_pickup_yes##/#1{\strc_notations_start_setups_indeed[#2]{##1}}}%
\strc_notations_pickup_yes}
\protected\def\strc_notations_start_setups_indeed[#1]#*#2%
{\strc_constructions_register[][\c!label={\descriptionparameter\c!text},\c!reference=,\c!title={#2},\c!bookmark=,\c!list=,\c!referencetext=,#1]%
\strc_notations_wrapup}
-\protected\def\strc_notations_start_reference[#1]%
- {\normalexpanded{\def\noexpand\strc_notations_pickup_yes##/\csname\e!stop\currentconstruction\endcsname{\strc_notations_start_reference_indeed[#1]{##1}}}%
+\protected\def\strc_notations_start_reference#1[#2]%
+ {\normalexpanded{\def\noexpand\strc_notations_pickup_yes##/#1{\strc_notations_start_reference_indeed[#2]{##1}}}%
\strc_notations_pickup_yes}
\protected\def\strc_notations_start_reference_indeed[#1]#*#2%
@@ -323,7 +336,7 @@
\protected\defcsname\??constructionnotehandler\v!notation\endcsname
{\csname\??constructionnotehandler\currentconstructionhandler:\constructionparameter\c!type\endcsname}
-\protected\defcsname\??constructionnotehandler\v!notation:\endcsname% empty case
+\protected\defcsname\??constructionnotehandler\v!notation:\endcsname % empty case
{[\currentconstructionhandler:\currentconstruction]}
%D Here is a simple renderer for notes
diff --git a/tex/context/base/mkxl/strc-sec.mkxl b/tex/context/base/mkxl/strc-sec.mkxl
index 19eeb262e..54b74fe4c 100644
--- a/tex/context/base/mkxl/strc-sec.mkxl
+++ b/tex/context/base/mkxl/strc-sec.mkxl
@@ -847,7 +847,7 @@
\permanent\tolerant\protected\def\placeheadtext[#1]%
{\dontleavehmode
\begingroup
- \protected\def\\{\space}% messy here, but the default (and needs to be grouped)
+ \enforced\permanent\protected\def\\{\space}% messy here, but the default (and needs to be grouped)
\global\settrue\headisdisplay % triggers interlinespace checking
\edef\currenthead{#1}% maybe only when #1 is given
\strc_rendering_initialize_style_and_color\c!textstyle\c!textcolor
diff --git a/tex/context/base/mkxl/strc-usr.mkxl b/tex/context/base/mkxl/strc-usr.mkxl
index 28d398194..9ecb80ebd 100644
--- a/tex/context/base/mkxl/strc-usr.mkxl
+++ b/tex/context/base/mkxl/strc-usr.mkxl
@@ -91,21 +91,16 @@
\installcommandhandler \????userdata {userdata} \????userdata
\installcommandhandler \????userdataalternative {userdataalternative} \????userdataalternative
+\appendtoks
+ \frozen\protected\instance\edefcsname\e!start\currentuserdata\endcsname{\userdata_start_instance{\currentuserdata}}%
+ \frozen\protected\instance\letcsname \e!stop \currentuserdata\endcsname\userdata_stop_instance
+\to \everydefineuserdata
+
\permanent\protected\def\startuserdata
{\begingroup
\let\currentuserdata\empty
\doifelsenextoptionalcs\userdata_start_delayed\userdata_start_indeed}
-% This variant works only when the userdata instance exists while the assignment check
-% can also be used with undefined instances which falls back to the global settings.
-%
-% \def\userdata_start_delayed[#1]%
-% {\ifcsname\nameduserdatahash{\detokenize\expandafter{\normalexpanded{#1}}}\s!parent\endcsname
-% \expandafter\userdata_start_delayed_name
-% \else
-% \expandafter\userdata_start_delayed_parameters
-% \fi[#1]}
-
\def\userdata_start_delayed[#1]%
{\doifelseassignmentcs{#1}%
\userdata_start_delayed_parameters
@@ -121,15 +116,29 @@
\checkuserdataparent
\doifelsenextoptionalcs\userdata_start_delayed_parameters\userdata_start_indeed}
+\protected\tolerant\def\userdata_start_instance#1#*[#2]%
+ {\begingroup
+ \edef\currentuserdata{#1}%
+ \setupcurrentuserdata[#2]%
+ \grabbufferdatadirect
+ % {\s!userdata:\currentuserdata}%
+ {\s!userdata}% unnested, as before
+ {\e!start\currentuserdata}%
+ {\e!stop \currentuserdata}}
+
\def\userdata_start_indeed
- {\grabbufferdatadirect\s!userdata{\csstring\startuserdata}{\csstring\stopuserdata}}
+ {\grabbufferdatadirect
+ % {\s!userdata:\currentuserdata}%
+ {\s!userdata}% unnested, as before
+ {\csstring\startuserdata}%
+ {\csstring\stopuserdata}}
\permanent\protected\def\stopuserdata
- {\userdataparameter\c!before % HH: moved, so we obey the outer spacing
- \dostarttagged\t!userdata\currentuserdata % HH: added, maybe move up ?
+ {\userdataparameter\c!before
+ \dostarttagged\t!userdata\currentuserdata
\begingroup
\useuserdatastyleandcolor\c!style\c!color
- \usealignparameter\userdataparameter % HH: added
+ \usealignparameter\userdataparameter
\edef\currentuserdataalternative{\userdataparameter\c!alternative}%
\ifcsname\currentuserdataalternativehash\s!parent\endcsname \else
\let\currentuserdataalternative\s!default
@@ -139,14 +148,20 @@
\directsetup\p_renderingsetup
\endgroup
\dostoptagged
- \userdataparameter\c!after % HH: moved
+ \userdataparameter\c!after
\endgroup}
-\permanent\protected\def\getuserdata
- {\getbufferdata[\s!userdata]}
+\aliased\let\userdata_stop_instance\stopuserdata
+
+% kind of nested, when we need it:
+%
+% \permanent\tolerant\protected\def\getuserdata [#1]{\normalexpanded{\getbufferdata[\s!userdata:\ifparameter#1\or#1\else\currentuserdata\fi]}}
+% \permanent\tolerant\protected\def\getinlineuserdata[#1]{\normalexpanded{\inlinebuffer [\s!userdata:\ifparameter#1\or#1\else\currentuserdata\fi]}}
+
+% unnested, as before:
-\permanent\protected\def\getinlineuserdata
- {\inlinebuffer[\s!userdata]}
+\permanent\tolerant\protected\def\getuserdata [#1]{\getbufferdata[\s!userdata]}
+\permanent\tolerant\protected\def\getinlineuserdata[#1]{\inlinebuffer [\s!userdata]}
\defineuserdataalternative
[\s!default]
diff --git a/tex/context/base/mkxl/typo-shp.mkxl b/tex/context/base/mkxl/typo-shp.mkxl
index 0f6fdc933..3f1d3f3d8 100644
--- a/tex/context/base/mkxl/typo-shp.mkxl
+++ b/tex/context/base/mkxl/typo-shp.mkxl
@@ -197,7 +197,33 @@
\egroup
\endgroup}
-\permanent\protected\def\getshapetext
+% \permanent\protected\def\getshapetext
+% {\vbox\bgroup
+% \forgetall
+% \dontcomplain
+% \global\advance\shapetextindex\plusone
+% \scratchcounter\getshapeparameter{lines}\relax
+% \ifnum\scratchcounter>\zerocount
+% \scratchwidth \getshapeparameter{width}\scaledpoint\relax
+% \scratchheight \getshapeparameter{height}\scaledpoint\relax
+% \setbox\scratchbox\vpack to \scratchheight
+% {\splittopskip\strutheight
+% \vskip\dimexpr\getshapeparameter{voffset}\scaledpoint\relax
+% \ifcase\numexpr\getshapeparameter{first}\relax\else
+% \vskip\lineheight
+% \fi
+% \hskip\dimexpr\getshapeparameter{hoffset}\scaledpoint\relax
+% \hpack{\vsplit\shapetextbox to \scratchcounter\lineheight}}%
+% \wd\scratchbox\scratchwidth
+% \ht\scratchbox\scratchheight
+% \dp\scratchbox\zeropoint
+% \box\scratchbox
+% \else
+% % what now
+% \fi
+% \egroup}
+
+\pushoverloadmode\permanent\protected\def\getshapetext
{\vbox\bgroup
\forgetall
\dontcomplain
@@ -206,21 +232,24 @@
\ifnum\scratchcounter>\zerocount
\scratchwidth \getshapeparameter{width}\scaledpoint\relax
\scratchheight \getshapeparameter{height}\scaledpoint\relax
+ \scratchhoffset\dimexpr\getshapeparameter{hoffset}\scaledpoint\relax
+ \scratchvoffset\dimexpr\getshapeparameter{voffset}\scaledpoint\relax
\setbox\scratchbox\vpack to \scratchheight
{\splittopskip\strutheight
- \vskip\dimexpr\getshapeparameter{voffset}\scaledpoint\relax
+ \vskip\scratchvoffset
\ifcase\numexpr\getshapeparameter{first}\relax\else
\vskip\lineheight
\fi
- \hskip\dimexpr\getshapeparameter{hoffset}\scaledpoint\relax
+ \hskip\scratchhoffset
\hpack{\vsplit\shapetextbox to \scratchcounter\lineheight}}%
- \wd\scratchbox\scratchwidth
- \ht\scratchbox\scratchheight
- \dp\scratchbox\zeropoint
+ \wd\scratchbox\dimexpr\scratchwidth +\scratchhoffset\relax
+ \ht\scratchbox\dimexpr\scratchheight+\scratchvoffset\relax
+ \dp\scratchbox\strutdp % zeropoint
\box\scratchbox
\else
% what now
\fi
\egroup}
+
\protect