summaryrefslogtreecommitdiff
path: root/tex/context/base
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base')
-rw-r--r--tex/context/base/mkii/cont-new.mkii2
-rw-r--r--tex/context/base/mkii/context.mkii2
-rw-r--r--tex/context/base/mkii/mult-pe.mkii24
-rw-r--r--tex/context/base/mkiv/buff-ini.lua40
-rw-r--r--tex/context/base/mkiv/buff-ini.mkiv55
-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/grph-fil.lua89
-rw-r--r--tex/context/base/mkiv/l-io.lua7
-rw-r--r--tex/context/base/mkiv/lang-def.mkiv3
-rw-r--r--tex/context/base/mkiv/lpdf-wid.lua26
-rw-r--r--tex/context/base/mkiv/meta-blb.lua2
-rw-r--r--tex/context/base/mkiv/mult-def.lua65
-rw-r--r--tex/context/base/mkiv/scrn-ini.lua2
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin24854 -> 24898 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin250063 -> 250052 bytes
-rw-r--r--tex/context/base/mkiv/strc-blk.lua41
-rw-r--r--tex/context/base/mkiv/strc-blk.mkiv4
-rw-r--r--tex/context/base/mkiv/strc-usr.mkiv55
-rw-r--r--tex/context/base/mkiv/util-lib-imp-gm.lua4
-rw-r--r--tex/context/base/mkiv/util-lib-imp-gs.lua4
-rw-r--r--tex/context/base/mkiv/util-lib.lua2
-rw-r--r--tex/context/base/mkiv/util-sql-imp-ffi.lua3
-rw-r--r--tex/context/base/mkiv/util-sql-imp-sqlite.lua14
-rw-r--r--tex/context/base/mkiv/util-sql-imp-swiglib.lua4
-rw-r--r--tex/context/base/mkiv/util-sql-tracers.lua2
-rw-r--r--tex/context/base/mkiv/util-sql.lua8
-rw-r--r--tex/context/base/mkiv/util-str.lua41
-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
57 files changed, 754 insertions, 359 deletions
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index 4ff589018..7853fc50f 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.07.30 00:41}
+\newcontextversion{2021.08.04 17:48}
%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 ecb8d8069..1dab0354a 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.07.30 00:41}
+\edef\contextversion{2021.08.04 17:48}
%D For those who want to use this:
diff --git a/tex/context/base/mkii/mult-pe.mkii b/tex/context/base/mkii/mult-pe.mkii
index 49abd76c3..0395abe44 100644
--- a/tex/context/base/mkii/mult-pe.mkii
+++ b/tex/context/base/mkii/mult-pe.mkii
@@ -79,6 +79,7 @@
\setinterfacevariable{anchor}{anchor}
\setinterfacevariable{and}{and}
\setinterfacevariable{answerarea}{answerarea}
+\setinterfacevariable{append}{append}
\setinterfacevariable{appendices}{پیوستها}
\setinterfacevariable{appendix}{پیوست}
\setinterfacevariable{april}{آوریل}
@@ -207,6 +208,8 @@
\setinterfacevariable{fixed}{ثابت}
\setinterfacevariable{flexible}{انعطافپذیر}
\setinterfacevariable{float}{شناور}
+\setinterfacevariable{flushbackward}{flushbackward}
+\setinterfacevariable{flushforward}{flushforward}
\setinterfacevariable{flushinner}{پمپ‌داخلی}
\setinterfacevariable{flushleft}{پمپ‌چپ}
\setinterfacevariable{flushouter}{پمپ‌خارجی}
@@ -434,6 +437,7 @@
\setinterfacevariable{postscript}{پست‌اسکریپت}
\setinterfacevariable{precedingpage}{precedingpage}
\setinterfacevariable{preference}{ترجیح}
+\setinterfacevariable{prepend}{prepend}
\setinterfacevariable{preview}{پیش‌دید}
\setinterfacevariable{previous}{قبلی}
\setinterfacevariable{previousevenpage}{صفحه‌زوج‌قبلی}
@@ -1365,6 +1369,8 @@
\setinterfaceelement{load}{بارگذاشتن}
\setinterfaceelement{local}{موضعی}
\setinterfaceelement{makeup}{آرایش}
+\setinterfaceelement{namednotation}{namednotation}
+\setinterfaceelement{namedtyping}{namedtyping}
\setinterfaceelement{next}{بعدی}
\setinterfaceelement{place}{مکان}
\setinterfaceelement{previous}{قبلی}
@@ -1533,6 +1539,7 @@
\setinterfacecommand{definereferencelist}{تعریف‌لیست‌مرجع}
\setinterfacecommand{defineregister}{تعریف‌ثبت}
\setinterfacecommand{definerule}{تعریف‌خط‌حائل}
+\setinterfacecommand{definesavebuffer}{startsavebuffer}
\setinterfacecommand{definesection}{تعریف‌بخش}
\setinterfacecommand{definesectionblock}{تعریف‌بلوک‌بخش}
\setinterfacecommand{definesorting}{تعریف‌ترتیب}
@@ -1709,6 +1716,9 @@
\setinterfacecommand{moveformula}{انتقال‌فرمول}
\setinterfacecommand{moveongrid}{انتقال‌به‌توری}
\setinterfacecommand{movesidefloat}{انتقال‌کنار‌شناور}
+\setinterfacecommand{namedconstruction}{namedconstruction}
+\setinterfacecommand{nameddescription}{nameddescription}
+\setinterfacecommand{namedenumeration}{namedenumeration}
\setinterfacecommand{navigating}{هدایت}
\setinterfacecommand{nodimension}{بدون‌بعد}
\setinterfacecommand{noheaderandfooterlines}{بدون‌خط‌سروته‌برگ}
@@ -2080,6 +2090,13 @@
\setinterfacecommand{startmakeup}{شروع‌آرایش}
\setinterfacecommand{startmarginblock}{شروع‌بلوک‌حاشیه}
\setinterfacecommand{startmarginrule}{شروع‌خط‌حاشیه}
+\setinterfacecommand{startnamedconstruction}{startnamedconstruction}
+\setinterfacecommand{startnameddescription}{startnameddescription}
+\setinterfacecommand{startnamedenumeration}{startnamedenumeration}
+\setinterfacecommand{startnamedmatrix}{startnamedmatrix}
+\setinterfacecommand{startnamedsection}{startnamedsection}
+\setinterfacecommand{startnamedsubformulas}{startnamedsubformulas}
+\setinterfacecommand{startnamedtyping}{startnamedtyping}
\setinterfacecommand{startnarrower}{شروع‌باریکتر}
\setinterfacecommand{startopposite}{شروع‌مخالف}
\setinterfacecommand{startoverlay}{شروع‌پوشش}
@@ -2123,6 +2140,13 @@
\setinterfacecommand{stopmakeup}{پایان‌آرایش}
\setinterfacecommand{stopmarginblock}{پایان‌بلوک‌حاشیه}
\setinterfacecommand{stopmarginrule}{پایان‌خط‌حاشیه}
+\setinterfacecommand{stopnamedconstruction}{stopnamedconstruction}
+\setinterfacecommand{stopnameddescription}{stopnameddescription}
+\setinterfacecommand{stopnamedenumeration}{stopnamedenumeration}
+\setinterfacecommand{stopnamedmatrix}{stopnamedmatrix}
+\setinterfacecommand{stopnamedsection}{stopnamedsection}
+\setinterfacecommand{stopnamedsubformulas}{stopnamedsubformulas}
+\setinterfacecommand{stopnamedtyping}{stopnamedtyping}
\setinterfacecommand{stopnarrower}{پایان‌نازکتر}
\setinterfacecommand{stopopposite}{پایان‌مخالف}
\setinterfacecommand{stopoverlay}{پایان‌پوشش}
diff --git a/tex/context/base/mkiv/buff-ini.lua b/tex/context/base/mkiv/buff-ini.lua
index 4589e5498..8a8ec67c7 100644
--- a/tex/context/base/mkiv/buff-ini.lua
+++ b/tex/context/base/mkiv/buff-ini.lua
@@ -8,7 +8,7 @@ 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 = string.sub, string.format, string.find
local splitlines, validstring, replacenewlines = string.splitlines, string.valid, string.replacenewlines
local P, Cs, patterns, lpegmatch = lpeg.P, lpeg.Cs, lpeg.patterns, lpeg.match
local utfchar = utf.char
@@ -55,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
@@ -120,6 +121,14 @@ local function exists(name)
return cache[name]
end
+local function empty(name)
+ if find(getcontent(name),"%S") then
+ return false
+ else
+ return true
+ end
+end
+
local function getcontent(name)
local buffer = name and cache[name]
return buffer and buffer.data or ""
@@ -201,6 +210,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 +652,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 +666,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,7 +688,7 @@ local runner = sandbox.registerrunner {
name = "run buffer",
program = "context",
method = "execute",
- template = jit and "--purgeall --jit %filename%" or "--purgeall %filename%",
+ template = (jit and "--jit " or "") .. "--purgeall %?path: --path=%path% ?% %filename%",
reporter = report_typeset,
checkers = {
filename = "readable",
@@ -769,7 +782,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)
@@ -849,6 +865,12 @@ implement {
arguments = "string"
}
+implement {
+ name = "doifelsebufferempty",
+ actions = { empty, commands.doifelse },
+ arguments = "string"
+}
+
-- This only used for mp buffers and is a kludge. Don't change the
-- texprint into texsprint as it fails because "p<nl>enddef" becomes
-- "penddef" then.
@@ -885,10 +907,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/mkiv/buff-ini.mkiv b/tex/context/base/mkiv/buff-ini.mkiv
index a8a120d90..071a18987 100644
--- a/tex/context/base/mkiv/buff-ini.mkiv
+++ b/tex/context/base/mkiv/buff-ini.mkiv
@@ -22,8 +22,8 @@
\let\currentbuffer\empty
-\def\doifelsebuffer#1%
- {\clf_doifelsebuffer{#1}}
+ \def\doifelsebuffer #1{\clf_doifelsebuffer {#1}}
+\unexpanded\def\doifelsebufferempty#1{\clf_doifelsebufferempty{#1}}
\let\doifbufferelse\doifelsebuffer
@@ -246,12 +246,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]
\unexpanded\def\savebuffer
@@ -262,9 +264,54 @@
\doifelseassignment{#1}
{\setupcurrentsavebuffer[#1]}%
{\setupcurrentsavebuffer[\c!list={#1},\c!file=#2]}%
- \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
+ \setuevalue{\e!stop\currentsavebuffer}{\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/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index d454c8d15..29108424f 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.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/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv
index 32af5b99b..aa17074b9 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.07.30 00:41}
+\edef\contextversion{2021.08.04 17:48}
%D Kind of special:
diff --git a/tex/context/base/mkiv/grph-fil.lua b/tex/context/base/mkiv/grph-fil.lua
index 005657947..1044d29d9 100644
--- a/tex/context/base/mkiv/grph-fil.lua
+++ b/tex/context/base/mkiv/grph-fil.lua
@@ -49,89 +49,106 @@ job.register('job.files.collected', tobesaved, initializer)
local runner = sandbox.registerrunner {
name = "hashed context run",
program = "context",
- template = [[%options% --path=%path% %filename%]],
- template = [[%options% %?path: --path=%path% ?% %?runpath: --runpath=%runpath% ?% %filename%]],
+ template = [[%options% %?path: --runpath=%path% ?% %filename%]],
checkers = {
options = "string",
filename = "readable",
path = "string",
- runpath = "string",
+ -- runpath = "string",
}
}
-function jobfiles.run(name,action)
- local usedname = addsuffix(name,inputsuffix) -- we assume tex if not set
- local oldchecksum = collected[usedname]
- local newchecksum = checksum(usedname)
- local resultfile = replacesuffix(usedname,resultsuffix)
+-- we can also use:
+--
+-- local jobvariables = job.variables
+-- jobvariables.getchecksum(tag)
+-- jobvariables.makechecksum(data)
+-- jobvariables.setchecksum(tag,checksum)
+
+-- The runpath features makes things more complex than needed, so we need to wrap
+-- that some day in a helper. This is also very sensitive for both being set!
+
+local function analyzed(name)
+ local actiontype = type(action)
+ local usedname = addsuffix(name,inputsuffix) -- we assume tex if not set
+ local resultname = replacesuffix(name,resultsuffix) -- we assume tex if not set
+ local pathname = file.pathpart(usedname)
+ local runpath = environment.arguments.path -- sic, no runpath
+ if pathname ~= "" then
+ if runpath then
+ runpath = file.join(action.path,pathname)
+ else
+ runpath = pathname
+ end
+ usedname = file.basename(usedname)
+ end
+ return {
+ options = options,
+ path = runpath,
+ filename = usedname,
+ result = resultname,
+ }
+end
+
+function jobfiles.run(action)
+ local filename = action.filename
+ local result = action.result
+ local oldchecksum = collected[filename]
+ local newchecksum = checksum(filename)
local tobedone = false
if jobfiles.forcerun then
tobedone = true
if trace_run then
- report_run("processing file, changes in %a, %s",name,"processing forced")
+ report_run("processing file, changes in %a, %s",filename,"processing forced")
end
end
if not tobedone and not oldchecksum then
tobedone = true
if trace_run then
- report_run("processing file, changes in %a, %s",name,"no checksum yet")
+ report_run("processing file, changes in %a, %s",filename,"no checksum yet")
end
end
if not tobedone and oldchecksum ~= newchecksum then
tobedone = true
if trace_run then
- report_run("processing file, changes in %a, %s",name,"checksum mismatch")
+ report_run("processing file, changes in %a, %s",filename,"checksum mismatch")
end
end
- if not tobedone and not isfile(resultfile) then
+ if not tobedone and not isfile(result) then
tobedone = true
if trace_run then
- report_run("processing file, changes in %a, %s",name,"no result file")
+ report_run("processing file, changes in %a, %s",filename,"no result file")
end
end
if tobedone then
- local ta = type(action)
- if ta == "function" then
- action(name)
- elseif ta == "string" and action ~= "" then
- -- can be anything but we assume it gets checked by the sandbox
- os.execute(action)
- elseif ta == "table" then
- -- these paths will be ignored when they are not set
- local path = action.path
- local runpath = action.runpath
- action.path = environment.arguments.path
- action.runpath = environment.arguments.runpath
- runner(action)
- action.path = path
- action.runpath = runpath
- else
- report_run("processing file, no action given for processing %a",name)
- end
+ runner(action)
elseif trace_run then
report_run("processing file, no changes in %a, not processed",name)
end
- tobesaved[name] = newchecksum
+ tobesaved[filename] = newchecksum
end
--
local done = { }
-function jobfiles.context(name,options)
+function jobfiles.context(name,options) -- runpath ?
if type(name) == "table" then
local result = { }
for i=1,#name do
result[#result+1] = jobfiles.context(name[i],options)
end
return result
- else
- local result = replacesuffix(name,resultsuffix)
+ elseif name ~= "" then
+ local action = analyzed(name,options)
+ local result = action.result
if not done[result] then
- jobfiles.run(name, { options = options, filename = name })
+ jobfiles.run(action)
done[result] = true
end
return result
+ else
+ return { }
end
end
diff --git a/tex/context/base/mkiv/l-io.lua b/tex/context/base/mkiv/l-io.lua
index a955262a3..f72995abd 100644
--- a/tex/context/base/mkiv/l-io.lua
+++ b/tex/context/base/mkiv/l-io.lua
@@ -147,9 +147,12 @@ function io.copydata(source,target,action)
end
end
-function io.savedata(filename,data,joiner)
- local f = open(filename,"wb")
+function io.savedata(filename,data,joiner,append)
+ local f = open(filename,append and "ab" or "wb")
if f then
+ if append and joiner and f:seek("end") > 0 then
+ f:write(joiner)
+ end
if type(data) == "table" then
f:write(concat(data,joiner or ""))
elseif type(data) == "function" then
diff --git a/tex/context/base/mkiv/lang-def.mkiv b/tex/context/base/mkiv/lang-def.mkiv
index cc94bf7ae..603935097 100644
--- a/tex/context/base/mkiv/lang-def.mkiv
+++ b/tex/context/base/mkiv/lang-def.mkiv
@@ -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/mkiv/lpdf-wid.lua b/tex/context/base/mkiv/lpdf-wid.lua
index f0156075a..1e91ecd56 100644
--- a/tex/context/base/mkiv/lpdf-wid.lua
+++ b/tex/context/base/mkiv/lpdf-wid.lua
@@ -69,17 +69,18 @@ local pdfreference = lpdf.reference
local pdfunicode = lpdf.unicode
local pdfstring = lpdf.string
local pdfboolean = lpdf.boolean
+local pdfaction = lpdf.action
+local pdfborder = lpdf.border
+
+local pdftransparencyvalue = lpdf.transparencyvalue
+local pdfcolorvalues = lpdf.colorvalues
+
local pdfflushobject = lpdf.flushobject
local pdfflushstreamobject = lpdf.flushstreamobject
local pdfflushstreamfileobject = lpdf.flushstreamfileobject
local pdfreserveobject = lpdf.reserveobject
local pdfpagereference = lpdf.pagereference
local pdfshareobjectreference = lpdf.shareobjectreference
-local pdfaction = lpdf.action
-local pdfborder = lpdf.border
-
-local pdftransparencyvalue = lpdf.transparencyvalue
-local pdfcolorvalues = lpdf.colorvalues
-- symbols
@@ -258,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
@@ -368,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
@@ -651,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
@@ -704,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/mkiv/meta-blb.lua b/tex/context/base/mkiv/meta-blb.lua
index e57bc3c23..c042451f2 100644
--- a/tex/context/base/mkiv/meta-blb.lua
+++ b/tex/context/base/mkiv/meta-blb.lua
@@ -200,7 +200,7 @@ metapost.installplugin {
}
-- Here follows an example of usage of the above: a more modern
--- version of followokens (in meta-imp-txt.mkiv).
+-- version of followtokens (in meta-imp-txt.mkiv).
local nodecodes = nodes.nodecodes
local kerncodes = nodes.kerncodes
diff --git a/tex/context/base/mkiv/mult-def.lua b/tex/context/base/mkiv/mult-def.lua
index d65c7bcf6..af7804506 100644
--- a/tex/context/base/mkiv/mult-def.lua
+++ b/tex/context/base/mkiv/mult-def.lua
@@ -7271,6 +7271,62 @@ return {
["pe"]="بنویس‌درثبت",
["ro"]="scrieinregistru",
},
+ -- we still need to add some new ones here as i completely forgot that it's
+ -- needed ... maybe ws has a backlog for setups that we can use
+ ["definesavebuffer"]={
+ ["en"]="startsavebuffer",
+ },
+ ["startnamedtyping"]={
+ ["en"]="startnamedtyping",
+ },
+ ["stopnamedtyping"]={
+ ["en"]="stopnamedtyping",
+ },
+ ["namedconstruction"]={
+ ["en"]="namedconstruction",
+ },
+ ["startnamedconstruction"]={
+ ["en"]="startnamedconstruction",
+ },
+ ["stopnamedconstruction"]={
+ ["en"]="stopnamedconstruction",
+ },
+ ["nameddescription"]={
+ ["en"]="nameddescription",
+ },
+ ["startnameddescription"]={
+ ["en"]="startnameddescription",
+ },
+ ["stopnameddescription"]={
+ ["en"]="stopnameddescription",
+ },
+ ["namedenumeration"]={
+ ["en"]="namedenumeration",
+ },
+ ["startnamedenumeration"]={
+ ["en"]="startnamedenumeration",
+ },
+ ["stopnamedenumeration"]={
+ ["en"]="stopnamedenumeration",
+ },
+ ["startnamedsection"]={
+ ["en"]="startnamedsection",
+ },
+ ["stopnamedsection"]={
+ ["en"]="stopnamedsection",
+ },
+ ["startnamedmatrix"]={
+ ["en"]="startnamedmatrix",
+ },
+ ["stopnamedmatrix"]={
+ ["en"]="stopnamedmatrix",
+ },
+ ["startnamedsubformulas"]={
+ ["en"]="startnamedsubformulas",
+ },
+ ["stopnamedsubformulas"]={
+ ["en"]="stopnamedsubformulas",
+ },
},
["constants"]={
["action"]={
@@ -12887,6 +12943,9 @@ return {
["namedtyping"]={
["en"]="namedtyping",
},
+ ["namednotation"]={
+ ["en"]="namednotation",
+ },
["next"]={
["cs"]="dalsi",
["de"]="folgende",
@@ -14505,6 +14564,12 @@ return {
["pe"]="answerarea",
["ro"]="answerarea",
},
+ ["append"]={
+ ["en"]="append",
+ },
+ ["prepend"]={
+ ["en"]="prepend",
+ },
["appendices"]={
["cs"]="dodatky",
["de"]="anhaenge",
diff --git a/tex/context/base/mkiv/scrn-ini.lua b/tex/context/base/mkiv/scrn-ini.lua
index ce9f9f71b..bf7afccb6 100644
--- a/tex/context/base/mkiv/scrn-ini.lua
+++ b/tex/context/base/mkiv/scrn-ini.lua
@@ -33,7 +33,7 @@ interfaces.implement {
arguments = {
{
{ "title" },
- { "subtitle" },
+ { "subtitle"},
{ "author" },
{ "creator" },
{ "date" },
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 4edea249a..873f89595 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 a3561d70c..2de5b578b 100644
--- a/tex/context/base/mkiv/status-lua.pdf
+++ b/tex/context/base/mkiv/status-lua.pdf
Binary files differ
diff --git a/tex/context/base/mkiv/strc-blk.lua b/tex/context/base/mkiv/strc-blk.lua
index 6717c3777..f627ad3ea 100644
--- a/tex/context/base/mkiv/strc-blk.lua
+++ b/tex/context/base/mkiv/strc-blk.lua
@@ -95,8 +95,11 @@ function blocks.setstate(state,name,tag)
end
end
-function blocks.select(state,name,tag,criterium)
- criterium = criterium or "text"
+
+local function selectblocks(state,name,tag,criterium,action)
+ if not criterium or criterium == "" then
+ criterium = "text"
+ end
if find(tag,"=",1,true) then
tag = ""
end
@@ -115,14 +118,19 @@ function blocks.select(state,name,tag,criterium)
local metadata = ri.metadata
if names[metadata.name] then
if all then
- printblock(ri.index,name,ri.data,hide)
+ if action(ri.index,name,ri.data,hide) then
+ return
+ end
else
local mtags = metadata.tags
if mtags then
for tag, sta in next, tags do
if mtags[tag] then
- printblock(ri.index,name,ri.data,hide)
- break
+ if action(ri.index,name,ri.data,hide) then
+ return
+ else
+ break
+ end
end
end
end
@@ -131,6 +139,20 @@ function blocks.select(state,name,tag,criterium)
end
end
+function blocks.select(state,name,tag,criterium)
+ selectblocks(state,name,tag,criterium,printblock)
+end
+
+function blocks.empty(state,name,tag,criterium)
+ local found = false
+ local function checkempty(_,_,data)
+ found = type(data) == "string" and find(data,"%S")
+ return found
+ end
+ selectblocks(state,name,tag,criterium,checkempty)
+ return not found
+end
+
function blocks.save(name,tag,userdata,buffer) -- wrong, not yet adapted
local data = buffers.getcontent(buffer)
local tags = settings_to_set(tag)
@@ -183,6 +205,7 @@ function blocks.save(name,tag,userdata,buffer) -- wrong, not yet adapted
buffers.erase(buffer)
end
+
-- interface
implement { name = "definestructureblock", actions = blocks.define, arguments = "string" }
@@ -190,3 +213,11 @@ implement { name = "savestructureblock", actions = blocks.save,
implement { name = "selectstructureblock", actions = blocks.select, arguments = "4 strings" }
implement { name = "setstructureblockstate", actions = blocks.setstate, arguments = "3 strings" }
implement { name = "structureblockuservariable", actions = blocks.uservariable, arguments = { "integer", "string" } }
+
+implement {
+ name = "doifelsestructureblocksempty",
+ arguments = "3 strings",
+ actions = function(name,tag,criterium)
+ commands.doifelse(blocks.empty(false,name,tag,criterium))
+ end,
+}
diff --git a/tex/context/base/mkiv/strc-blk.mkiv b/tex/context/base/mkiv/strc-blk.mkiv
index e52198721..0b41b6dc2 100644
--- a/tex/context/base/mkiv/strc-blk.mkiv
+++ b/tex/context/base/mkiv/strc-blk.mkiv
@@ -1,4 +1,4 @@
-%D \module
+D \module
%D [ file=strc-blk,
%D version=2008.10.20,
%D title=\CONTEXT\ Structure Macros,
@@ -177,4 +177,6 @@
\unexpanded\def\processblocks{\doquadrupleempty\strc_blocks_select [process]}
\unexpanded\def\selectblocks {\doquadrupleempty\strc_blocks_select [use]}
+unexpanded\def\doifelseblocksempty{\clf_doifelsestructureblocksempty} % {name}{tag}{criterium}
+
\protect \endinput
diff --git a/tex/context/base/mkiv/strc-usr.mkiv b/tex/context/base/mkiv/strc-usr.mkiv
index 97b656fa0..cbf910616 100644
--- a/tex/context/base/mkiv/strc-usr.mkiv
+++ b/tex/context/base/mkiv/strc-usr.mkiv
@@ -91,21 +91,16 @@
\installcommandhandler \????userdata {userdata} \????userdata
\installcommandhandler \????userdataalternative {userdataalternative} \????userdataalternative
+\appendtoks
+ \setuevalue{\e!start\currentuserdata}{\dodoubleempty\userdata_start_instance[\currentuserdata]}%
+ \setuevalue{\e!stop \currentuserdata}{\userdata_stop_instance}%
+\to \everydefineuserdata
+
\unexpanded\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,26 +116,27 @@
\checkuserdataparent
\doifelsenextoptionalcs\userdata_start_delayed_parameters\userdata_start_indeed}
+\unexpanded\def\userdata_start_instance[#1][#2]%
+ {\begingroup
+ \edef\currentuserdata{#1}%
+ \setupcurrentuserdata[#2]%
+ \grabbufferdatadirect
+ {\s!userdata:\currentuserdata}%
+ {\e!start\currentuserdata}%
+ {\e!stop \currentuserdata}}
+
\def\userdata_start_indeed
- {\grabbufferdatadirect\s!userdata{\csstring\startuserdata}{\csstring\stopuserdata}}
-
-% \unexpanded\def\stopuserdata
-% {\useuserdatastyleandcolor\c!style\c!color
-% \usealignparameter\userdataparameter
-% \edef\currentuserdataalternative{\userdataparameter\c!alternative}%
-% \ifcsname\currentuserdataalternativehash\s!parent\endcsname \else
-% \let\currentuserdataalternative\s!default
-% \fi
-% \edef\p_renderingsetup{\userdataalternativeparameter\c!renderingsetup}%
-% \directsetup\p_renderingsetup
-% \endgroup}
+ {\grabbufferdatadirect
+ {\s!userdata:\currentuserdata}%
+ {\csstring\startuserdata}%
+ {\csstring\stopuserdata}}
\unexpanded\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
@@ -150,14 +146,13 @@
\directsetup\p_renderingsetup
\endgroup
\dostoptagged
- \userdataparameter\c!after % HH: moved
+ \userdataparameter\c!after
\endgroup}
-\unexpanded\def\getuserdata
- {\getbufferdata[\s!userdata]}
+\let\userdata_stop_instance\stopuserdata
-\unexpanded\def\getinlineuserdata
- {\inlinebuffer[\s!userdata]}
+\unexpanded\def\getuserdata {\getbufferdata[\s!userdata]}
+\unexpanded\def\getinlineuserdata{\inlinebuffer[\s!userdata]}
\defineuserdataalternative
[\s!default]
diff --git a/tex/context/base/mkiv/util-lib-imp-gm.lua b/tex/context/base/mkiv/util-lib-imp-gm.lua
index d1ffde879..99c62451c 100644
--- a/tex/context/base/mkiv/util-lib-imp-gm.lua
+++ b/tex/context/base/mkiv/util-lib-imp-gm.lua
@@ -6,6 +6,10 @@ if not modules then modules = { } end modules ['util-lib-imp-gm'] = {
license = "see context related readme files",
}
+if true then
+ logs.report("warning","swiglib is no longer supported")
+end
+
local graphicmagick = utilities.graphicmagick or { }
utilities.graphicmagick = graphicmagick
diff --git a/tex/context/base/mkiv/util-lib-imp-gs.lua b/tex/context/base/mkiv/util-lib-imp-gs.lua
index 0eceda7aa..305f4103b 100644
--- a/tex/context/base/mkiv/util-lib-imp-gs.lua
+++ b/tex/context/base/mkiv/util-lib-imp-gs.lua
@@ -6,6 +6,10 @@ if not modules then modules = { } end modules ['util-lib-imp-gs'] = {
license = "see context related readme files",
}
+if true then
+ logs.report("warning","swiglib is no longer supported")
+end
+
local insert = table.insert
local formatters = string.formatters
diff --git a/tex/context/base/mkiv/util-lib.lua b/tex/context/base/mkiv/util-lib.lua
index be763d92e..77ec7cd7e 100644
--- a/tex/context/base/mkiv/util-lib.lua
+++ b/tex/context/base/mkiv/util-lib.lua
@@ -245,6 +245,8 @@ end
resolvers.locatelib = locate -- for now
+-- swiglib is no longer officially supported
+
do
local report_swiglib = logs.reporter("swiglib")
diff --git a/tex/context/base/mkiv/util-sql-imp-ffi.lua b/tex/context/base/mkiv/util-sql-imp-ffi.lua
index f44069502..cbfd7bcf5 100644
--- a/tex/context/base/mkiv/util-sql-imp-ffi.lua
+++ b/tex/context/base/mkiv/util-sql-imp-ffi.lua
@@ -8,8 +8,7 @@ if not modules then modules = { } end modules ['util-sql-imp-ffi'] = {
-- I looked at luajit-mysql to see how the ffi mapping was done but it didn't work
-- out that well (at least not on windows) but I got the picture. As I have somewhat
--- different demands I simplified / redid the ffi bit and just took the swiglib
--- variant and adapted that.
+-- different demands I simplified.
local tonumber = tonumber
local concat = table.concat
diff --git a/tex/context/base/mkiv/util-sql-imp-sqlite.lua b/tex/context/base/mkiv/util-sql-imp-sqlite.lua
index a88035f68..781c92c89 100644
--- a/tex/context/base/mkiv/util-sql-imp-sqlite.lua
+++ b/tex/context/base/mkiv/util-sql-imp-sqlite.lua
@@ -22,20 +22,6 @@ local preparetemplate = helpers.preparetemplate
local setmetatable = setmetatable
local formatters = string.formatters
------ sqlite = require("swiglib.sqlite.core")
------ swighelpers = require("swiglib.helpers.core")
------
------ get_list_item = sqlite.char_p_array_getitem
------ is_okay = sqlite.SQLITE_OK
------ execute_query = sqlite.sqlite3_exec_lua_callback
------ error_message = sqlite.sqlite3_errmsg
------
------ new_db = sqlite.new_sqlite3_p_array
------ open_db = sqlite.sqlite3_open
------ get_db = sqlite.sqlite3_p_array_getitem
------ close_db = sqlite.sqlite3_close
------ dispose_db = sqlite.delete_sqlite3_p_array
-
local ffi = require("ffi")
ffi.cdef [[
diff --git a/tex/context/base/mkiv/util-sql-imp-swiglib.lua b/tex/context/base/mkiv/util-sql-imp-swiglib.lua
index 786b4bffc..16f6d533a 100644
--- a/tex/context/base/mkiv/util-sql-imp-swiglib.lua
+++ b/tex/context/base/mkiv/util-sql-imp-swiglib.lua
@@ -6,6 +6,10 @@ if not modules then modules = { } end modules ['util-sql-imp-swiglib'] = {
license = "see context related readme files"
}
+if true then
+ logs.report("warning","swiglib is no longer supported")
+end
+
-- As the regular library is flawed (i.e. there are crashes in the table
-- construction code) and also not that efficient, Luigi Scarso looked into
-- a swig binding. This is a bit more low level approach but as we stay
diff --git a/tex/context/base/mkiv/util-sql-tracers.lua b/tex/context/base/mkiv/util-sql-tracers.lua
index 44e32d256..0780f4d5b 100644
--- a/tex/context/base/mkiv/util-sql-tracers.lua
+++ b/tex/context/base/mkiv/util-sql-tracers.lua
@@ -10,7 +10,7 @@ local sql = utilities.sql
local tracers = { }
sql.tracers = tracers
-sql.setmethod("swiglib")
+sql.setmethod("library")
local gsub, lower = string.gsub, string.lower
diff --git a/tex/context/base/mkiv/util-sql.lua b/tex/context/base/mkiv/util-sql.lua
index 36f3eab19..ce4a37f07 100644
--- a/tex/context/base/mkiv/util-sql.lua
+++ b/tex/context/base/mkiv/util-sql.lua
@@ -26,7 +26,6 @@ if not modules then modules = { } end modules ['util-sql'] = {
-- util-sql-imp-client.lua
-- util-sql-imp-library.lua
--- util-sql-imp-swiglib.lua
-- util-sql-imp-lmxsql.lua
-- local sql = require("util-sql")
@@ -36,8 +35,7 @@ if not modules then modules = { } end modules ['util-sql'] = {
-- { name = "data",type = "string" },
-- }
--
--- local execute = sql.methods.swiglib.execute
--- -- local execute = sql.methods.library.execute
+-- local execute = sql.methods.library.execute
-- -- local execute = sql.methods.client.execute
-- -- local execute = sql.methods.lmxsql.execute
--
@@ -114,7 +112,6 @@ if optional then
local methods = {
ffi = "mysql",
library = "mysql",
- swiglib = "mysql",
postgress = "postgress",
sqlite = "sqlite",
sqlite3 = "sqlite",
@@ -192,8 +189,7 @@ local function makeconverter(entries,celltemplate,wraptemplate)
assignments[#assignments+1] = format("[%q] = %s,",name,value)
end
end
- local code = format(wraptemplate,concat(shortcuts,"\n"),key and "{ }" or "data",key or "i",concat(assignments,"\n "))
- -- print(code)
+ local code = format(wraptemplate,concat(shortcuts,"\n"),key and "{ }" or "data",key or "i",concat(assignments,"\n "))
local func = load(code)
return func and func()
end
diff --git a/tex/context/base/mkiv/util-str.lua b/tex/context/base/mkiv/util-str.lua
index 0d1f39de9..e58befe30 100644
--- a/tex/context/base/mkiv/util-str.lua
+++ b/tex/context/base/mkiv/util-str.lua
@@ -10,7 +10,7 @@ utilities = utilities or { }
utilities.strings = utilities.strings or { }
local strings = utilities.strings
-local format, gsub, rep, sub, find = string.format, string.gsub, string.rep, string.sub, string.find
+local format, gsub, rep, sub, find, char = string.format, string.gsub, string.rep, string.sub, string.find, string.char
local load, dump = load, string.dump
local tonumber, type, tostring, next, setmetatable = tonumber, type, tostring, next, setmetatable
local unpack, concat = table.unpack, table.concat
@@ -622,14 +622,22 @@ local template = [[
return function(%s) return %s end
]]
--- this might move
+-- We only use fast serialize in controlled cases.
+
+-- local pattern = Cs(Cc('"') * (
+-- (1-S('"\\\n\r'))^1
+-- + P('"') / '\\"'
+-- + P('\\') / '\\\\'
+-- + P('\n') / '\\n'
+-- + P('\r') / '\\r'
+-- )^0 * Cc('"'))
local pattern = Cs(Cc('"') * (
(1-S('"\\\n\r'))^1
- + P('"') / '\\"'
- + P('\\') / '\\\\'
- + P('\n') / '\\n'
- + P('\r') / '\\r'
+ + P('"') / '\\034'
+ + P('\\') / '\\020'
+ + P('\n') / '\\013'
+ + P('\r') / '\\010'
)^0 * Cc('"'))
patterns.escapedquotes = pattern
@@ -638,6 +646,27 @@ function string.escapedquotes(s)
return lpegmatch(pattern,s)
end
+local pattern = (1 - P("\\"))^1 ; pattern = Cs (
+ pattern
+ * ( (P("\\") / "" * (digit^-3 / function(s) return char(tonumber(s)) end)) + pattern )^1
+)
+
+patterns.unescapedquotes = pattern
+
+function string.unescapedquotes(s)
+ return lpegmatch(pattern,s) or s
+end
+
+-- function string.longifneeded(s)
+-- if find(s,'["\\\n\r]') then
+-- return "[===[" .. s .. "]===]"
+-- else
+-- return '"' .. s ..'"'
+-- end
+-- end
+
+string.texnewlines = lpeg.replacer(patterns.newline,"\r",true)
+
-- print(string.escapedquotes('1\\23\n"'))
-- but for now here
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