summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/context/documents/general/manuals/luametatex.pdfbin1213272 -> 1217490 bytes
-rw-r--r--doc/context/sources/general/manuals/luametatex/luametatex-modifications.tex30
-rw-r--r--scripts/context/lua/mtx-synctex.lua48
-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-de.mkii3
-rw-r--r--tex/context/base/mkiv/cont-new.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkiv2
-rw-r--r--tex/context/base/mkiv/lxml-tex.lua6
-rw-r--r--tex/context/base/mkiv/page-mix.lua7
-rw-r--r--tex/context/base/mkiv/publ-imp-apa.mkvi6
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin23937 -> 23938 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin229293 -> 229648 bytes
-rw-r--r--tex/context/base/mkiv/strc-not.mkvi10
-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/lang-hyp.mkxl18
-rw-r--r--tex/context/base/mkxl/lang-ini.mkxl2
-rw-r--r--tex/context/base/mkxl/luat-cnf.lmt2
-rw-r--r--tex/context/base/mkxl/luat-run.lmt45
-rw-r--r--tex/context/base/mkxl/node-fin.lmt137
-rw-r--r--tex/context/base/mkxl/node-fin.mkxl101
-rw-r--r--tex/context/base/mkxl/node-met.lmt2
-rw-r--r--tex/context/base/mkxl/node-nut.lmt4
-rw-r--r--tex/context/base/mkxl/node-pro.lmt184
-rw-r--r--tex/context/base/mkxl/node-syn.lmt381
-rw-r--r--tex/context/base/mkxl/node-tsk.lmt51
-rw-r--r--tex/context/base/mkxl/page-ins.mkxl96
-rw-r--r--tex/context/base/mkxl/page-one.mkxl14
-rw-r--r--tex/context/base/mkxl/page-pcl.mkxl6
-rw-r--r--tex/context/base/mkxl/strc-not.lmt530
-rw-r--r--tex/context/base/mkxl/strc-not.mklx82
-rw-r--r--tex/context/base/mkxl/task-ini.lmt1
-rw-r--r--tex/context/base/mkxl/trac-inf.lmt2
-rw-r--r--tex/context/base/mkxl/typo-cap.lmt10
-rw-r--r--tex/context/base/mkxl/typo-cap.mkxl5
-rw-r--r--tex/context/base/mkxl/typo-drp.lmt7
-rw-r--r--tex/context/base/mkxl/typo-drp.mkxl3
-rw-r--r--tex/context/interface/mkii/keys-de.xml3
-rw-r--r--tex/context/modules/mkxl/m-mathfun.mkxl4
-rw-r--r--tex/generic/context/luatex/luatex-fonts-merged.lua2
-rw-r--r--web2c/contextcnf.lua5
42 files changed, 1263 insertions, 556 deletions
diff --git a/doc/context/documents/general/manuals/luametatex.pdf b/doc/context/documents/general/manuals/luametatex.pdf
index 9fafc9690..21d4f6248 100644
--- a/doc/context/documents/general/manuals/luametatex.pdf
+++ b/doc/context/documents/general/manuals/luametatex.pdf
Binary files differ
diff --git a/doc/context/sources/general/manuals/luametatex/luametatex-modifications.tex b/doc/context/sources/general/manuals/luametatex/luametatex-modifications.tex
index ac283bafd..52b73978c 100644
--- a/doc/context/sources/general/manuals/luametatex/luametatex-modifications.tex
+++ b/doc/context/sources/general/manuals/luametatex/luametatex-modifications.tex
@@ -114,27 +114,28 @@ most still comes from original Knuthian \TEX. But we divert a bit.
\startitem
Because the backend is not built|-|in, the magnification (\prm {mag})
- primitive is not doing nothing. A \type {shipout} just discards the content
- of the given box. The write related primitives have to be implemented in the
- used macro package using \LUA. None of the \PDFTEX\ derived primitives is
- present.
+ primitive is gone. A \type {shipout} just discards the content of the given
+ box. The write related primitives have to be implemented in the used macro
+ package using \LUA. None of the \PDFTEX\ derived primitives is present.
\stopitem
\startitem
- There is more control over some (formerly hard|-|coded) math properties. In fact,
- there is a whole extra bit of math related code because we need to deal with
- \OPENTYPE\ fonts.
+ Because there is no font loader, a \LUA\ variant is free to either support or
+ not the \OMEGA\ \type {ofm} file format. As there are hardly any such fonts
+ it probably makes no sense. There is plenty of control over the way glyphs
+ get treated and scaling of fonts and glyphs is also more dynamic.
\stopitem
\startitem
- The \type {\outer} and \type {\long} prefixed are silently ignored. It is
- permitted to use \type {\par} in math.
+ There is more control over some (formerly hard|-|coded) math properties. In
+ fact, there is a whole extra bit of math related code because we need to deal
+ with \OPENTYPE\ fonts. The math processing has been adapted to the new
+ (dynamic) font and glyph scaling features.
\stopitem
\startitem
- Because there is no font loader, a \LUA\ variant is free to either support or
- not the \OMEGA\ \type {ofm} file format. As there are hardly any such fonts
- it probably makes no sense.
+ The \type {\outer} and \type {\long} prefixed are silently ignored. It is
+ permitted to use \type {\par} in math.
\stopitem
\startitem
@@ -212,6 +213,11 @@ features, but with a few small adaptations.
effect of delegating all file \IO.
\stopitem
+\startitem
+ Most of the code is rewritten but the original primitives are still tagged as
+ coming from \ETEX.
+\stopitem
+
\stopitemize
\stopsubsection
diff --git a/scripts/context/lua/mtx-synctex.lua b/scripts/context/lua/mtx-synctex.lua
index 3c4f6ee71..b12757240 100644
--- a/scripts/context/lua/mtx-synctex.lua
+++ b/scripts/context/lua/mtx-synctex.lua
@@ -10,7 +10,7 @@ if not modules then modules = { } end modules ['mtx-synctex'] = {
-- InverseSearchCmdLine = mtxrun.exe --script synctex --edit --name="%f" --line="%l" $
local tonumber = tonumber
-local find, match, gsub = string.find, string.match, string.gsub
+local find, match, gsub, formatters = string.find, string.match, string.gsub, string.formatters
local isfile = lfs.isfile
local longtostring = string.longtostring
@@ -20,15 +20,16 @@ local helpinfo = [[
<metadata>
<entry name="name">mtx-synctex</entry>
<entry name="detail">SyncTeX Checker</entry>
- <entry name="version">1.00</entry>
+ <entry name="version">1.01</entry>
</metadata>
<flags>
<category name="basic">
<subcategory>
<flag name="edit"><short>open file at line: --line=.. --editor=.. sourcefile</short></flag>
- <flag name="list"><short>show blob: synctexfile</short></flag>
+ <flag name="list"><short>show all areas: synctexfile</short></flag>
<flag name="goto"><short>open file at position: --page=.. --x=.. --y=.. --editor=.. synctexfile</short></flag>
- <flag name="report"><short>show file and line: --page=.. --x=.. --y=.. --console synctexfile</short></flag>
+ <flag name="report"><short>show (tex) file and line: [--direct] --page=.. --x=.. --y=.. --console synctexfile</short></flag>
+ <flag name="find"><short>find (pdf) page and box: [--direct] --file=.. --line=.. synctexfile</short></flag>
</subcategory>
</category>
</flags>
@@ -37,12 +38,19 @@ local helpinfo = [[
local application = logs.application {
name = "mtx-synctex",
- banner = "ConTeXt SyncTeX Checker 1.00",
+ banner = "ConTeXt SyncTeX Checker 1.01",
helpinfo = helpinfo,
}
local report = application.report
+local template_show = "page=%i llx=%r lly=%r urx=%r ury=%r"
+local template_goto = "filename=%a linenumber=%a"
+
+local function reportdirect(template,...)
+ print(formatters[template](...))
+end
+
local editors = {
console = function(specification)
print(string.formatters["%q %i"](specification.filename,specification.linenumber or 1))
@@ -184,18 +192,23 @@ local function findlocation(filename,page,xpos,ypos)
end
end
-local function showlocation(filename)
+local function showlocation(filename,sourcename,linenumber,direct)
if not validfile(filename) then
return
end
local files = { }
local found = false
local page = 0
+ if sourcename then
+ sourcename = file.collapsepath(sourcename)
+ end
for line in io.lines(filename) do
if found then
if find(line,"^}") then
found = false
- report("end page: %i",page)
+ if not sourcename then
+ report("end page: %i",page)
+ end
else
local f, l, x, y, w, h, d = match(line,"^h(.-),(.-):(.-),(.-):(.-),(.-),(.-)$")
if f then
@@ -206,15 +219,22 @@ local function showlocation(filename)
local urx = factor * ( x + tonumber(w) )
local ury = factor * ( y + tonumber(h) )
f = files[f]
- if f then
+ if not f then
+ --
+ elseif not sourcename then
report(" [% 4r % 4r % 4r % 4r] : % 5i : %s",llx,lly,urx,ury,l,f)
+ elseif f == sourcename and l == linenumber then
+ (direct and reportdirect or report)(template_show,page,llx,lly,urx,ury)
+ return
end
end
end
elseif find(line,"^{(%d+)") then
page = tonumber(match(line,"^{(%d+)"))
found = true
- report("begin page: %i",page)
+ if not sourcename then
+ report("begin page: %i",page)
+ end
elseif find(line,"^Input:") then
local id, name = match(line,"^Input:(.-):(.-)$")
if id then
@@ -224,14 +244,14 @@ local function showlocation(filename)
end
end
-local function gotolocation(filename,page,xpos,ypos,editor)
+local function gotolocation(filename,page,xpos,ypos,editor,direct)
if filename then
local target, line = findlocation(filename,tonumber(page),tonumber(xpos),tonumber(ypos))
if target and line then
if editor then
editfile(target,line,editor)
else
- report("filename=%a linenumber=%a",target,line)
+ (direct and reportdirect or report)(template_goto,target,line)
end
end
end
@@ -248,11 +268,13 @@ local filename = environment.files[1]
if argument("edit") then
editfile(filename,argument("line"),argument("editor"))
elseif argument("goto") then
- gotolocation(filename,argument("page"),argument("x"),argument("y"),argument("editor"))
+ gotolocation(filename,argument("page"),argument("x"),argument("y"),argument("editor"),argument("direct"))
elseif argument("report") then
- gotolocation(filename,argument("page"),argument("x"),argument("y"),"console")
+ gotolocation(filename,argument("page"),argument("x"),argument("y"),"console",argument("direct"))
elseif argument("list") then
showlocation(filename)
+elseif argument("find") then
+ showlocation(filename,argument("file"),argument("line"),argument("direct"))
elseif argument("exporthelp") then
application.export(argument("exporthelp"),filename)
else
diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii
index 823e34bbc..654d61e9d 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.05.21 15:02}
+\newcontextversion{2021.05.25 17:54}
%D This file is loaded at runtime, thereby providing an
%D excellent place for hacks, patches, extensions and new
diff --git a/tex/context/base/mkii/context.mkii b/tex/context/base/mkii/context.mkii
index ba05ebfc6..22d51ebe5 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.05.21 15:02}
+\edef\contextversion{2021.05.25 17:54}
%D For those who want to use this:
diff --git a/tex/context/base/mkii/mult-de.mkii b/tex/context/base/mkii/mult-de.mkii
index 06a4fb162..f031a5702 100644
--- a/tex/context/base/mkii/mult-de.mkii
+++ b/tex/context/base/mkii/mult-de.mkii
@@ -141,6 +141,7 @@
\setinterfacevariable{chemistry}{chemistry}
\setinterfacevariable{cite}{cite}
\setinterfacevariable{closed}{closed}
+\setinterfacevariable{collapsed}{collapsed}
\setinterfacevariable{color}{farbe}
\setinterfacevariable{column}{column}
\setinterfacevariable{columns}{spalten}
@@ -392,6 +393,7 @@
\setinterfacevariable{nostopper}{nostopper}
\setinterfacevariable{not}{nicht}
\setinterfacevariable{notation}{notation}
+\setinterfacevariable{notcollapsed}{notcollapsed}
\setinterfacevariable{note}{note}
\setinterfacevariable{nothanging}{nothanging}
\setinterfacevariable{nothyphenated}{nothyphenated}
@@ -761,6 +763,7 @@
\setinterfaceconstant{coupling}{verknuepfung}
\setinterfaceconstant{couplingway}{verkopplungsart}
\setinterfaceconstant{criterium}{kriterium}
+\setinterfaceconstant{crop}{crop}
\setinterfaceconstant{cropoffset}{cropoffset}
\setinterfaceconstant{crossreference}{crossreference}
\setinterfaceconstant{cssfile}{cssfile}
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index a513f273c..4da2120ac 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.05.21 15:02}
+\newcontextversion{2021.05.25 17:54}
%D This file is loaded at runtime, thereby providing an excellent place for hacks,
%D patches, extensions and new features. There can be local overloads in cont-loc
diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv
index 6bdb7a44f..fc125ac9d 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.05.21 15:02}
+\edef\contextversion{2021.05.25 17:54}
%D Kind of special:
diff --git a/tex/context/base/mkiv/lxml-tex.lua b/tex/context/base/mkiv/lxml-tex.lua
index 7a79ee15f..73ad1b684 100644
--- a/tex/context/base/mkiv/lxml-tex.lua
+++ b/tex/context/base/mkiv/lxml-tex.lua
@@ -772,6 +772,8 @@ local tex_element
if tokenizedxmlw then
+-- local expandmacro = token.expandmacro
+
tex_element = function(e,handlers)
if setfilename then
syncfilename(e,"element")
@@ -793,6 +795,10 @@ if tokenizedxmlw then
addindex(rootname,false,true)
ix = e.ix
end
+-- lmtx only, same performance, a bit more immediate:
+--
+-- expandmacro(tokenizedxmlw,ctxcatcodes,true,command,true,rootname.."::"..ix)
+--
contextsprint(ctxcatcodes,tokenizedxmlw,"{",command,"}{",rootname,"::",ix,"}")
else
report_lxml("fatal error: no index for %a",command)
diff --git a/tex/context/base/mkiv/page-mix.lua b/tex/context/base/mkiv/page-mix.lua
index 443f25e56..374ba8866 100644
--- a/tex/context/base/mkiv/page-mix.lua
+++ b/tex/context/base/mkiv/page-mix.lua
@@ -59,7 +59,7 @@ local getnext = nuts.getnext
local getprev = nuts.getprev
local getid = nuts.getid
local getlist = nuts.getlist
-local getsubtype = nuts.getsubtype
+local getindex = nuts.getindex
local getbox = nuts.getbox
local getattr = nuts.getattr
local getwhd = nuts.getwhd
@@ -121,7 +121,7 @@ local function collectinserts(result,nxt,nxtid)
i = i + 1
result.i = i
inserttotal = inserttotal + getheight(nxt) -- height includes depth (hm, still? needs checking)
- local s = getsubtype(nxt)
+ local s = getindex(nxt)
local c = inserts[s]
if trace_details then
report_state("insert of class %s found",s)
@@ -987,7 +987,8 @@ local function getsplit(result,n)
setdepth(list[i],0)
end
local b = vpack(l) -- multiple arguments, todo: fastvpack
- setbox("global",c,b) -- when we wrap in a box
+-- setbox("global",c,b) -- when we wrap in a box
+ tex.setinsertcontent(c,tonode(b)) -- when we wrap in a box
r.inserts[c] = nil
end
diff --git a/tex/context/base/mkiv/publ-imp-apa.mkvi b/tex/context/base/mkiv/publ-imp-apa.mkvi
index c7c00fd14..b4ac74258 100644
--- a/tex/context/base/mkiv/publ-imp-apa.mkvi
+++ b/tex/context/base/mkiv/publ-imp-apa.mkvi
@@ -1078,8 +1078,10 @@
\btxlabeltext{In}
\btxspace
\doifnot {\btxfoundname{author}} {editor} {
- \texdefinition{btx:apa:author-or-editor} {ineditor}
- \btxcomma
+ \btxdoif {ineditor} {
+ \texdefinition{btx:apa:author-or-editor} {ineditor}
+ \btxcomma
+ }
}
\texdefinition{btx:apa:composed-title}{booktitle}
\btxperiod
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 2808e32c9..3d147ca42 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 40d298100..a334340d1 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-not.mkvi b/tex/context/base/mkiv/strc-not.mkvi
index f29cb38ba..469a57a15 100644
--- a/tex/context/base/mkiv/strc-not.mkvi
+++ b/tex/context/base/mkiv/strc-not.mkvi
@@ -24,9 +24,6 @@
\ifdefined\dotagsetnotesymbol \else \let\dotagsetnotesymbol\relax \fi
\ifdefined\dotagsetnotation \else \let\dotagsetnotation \relax \fi
-\unexpanded\def\unvboxed {\ifvmode\unvbox \else\box \fi} % will change or used more often
-\unexpanded\def\unvcopied{\ifvmode\unvcopy\else\copy\fi} % will change or used more often
-
%D \LMTX\ testcase:
%D
%D \starttyping
@@ -1507,7 +1504,12 @@
{\starthboxestohbox
\iftrialtypesetting\unvcopy\else\unvbox\fi\currentnoteinsertionnumber
\stophboxestohbox}}
- {\iftrialtypesetting\unvcopied\else\unvboxed\fi\currentnoteinsertionnumber}%
+ {\iftrialtypesetting
+ \ifvmode\unvcopy\else\copy\fi
+ \else
+ \ifvmode\unvbox \else\box \fi
+ \fi
+ \currentnoteinsertionnumber}%
\endgroup}
%D Supporting end notes is surprisingly easy. Even better, we can combine this
diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl
index b1501f5d9..3ed69d37f 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.05.21 15:02}
+\newcontextversion{2021.05.25 17:54}
%D This file is loaded at runtime, thereby providing an excellent place for hacks,
%D patches, extensions and new features. There can be local overloads in cont-loc
diff --git a/tex/context/base/mkxl/context.mkxl b/tex/context/base/mkxl/context.mkxl
index 208848803..415b20acd 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.05.21 15:02}
+\immutable\edef\contextversion{2021.05.25 17:54}
%overloadmode 1 % check frozen / warning
%overloadmode 2 % check frozen / error
diff --git a/tex/context/base/mkxl/lang-hyp.mkxl b/tex/context/base/mkxl/lang-hyp.mkxl
index bf3e253dc..ae8b84dcb 100644
--- a/tex/context/base/mkxl/lang-hyp.mkxl
+++ b/tex/context/base/mkxl/lang-hyp.mkxl
@@ -62,15 +62,29 @@
\installcorenamespace{hyphenation}
\installcorenamespace{hyphenationfeatures}
-\installparameterhandler \??hyphenation {hyphenation}
-\installsetuphandler \??hyphenation {hyphenation}
+\installparameterhandler \??hyphenation {hyphenation}
+\installrootparameterhandler \??hyphenation {hyphenation}
+\installsetuphandler \??hyphenation {hyphenation}
+
+% \installbasicsetuphandler \??hyphenation {hyphenation}
\setuphyphenation
[\c!method=\s!default,
+ \c!hyphens=\v!yes,
\s!righthyphenchar=0, % number tzt g: etc
\s!lefthyphenchar=0] % number
\appendtoks
+ % \edef\p_hyphens{\roothyphenationparameter\c!hyphens}%
+ \edef\p_hyphens{\hyphenationparameter\c!hyphens}%
+ \ifx\p_hyphens\v!no
+ \nohyphencollapsing
+ \else
+ \dohyphencollapsing
+ \fi
+\to \everysetuphyphenation
+
+\appendtoks
\clf_sethyphenationmethod{\hyphenationparameter\c!method}%
\to \everysetuphyphenation
diff --git a/tex/context/base/mkxl/lang-ini.mkxl b/tex/context/base/mkxl/lang-ini.mkxl
index 7e11bc783..02d2407bd 100644
--- a/tex/context/base/mkxl/lang-ini.mkxl
+++ b/tex/context/base/mkxl/lang-ini.mkxl
@@ -482,7 +482,7 @@
\permanent\protected\def\usehyphensparameter#1%
{\edef\p_hyphens{#1\c!hyphens}%
- \ifx\p_hyhens\v!no
+ \ifx\p_hyphens\v!no
\ifbitwiseand\hyphenationmode\collapsehyphenationmodecode
\nohyphens
\else
diff --git a/tex/context/base/mkxl/luat-cnf.lmt b/tex/context/base/mkxl/luat-cnf.lmt
index 2a8d40788..72e76fb23 100644
--- a/tex/context/base/mkxl/luat-cnf.lmt
+++ b/tex/context/base/mkxl/luat-cnf.lmt
@@ -187,7 +187,7 @@ end)
local keys = {
"buffersize", "expandsize", "filesize", "fontsize", "hashsize", "inputsize",
- "languagesize", "marksize", "nestsize", "nodesize", "parametersize", "poolsize",
+ "languagesize", "marksize", "insertsize", "nestsize", "nodesize", "parametersize", "poolsize",
"savesize", "stringsize", "tokensize", "errorlinesize", "halferrorlinesize",
}
diff --git a/tex/context/base/mkxl/luat-run.lmt b/tex/context/base/mkxl/luat-run.lmt
index 8a9593f3f..075f5bd62 100644
--- a/tex/context/base/mkxl/luat-run.lmt
+++ b/tex/context/base/mkxl/luat-run.lmt
@@ -83,12 +83,14 @@ local function stop_run()
end
end
-local function start_shipout_page()
+-- watch out for synctex here:
+
+function callbacks.functions.start_page_number()
synctex.start()
logs.start_page_number()
end
-local function stop_shipout_page()
+function callbacks.functions.stop_page_number()
logs.stop_page_number()
for i=1,#pageactions do
pageactions[i]()
@@ -96,12 +98,6 @@ local function stop_shipout_page()
synctex.stop()
end
-local function report_output_pages()
-end
-
-local function report_output_log()
-end
-
local function pre_dump_actions()
for i=1,#dumpactions do
dumpactions[i]()
@@ -158,35 +154,10 @@ appendaction(wrapupactions,"system",synctex.wrapup)
-- this can be done later
-callbacks.register('start_run', start_run, "actions performed at the beginning of a run")
-callbacks.register('stop_run', stop_run, "actions performed at the end of a run")
-
----------.register('show_open', show_open, "actions performed when opening a file")
----------.register('show_close', show_close, "actions performed when closing a file")
-
-callbacks.register('report_output_pages', report_output_pages, "actions performed when reporting pages")
-callbacks.register('report_output_log', report_output_log, "actions performed when reporting log file")
-
----------.register('start_page_number', start_shipout_page, "actions performed at the beginning of a shipout")
----------.register('stop_page_number', stop_shipout_page, "actions performed at the end of a shipout")
-
-callbacks.register('start_page_number', function() end, "actions performed at the beginning of a shipout")
-callbacks.register('stop_page_number', function() end, "actions performed at the end of a shipout")
-
-callbacks.register('process_input_buffer', false, "actions performed when reading data")
-callbacks.register('process_output_buffer', false, "actions performed when writing data")
-
-callbacks.register("pre_dump", pre_dump_actions, "lua related finalizers called before we dump the format") -- comes after \everydump
-
--- finish_synctex might go away (move to wrapup_run)
-
-callbacks.register("finish_synctex", wrapup_synctex, "rename temporary synctex file")
-callbacks.register('wrapup_run', wrapup_run, "actions performed after closing files")
-
--- temp hack for testing:
-
-callbacks.functions.start_page_number = start_shipout_page
-callbacks.functions.stop_page_number = stop_shipout_page
+callbacks.register('start_run', start_run, "actions performed at the beginning of a run")
+callbacks.register('stop_run', stop_run, "actions performed at the end of a run")
+callbacks.register("pre_dump", pre_dump_actions, "lua related finalizers called before we dump the format") -- comes after \everydump
+callbacks.register('wrapup_run', wrapup_run, "actions performed after closing files")
-- an example:
diff --git a/tex/context/base/mkxl/node-fin.lmt b/tex/context/base/mkxl/node-fin.lmt
index 464f17f83..ae5d0eac5 100644
--- a/tex/context/base/mkxl/node-fin.lmt
+++ b/tex/context/base/mkxl/node-fin.lmt
@@ -36,9 +36,10 @@ local setlist = nuts.setlist
local setleader = nuts.setleader
local copy_node = nuts.copy
-local find_tail = nuts.tail
+----- find_tail = nuts.tail
local insertnodebefore = nuts.insertbefore
local insertnodeafter = nuts.insertafter
+local appendaftertail = nuts.appendaftertail
local nextnode = nuts.traversers.node
local nextcontent = nuts.traversers.content
@@ -64,8 +65,8 @@ local texgetnest = tex.getnest
local states = attributes.states
local numbers = attributes.numbers
-local a_trigger = attributes.private('trigger')
-local triggering = false
+----- a_trigger = attributes.private('trigger')
+----- triggering = false
local implement = interfaces.implement
@@ -139,7 +140,7 @@ end
-- the injectors
-local nsdata, nsnone, nslistwise, nsforced, nsselector, nstrigger
+local nsdata, nsnone, nslistwise, nsforced, nsselector -- , nstrigger
local current, current_selector = 0, 0 -- nb, stack has a local current !
local nsbegin, nsend, nsreset
@@ -149,7 +150,7 @@ function states.initialize(namespace,attribute,head)
nsforced = namespace.forced
nsselector = namespace.selector
nslistwise = namespace.listwise
- nstrigger = triggering and namespace.triggering and a_trigger
+ -- nstrigger = triggering and namespace.triggering and a_trigger
current = 0
current_selector = 0
nsstep = namespace.resolve_step
@@ -168,15 +169,15 @@ function states.finalize(namespace,attribute,head) -- is this one ok?
if id == hlist_code or id == vlist_code then
local content = getlist(head)
if content then
--- local list = insertnodebefore(content,content,copy_node(nsnone)) -- two return values
- local list = insertnodeafter(content,find_tail(content),copy_node(nsnone)) -- two return values
- if list ~= content then
- setlist(head,list)
- end
+-- local list = insertnodeafter(content,find_tail(content),copy_node(nsnone)) -- two return values
+-- if list ~= content then
+-- setlist(head,list)
+-- end
+ appendaftertail(content,copy_node(nsnone))
end
else
--- head = insertnodebefore(head,head,copy_node(nsnone))
- head = insertnodeafter(find_tail(head),head,copy_node(nsnone))
+-- head = insertnodeafter(find_tail(head),head,copy_node(nsnone))
+ appendaftertail(head,copy_node(nsnone))
end
return head, true
end
@@ -198,8 +199,8 @@ local function process(attribute,head,inheritance,default) -- one attribute
-- tricky checking
local outer
if subtype == container_code then
- check = true
-current = 0
+ check = true
+ current = 0
end
if getorientation(stack) then
outer = getattr(stack,attribute)
@@ -224,19 +225,22 @@ current = 0
end
end
-- begin nested --
- local list
- if nstrigger and getattr(stack,nstrigger) then
- if not outer then
- outer = getattr(stack,attribute)
- end
- if outer ~= inheritance then
- list = process(attribute,content,inheritance,outer)
- else
- list = process(attribute,content,inheritance,default)
- end
- else
- list = process(attribute,content,inheritance,default)
- end
+ --
+ -- local list
+ -- if nstrigger and getattr(stack,nstrigger) then
+ -- if not outer then
+ -- outer = getattr(stack,attribute)
+ -- end
+ -- if outer ~= inheritance then
+ -- list = process(attribute,content,inheritance,outer)
+ -- else
+ -- list = process(attribute,content,inheritance,default)
+ -- end
+ -- else
+ -- list = process(attribute,content,inheritance,default)
+ -- end
+ --
+ local list = process(attribute,content,inheritance,default)
if content ~= list then
setlist(stack,list)
end
@@ -267,17 +271,20 @@ current = 0
current = 0
end
-- begin nested --
- local list
- if nstrigger and getattr(stack,nstrigger) then
- local outer = getattr(stack,attribute)
- if outer ~= inheritance then
- list = process(attribute,leader,inheritance,outer)
- else
- list = process(attribute,leader,inheritance,default)
- end
- else
- list = process(attribute,leader,inheritance,default)
- end
+ --
+ -- local list
+ -- if nstrigger and getattr(stack,nstrigger) then
+ -- local outer = getattr(stack,attribute)
+ -- if outer ~= inheritance then
+ -- list = process(attribute,leader,inheritance,outer)
+ -- else
+ -- list = process(attribute,leader,inheritance,default)
+ -- end
+ -- else
+ -- list = process(attribute,leader,inheritance,default)
+ -- end
+ --
+ local list = process(attribute,leader,inheritance,default)
if leader ~= list then
setleader(stack,list)
end
@@ -552,19 +559,22 @@ current = 0
end
end
-- begin nested
- local list
- if nstrigger and getattr(stack,nstrigger) then
- if not outer then
- outer = getattr(stack,attribute)
- end
- if outer ~= inheritance then
- list = selective(attribute,content,inheritance,outer)
- else
- list = selective(attribute,content,inheritance,default)
- end
- else
- list = selective(attribute,content,inheritance,default)
- end
+ --
+ -- local list
+ -- if nstrigger and getattr(stack,nstrigger) then
+ -- if not outer then
+ -- outer = getattr(stack,attribute)
+ -- end
+ -- if outer ~= inheritance then
+ -- list = selective(attribute,content,inheritance,outer)
+ -- else
+ -- list = selective(attribute,content,inheritance,default)
+ -- end
+ -- else
+ -- list = selective(attribute,content,inheritance,default)
+ -- end
+ --
+ local list = selective(attribute,content,inheritance,default)
if content ~= list then
setlist(stack,list)
end
@@ -594,17 +604,20 @@ current = 0
end
if leader then
-- begin nested
- local list
- if nstrigger and getattr(stack,nstrigger) then
- local outer = getattr(stack,attribute)
- if outer ~= inheritance then
- list = selective(attribute,leader,inheritance,outer)
- else
- list = selective(attribute,leader,inheritance,default)
- end
- else
- list = selective(attribute,leader,inheritance,default)
- end
+ --
+ -- local list
+ -- if nstrigger and getattr(stack,nstrigger) then
+ -- local outer = getattr(stack,attribute)
+ -- if outer ~= inheritance then
+ -- list = selective(attribute,leader,inheritance,outer)
+ -- else
+ -- list = selective(attribute,leader,inheritance,default)
+ -- end
+ -- else
+ -- list = selective(attribute,leader,inheritance,default)
+ -- end
+ --
+ local list = selective(attribute,leader,inheritance,default)
if leader ~= list then
setleader(stack,list)
end
diff --git a/tex/context/base/mkxl/node-fin.mkxl b/tex/context/base/mkxl/node-fin.mkxl
index 6840c85ab..8e6a11edc 100644
--- a/tex/context/base/mkxl/node-fin.mkxl
+++ b/tex/context/base/mkxl/node-fin.mkxl
@@ -21,58 +21,53 @@
\permanent\protected\def\finalizeobjectbox #1{\clf_finalizebox#1\relax}
\permanent\protected\def\finalizeshipoutbox#1{\clf_finalizebox#1\relax}
-% Experimental (for Aditya), not in mkxl, if we need it, it has to be more
-% clever.
-
-% \permanent\protected\def\cleanupbox#1{\clf_cleanupbox#1\relax}
-
-% Tricky stuff: this might become obsolete. It is about time to check this out
-% now (after more than a decade)! The few times that we need this we can better
-% copy some of the sensitive attributes (mostly color).
-
-\definesystemattribute[trigger][public]
-
-\newcount\c_syst_attr_trigger
-
-\permanent\edef\startinheritattributes{\c_attr_trigger\plusone}
-\permanent\edef\stopinheritattributes {\c_attr_trigger\attributeunsetvalue}
-
-\permanent\def\syst_attr_trigger_copy_yes{\afterassignment\syst_attr_trigger_copy_indeed\c_syst_attr_trigger}
-\permanent\def\syst_attr_trigger_dump_yes{\afterassignment\syst_attr_trigger_dump_indeed\c_syst_attr_trigger}
-
-\def\syst_attr_trigger_copy_indeed
- {\ifvbox\c_syst_attr_trigger
- \vpack attr \triggerattribute \plusone {\unvcopy\c_syst_attr_trigger}%
- \else
- \hpack attr \triggerattribute \plusone {\unhcopy\c_syst_attr_trigger}%
- \fi}
-
-\def\syst_attr_trigger_dump_indeed
- {\ifvbox\c_syst_attr_trigger
- \vpack attr \triggerattribute \plusone {\unvbox\c_syst_attr_trigger}%
- \else
- \hpack attr \triggerattribute \plusone {\unhbox\c_syst_attr_trigger}%
- \fi}
-
-\permanent\protected\def\enableattributeinheritance
- {\clf_enablestatetriggering
- \enforced\let\attributedcopy\syst_attr_trigger_copy_yes
- \enforced\let\attributedbox \syst_attr_trigger_dump_yes}
-
-\permanent\protected\def\disableattributeinheritance
- {\clf_disablestatetriggering
- \enforced\let\attributedcopy\copy
- \enforced\let\attributedbox \box}
-
-\disableattributeinheritance
-
-\installtexdirective
- {attributes.inheritance}
- {\enableattributeinheritance}
- {\disableattributeinheritance}
-
-% \appendtoks
-% \enableattributeinheritance % might become default
-% \to\everyjob
+% % Tricky stuff: this might become obsolete. It is about time to check this out
+% % now (after more than a decade)! The few times that we need this we can better
+% % copy some of the sensitive attributes (mostly color).
+%
+% \definesystemattribute[trigger][public]
+%
+% \newcount\c_syst_attr_trigger
+%
+% \permanent\edef\startinheritattributes{\c_attr_trigger\plusone}
+% \permanent\edef\stopinheritattributes {\c_attr_trigger\attributeunsetvalue}
+%
+% \permanent\def\syst_attr_trigger_copy_yes{\afterassignment\syst_attr_trigger_copy_indeed\c_syst_attr_trigger}
+% \permanent\def\syst_attr_trigger_dump_yes{\afterassignment\syst_attr_trigger_dump_indeed\c_syst_attr_trigger}
+%
+% \def\syst_attr_trigger_copy_indeed
+% {\ifvbox\c_syst_attr_trigger
+% \vpack attr \triggerattribute \plusone {\unvcopy\c_syst_attr_trigger}%
+% \else
+% \hpack attr \triggerattribute \plusone {\unhcopy\c_syst_attr_trigger}%
+% \fi}
+%
+% \def\syst_attr_trigger_dump_indeed
+% {\ifvbox\c_syst_attr_trigger
+% \vpack attr \triggerattribute \plusone {\unvbox\c_syst_attr_trigger}%
+% \else
+% \hpack attr \triggerattribute \plusone {\unhbox\c_syst_attr_trigger}%
+% \fi}
+%
+% \permanent\protected\def\enableattributeinheritance
+% {\clf_enablestatetriggering
+% \enforced\let\attributedcopy\syst_attr_trigger_copy_yes
+% \enforced\let\attributedbox \syst_attr_trigger_dump_yes}
+%
+% \permanent\protected\def\disableattributeinheritance
+% {\clf_disablestatetriggering
+% \enforced\let\attributedcopy\copy
+% \enforced\let\attributedbox \box}
+%
+% \disableattributeinheritance
+%
+% \installtexdirective
+% {attributes.inheritance}
+% {\enableattributeinheritance}
+% {\disableattributeinheritance}
+%
+% % \appendtoks
+% % \enableattributeinheritance % might become default
+% % \to\everyjob
\protect \endinput
diff --git a/tex/context/base/mkxl/node-met.lmt b/tex/context/base/mkxl/node-met.lmt
index f24200e97..72f4cf844 100644
--- a/tex/context/base/mkxl/node-met.lmt
+++ b/tex/context/base/mkxl/node-met.lmt
@@ -84,6 +84,8 @@ nodes.hasattribute = node.hasattribute
nodes.hasfield = node.hasfield
nodes.insertafter = node.insertafter
nodes.insertbefore = node.insertbefore
+-----.appendafter = node.appendafter
+-----.prependbefore = node.prependbefore
nodes.isnode = node.isnode
nodes.isdirect = node.isdirect
nodes.isnut = node.isdirect
diff --git a/tex/context/base/mkxl/node-nut.lmt b/tex/context/base/mkxl/node-nut.lmt
index c9903e4e3..27c65c5b5 100644
--- a/tex/context/base/mkxl/node-nut.lmt
+++ b/tex/context/base/mkxl/node-nut.lmt
@@ -99,6 +99,7 @@ local nuts = {
getglyphdimensions = direct.getglyphdimensions,
getheight = direct.getheight,
getid = d_getid,
+ getindex = direct.getindex,
getkern = direct.getkern,
getkerndimension = direct.getkerndimension,
getlang = direct.getlanguage,-- will become obsolete
@@ -146,6 +147,8 @@ local nuts = {
ignoremathskip = direct.ignoremathskip,
insertafter = d_insertafter,
insertbefore = d_insertbefore,
+ appendaftertail = direct.appendaftertail,
+ prependbeforehead = direct.prependbeforehead,
isdirect = isdirect,
isnode = isnode,
isnut = isdirect,
@@ -173,7 +176,6 @@ local nuts = {
remove = d_remove_node,
reverse = direct.reverse,
setattr = direct.setattribute,
- setattr = direct.setattribute,
setattribute = direct.setattribute,
setattributelist = direct.setattributelist,
setattrlist = direct.setattributelist,
diff --git a/tex/context/base/mkxl/node-pro.lmt b/tex/context/base/mkxl/node-pro.lmt
index 9dcb2ffa8..0376292a2 100644
--- a/tex/context/base/mkxl/node-pro.lmt
+++ b/tex/context/base/mkxl/node-pro.lmt
@@ -19,164 +19,76 @@ local tonut = nodes.tonut
nodes.processors = nodes.processors or { }
local processors = nodes.processors
--- vbox: grouptype: vbox vtop output split_off split_keep | box_type: exactly|aditional
--- hbox: grouptype: hbox adjusted_hbox(=hbox_in_vmode) | box_type: exactly|aditional
+local tasks = nodes.tasks
+
+local report_nodes = logs.reporter("nodes","processors")
-local actions = tasks.actions("processors")
+local countnodes = nuts.countall
do
- local n = 0
-
local function reconstruct(head)
- return nodes.listtoutf(head,"",false,nil,true)
+ return ",stream : " .. nodes.listtoutf(head,"",false,nil,true)
end
- function processors.tracer(what,head,groupcode,before,after,show)
- if not groupcode then
- groupcode = "unknown"
- elseif groupcode == "" then
- groupcode = "mvl"
- end
- n = n + 1
- if show then
- report_nodes("%s: location %a, group %a, # before %a, # after %s, stream: %s",what,n,groupcode,before,after,reconstruct(head))
- else
- report_nodes("%s: location %a, group %a, # before %a, # after %s",what,n,groupcode,before,after)
- end
- end
+ local before = nil
+ local count = 0
+ local show = false
-end
-
--- do
---
--- local count_nodes = nodes.countall
--- local texget = tex.get
--- local tracer = processors.tracer
---
--- local function pre_linebreak_filter(head,groupcode)
--- if trace_callbacks then
--- local before = count_nodes(head,true)
--- head = actions(head,groupcode)
--- local after = count_nodes(head,true)
--- tracer("pre_linebreak",head,groupcode,before,after,true)
--- else
--- head = actions(head,groupcode)
--- end
--- return head
--- end
---
--- local function hpack_filter(head,groupcode,size,packtype,direction,attributes)
--- if not direction then
--- direction = texget("textdir")
--- end
--- --
--- if trace_callbacks then
--- local before = count_nodes(head,true)
--- head = actions(head,groupcode,size,packtype,direction,attributes)
--- local after = count_nodes(head,true)
--- tracer("hpack",head,groupcode,before,after,true)
--- else
--- head = actions(head,groupcode,size,packtype,direction,attributes)
--- end
--- return head
--- end
---
--- processors.pre_linebreak_filter = pre_linebreak_filter
--- processors.hpack_filter = hpack_filter
---
--- do
---
--- local hpack = nodes.hpack
---
--- function nodes.fullhpack(head,...)
--- return hpack((hpack_filter(head)),...)
--- end
---
--- end
---
--- do
---
--- local hpack = nuts.hpack
---
--- function nuts.fullhpack(head,...)
--- return hpack(tonut(hpack_filter(tonode(head))),...)
--- end
---
--- end
---
--- callbacks.register('pre_linebreak_filter', pre_linebreak_filter, "horizontal manipulations (before par break)")
--- callbacks.register('hpack_filter' , hpack_filter, "horizontal manipulations (before hbox creation)")
---
--- end
-
-do
-
- local count_nodes = nodes.countall
- local texget = tex.get
- local tracer = processors.tracer
- local hbox_code = tex.groupcodes.hbox
-
- local function glyph_run(head,groupcode,direction)
- if not groupcode then
- groupcode = hbox_code
- end
- if trace_callbacks then
- local before = count_nodes(head,true)
- head = actions(head,groupcode,direction)
- local after = count_nodes(head,true)
- tracer("glyph_run",head,groupcode,before,after,true)
- else
- head = actions(head,groupcode,direction)
- end
- return head
+ function processors.trace_glyph_run_b(head,groupcode)
+ count = count + 1
+ before = countnodes(head)
end
- processors.glyph_run = glyph_run
-
- do
- local hpack = nodes.hpack
- function nodes.fullhpack(head,...)
- return hpack((glyph_run(head)),...)
- end
+ function processors.trace_glyph_run_a(head,groupcode)
+ report_nodes("processors: run %i, group %a, # before %a, # after %s%s",
+ count,groupcode,before,countnodes(head),
+ show and reconstruct(head) or ""
+ )
+ before = false
end
- do
- local hpack = nuts.hpack
- function nuts.fullhpack(head,...)
- return hpack(tonut(glyph_run(tonode(head))),...)
+ trackers.register("nodes.callbacks", function(v)
+ if not v then
+ disableaction("processors","nodes.processors.trace_glyph_run_b")
+ disableaction("processors","nodes.processors.trace_glyph_run_a")
+ elseif before == nil then
+ prependaction("processors","before","nodes.processors.trace_glyph_run_b",nil,"nonut","enabled")
+ appendaction ("processors","after", "nodes.processors.trace_glyph_run_a",nil,"nonut","enabled")
+ before = false
+ else
+ enableaction("processors","nodes.processors.trace_glyph_run_b")
+ enableaction("processors","nodes.processors.trace_glyph_run_a")
+ show = v == "detail"
end
- end
-
- callbacks.register("glyph_run", glyph_run, "glyph processing")
+ end)
end
-do
- -- Beware, these are packaged boxes so no firstglyph test needed. Maybe some day I'll add a hash
- -- with valid groupcodes. Watch out, much can pass twice, for instance vadjust passes two times,
+local glyph_run = tasks.actions("processors")
+local pre_linebreak_filter = tasks.actions("paragraphs")
+local post_linebreak_filter = tasks.actions("finalizers")
- local actions = tasks.actions("finalizers") -- head, where
- local count_nodes = nodes.countall
+processors.glyph_run = glyph_run
+processors.pre_linebreak_filter = pre_linebreak_filter
+processors.post_linebreak_filter = post_linebreak_filter
- local tracer = processors.tracer
+callbacks.register("glyph_run", glyph_run, "glyph processing")
+callbacks.register("pre_linebreak_filter", pre_linebreak_filter, "horizontal manipulations (before par break)")
+callbacks.register("post_linebreak_filter",post_linebreak_filter,"horizontal manipulations (after par break)")
- local function post_linebreak_filter(head,groupcode)
- if trace_callbacks then
- local before = count_nodes(head,true)
- head = actions(head,groupcode)
- local after = count_nodes(head,true)
- tracer("post_linebreak",head,groupcode,before,after,true)
- else
- head = actions(head,groupcode)
- end
- return head
- end
+do
+ local hpack = nodes.hpack
- processors.post_linebreak_filter = post_linebreak_filter
+ function nodes.fullhpack(head,...)
+ return hpack((glyph_run(head)),...)
+ end
- callbacks.register("post_linebreak_filter", post_linebreak_filter,"horizontal manipulations (after par break)")
+ local hpack = nuts.hpack
+ function nuts.fullhpack(head,...)
+ return hpack(tonut(glyph_run(tonode(head))),...)
+ end
end
do
diff --git a/tex/context/base/mkxl/node-syn.lmt b/tex/context/base/mkxl/node-syn.lmt
index 5cf59caad..79ffced25 100644
--- a/tex/context/base/mkxl/node-syn.lmt
+++ b/tex/context/base/mkxl/node-syn.lmt
@@ -143,25 +143,22 @@ local getlist = nuts.getlist
local setlist = nuts.setlist
local getnext = nuts.getnext
local getwhd = nuts.getwhd
-local getwidth = nuts.getwidth
local getsubtype = nuts.getsubtype
local nodecodes = nodes.nodecodes
local kerncodes = nodes.kerncodes
+local nextnode = nuts.traversers.node
+
local glyph_code = nodecodes.glyph
local disc_code = nodecodes.disc
local glue_code = nodecodes.glue
local penalty_code = nodecodes.penalty
local kern_code = nodecodes.kern
------ rule_code = nodecodes.rule
local hlist_code = nodecodes.hlist
local vlist_code = nodecodes.vlist
-local dir_code = nodecodes.dir
local fontkern_code = kerncodes.fontkern
-local cancel_code = nodes.dircodes.cancel
-
local insertbefore = nuts.insertbefore
local insertafter = nuts.insertafter
@@ -335,6 +332,7 @@ local function flushpreamble()
makenames()
filehandle = openfile(tmpfile,"wb")
if filehandle then
+filehandle:setvbuf("full",64*1024)
filehandle:write("SyncTeX Version:1",eol)
writefiles()
filehandle:write("Output:pdf",eol)
@@ -373,22 +371,60 @@ local function flushpostamble()
enabled = false
end
+-- local x_hlist do
+--
+-- local function doaction_1(t,l,w,h,d)
+-- local pagewidth, pageheight = getpagedimensions()
+-- local x, y = getpos()
+-- filehandle:write(f_hlist_1(t,l,x,pageheight-y,w,h,d))
+-- nofobjects = nofobjects + 1
+-- end
+--
+-- local lasty = false
+--
+-- local function doaction_2(t,l,w,h,d)
+-- local pagewidth, pageheight = getpagedimensions()
+-- local x, y = getpos()
+-- y = pageheight - y
+-- filehandle:write(f_hlist_2(t,l,x,y == lasty and "=" or y,w,h,d))
+-- lasty = y
+-- nofobjects = nofobjects + 1
+-- end
+--
+-- local doaction = doaction_1
+--
+-- x_hlist = function(head,current,t,l,w,h,d)
+-- if filehandle then
+-- return insertbefore(head,current,new_latelua(function() doaction(t,l,w,h,d) end))
+-- else
+-- return head
+-- end
+-- end
+--
+-- directives.register("system.synctex.compression", function(v)
+-- doaction = tonumber(v) == 2 and doaction_2 or doaction_1
+-- end)
+--
+-- end
+
+-- local pagewidth, pageheight
+
local x_hlist do
- local function doaction_1(t,l,w,h,d)
+ local function doaction_1(data)
local pagewidth, pageheight = getpagedimensions()
local x, y = getpos()
- filehandle:write(f_hlist_1(t,l,x,pageheight-y,w,h,d))
+ filehandle:write(f_hlist_1(data[1],data[2],x,pageheight-y,data[3],data[4],data[5]))
nofobjects = nofobjects + 1
end
local lasty = false
- local function doaction_2(t,l,w,h,d)
+ local function doaction_2(data)
local pagewidth, pageheight = getpagedimensions()
local x, y = getpos()
y = pageheight - y
- filehandle:write(f_hlist_2(t,l,x,y == lasty and "=" or y,w,h,d))
+ filehandle:write(f_hlist_2(t[1],data[2],x,y == lasty and "=" or y,data[3],data[3],data[5]))
lasty = y
nofobjects = nofobjects + 1
end
@@ -397,7 +433,7 @@ local x_hlist do
x_hlist = function(head,current,t,l,w,h,d)
if filehandle then
- return insertbefore(head,current,new_latelua(function() doaction(t,l,w,h,d) end))
+ return insertbefore(head,current,new_latelua { action = doaction, t, l, w, h, d })
else
return head
end
@@ -440,44 +476,85 @@ local function inject(head,first,last,tag,line)
return head
end
+-- local function collect_min(head)
+-- local current = head
+-- while current do
+-- local id = getid(current)
+-- if id == glyph_code then
+-- local first = current
+-- local last = current
+-- local tag = 0
+-- local line = 0
+-- while true do
+-- if id == glyph_code then
+-- local tc, lc = getsynctexfields(current)
+-- if tc and tc > 0 then
+-- tag = tc
+-- line = lc
+-- end
+-- last = current
+-- elseif id == disc_code or (id == kern_code and getsubtype(current) == fontkern_code) then
+-- last = current
+-- else
+-- if tag > 0 then
+-- head = inject(head,first,last,tag,line)
+-- end
+-- break
+-- end
+-- current = getnext(current)
+-- if current then
+-- id = getid(current)
+-- else
+-- if tag > 0 then
+-- head = inject(head,first,last,tag,line)
+-- end
+-- return head
+-- end
+-- end
+-- end
+-- -- pick up (as id can have changed)
+-- if id == hlist_code or id == vlist_code then
+-- local list = getlist(current)
+-- if list then
+-- local l = collect(list)
+-- if l ~= list then
+-- setlist(current,l)
+-- end
+-- end
+-- end
+-- current = getnext(current)
+-- end
+-- return head
+-- end
+
local function collect_min(head)
- local current = head
- while current do
- local id = getid(current)
+ local first = false
+ local last = false
+ local tag = 0
+ local line = 0
+ for current, id, subtype in nextnode, head do
if id == glyph_code then
- local first = current
- local last = current
- local tag = 0
- local line = 0
- while true do
- if id == glyph_code then
- local tc, lc = getsynctexfields(current)
- if tc and tc > 0 then
- tag = tc
- line = lc
- end
- last = current
- elseif id == disc_code or (id == kern_code and getsubtype(current) == fontkern_code) then
- last = current
- else
- if tag > 0 then
- head = inject(head,first,last,tag,line)
- end
- break
- end
- current = getnext(current)
- if current then
- id = getid(current)
- else
- if tag > 0 then
- head = inject(head,first,last,tag,line)
- end
- return head
+ local tc, lc = getsynctexfields(current)
+ if tc and tc > 0 then
+ if tag == 0 then
+ first = current
end
+ tag = tc
+ line = lc
+ last = current
+ elseif tag > 0 then
+ head = inject(head,first,last,tag,line)
+ tag = 0
+ end
+ elseif id == disc_code then
+ last = current
+ elseif id == kern_code and subtype == fontkern_code then
+ last = current
+ elseif id == hlist_code or id == vlist_code then
+ if tag > 0 then
+ head = inject(head,first,last,tag,line)
+ tag = 0
end
- end
- -- pick up (as id can have changed)
- if id == hlist_code or id == vlist_code then
local list = getlist(current)
if list then
local l = collect(list)
@@ -485,8 +562,13 @@ local function collect_min(head)
setlist(current,l)
end
end
+ elseif tag > 0 then
+ head = inject(head,first,last,tag,line)
+ tag = 0
end
- current = getnext(current)
+ end
+ if tag > 0 then
+ head = inject(head,first,last,tag,line)
end
return head
end
@@ -507,93 +589,153 @@ local function inject(parent,head,first,last,tag,line)
return head
end
+-- local function collect_max(head,parent)
+-- local current = head
+-- while current do
+-- local id = getid(current)
+-- if id == glyph_code then
+-- local first = current
+-- local last = current
+-- local tag = 0
+-- local line = 0
+-- while true do
+-- if id == glyph_code then
+-- local tc, lc = getsynctexfields(current)
+-- if tc and tc > 0 then
+-- if tag > 0 and (tag ~= tc or line ~= lc) then
+-- head = inject(parent,head,first,last,tag,line)
+-- first = current
+-- end
+-- tag = tc
+-- line = lc
+-- last = current
+-- else
+-- if tag > 0 then
+-- head = inject(parent,head,first,last,tag,line)
+-- tag = 0
+-- end
+-- first = nil
+-- last = nil
+-- end
+-- elseif id == disc_code then
+-- if not first then
+-- first = current
+-- end
+-- last = current
+-- elseif id == kern_code and getsubtype(current) == fontkern_code then
+-- if first then
+-- last = current
+-- end
+-- elseif id == glue_code then
+-- if tag > 0 then
+-- local tc, lc = getsynctexfields(current)
+-- if tc and tc > 0 then
+-- if tag ~= tc or line ~= lc then
+-- head = inject(parent,head,first,last,tag,line)
+-- tag = 0
+-- break
+-- end
+-- else
+-- head = inject(parent,head,first,last,tag,line)
+-- tag = 0
+-- break
+-- end
+-- else
+-- tag = 0
+-- break
+-- end
+-- id = nil -- so no test later on
+-- elseif id == penalty_code then
+-- -- go on (and be nice for math)
+-- else
+-- if tag > 0 then
+-- head = inject(parent,head,first,last,tag,line)
+-- tag = 0
+-- end
+-- break
+-- end
+-- current = getnext(current)
+-- if current then
+-- id = getid(current)
+-- else
+-- if tag > 0 then
+-- head = inject(parent,head,first,last,tag,line)
+-- end
+-- return head
+-- end
+-- end
+-- end
+-- -- pick up (as id can have changed)
+-- if id == hlist_code or id == vlist_code then
+-- local list = getlist(current)
+-- if list then
+-- local l = collect(list,current)
+-- if l and l ~= list then
+-- setlist(current,l)
+-- end
+-- end
+-- end
+-- current = getnext(current)
+-- end
+-- return head
+-- end
+
local function collect_max(head,parent)
- local current = head
- while current do
- local id = getid(current)
+ local first = false
+ local last = false
+ local tag = 0
+ local line = 0
+ for current, id, subtype in nextnode, head do
if id == glyph_code then
- local first = current
- local last = current
- local tag = 0
- local line = 0
- while true do
- if id == glyph_code then
- local tc, lc = getsynctexfields(current)
- if tc and tc > 0 then
- if tag > 0 and (tag ~= tc or line ~= lc) then
- head = inject(parent,head,first,last,tag,line)
- first = current
- end
- tag = tc
- line = lc
- last = current
- else
- if tag > 0 then
- head = inject(parent,head,first,last,tag,line)
- tag = 0
- end
- first = nil
- last = nil
- end
- elseif id == disc_code then
- if not first then
+ local tc, lc = getsynctexfields(current)
+ if tc and tc > 0 then
+ if tag == 0 then
+ first = current
+ end
+ tag = tc
+ line = lc
+ last = current
+ elseif tag > 0 then
+ head = inject(parent,head,first,last,tag,line)
+ tag = 0
+ end
+ elseif id == disc_code then
+ last = current
+ elseif id == kern_code and subtype == fontkern_code then
+ last = current
+ elseif id == glue_code then -- in addition to min
+ if tag > 0 then
+ local tc, lc = getsynctexfields(current)
+ if tc and tc > 0 then
+ if tag == 0 then
first = current
end
+ tag = tc
+ line = lc
last = current
- elseif id == kern_code and getsubtype(current) == fontkern_code then
- if first then
- last = current
- end
- elseif id == glue_code then
- if tag > 0 then
- local tc, lc = getsynctexfields(current)
- if tc and tc > 0 then
- if tag ~= tc or line ~= lc then
- head = inject(parent,head,first,last,tag,line)
- tag = 0
- break
- end
- else
- head = inject(parent,head,first,last,tag,line)
- tag = 0
- break
- end
- else
- tag = 0
- break
- end
- id = nil -- so no test later on
- elseif id == penalty_code then
- -- go on (and be nice for math)
else
- if tag > 0 then
- head = inject(parent,head,first,last,tag,line)
- tag = 0
- end
- break
- end
- current = getnext(current)
- if current then
- id = getid(current)
- else
- if tag > 0 then
- head = inject(parent,head,first,last,tag,line)
- end
- return head
+ head = inject(parent,head,first,last,tag,line)
+ tag = 0
end
end
- end
- -- pick up (as id can have changed)
- if id == hlist_code or id == vlist_code then
+ elseif id == penalty_code then -- in addition to min
+ -- go on (and be nice for math)
+ elseif id == hlist_code or id == vlist_code then
+ if tag > 0 then
+ head = inject(parent,head,first,last,tag,line)
+ tag = 0
+ end
local list = getlist(current)
if list then
- local l = collect(list,current)
- if l and l ~= list then
+ local l = collect(list)
+ if l ~= list then
setlist(current,l)
end
end
+ elseif tag > 0 then
+ head = inject(parent,head,first,last,tag,line)
+ tag = 0
end
- current = getnext(current)
end
return head
end
@@ -618,6 +760,7 @@ function synctex.start()
filehandle:write("{",nofsheets,eol)
-- this seems to work:
local pagewidth, pageheight = getpagedimensions()
+-- pagewidth, pageheight = getpagedimensions()
filehandle:write(z_hlist)
filehandle:write(f_vlist_1(0,0,0,pageheight,pagewidth,pageheight,0))
end
@@ -657,6 +800,8 @@ function synctex.enable()
for i=1,#enablers do
enablers[i](true)
end
+ -- we have a different trigger moment in lmtx
+ flushpreamble()
end
end
diff --git a/tex/context/base/mkxl/node-tsk.lmt b/tex/context/base/mkxl/node-tsk.lmt
index 264952102..a06507b15 100644
--- a/tex/context/base/mkxl/node-tsk.lmt
+++ b/tex/context/base/mkxl/node-tsk.lmt
@@ -455,6 +455,57 @@ nonut = [[
}
}
+-- -- paragraphs -- --
+
+tasks.new {
+ name = "paragraphs",
+ processor = nodeprocessor,
+ sequence = {
+ "before", -- for users
+ "lists",
+ "after", -- for users
+ },
+ templates = {
+
+default = [[
+return function(head)
+ return head
+end
+]],
+
+process = [[
+local tonut = nodes.tonut
+local tonode = nodes.nuts.tonode
+
+%localize%
+
+return function(head,groupcode)
+ local nuthead = tonut(head)
+
+%actions%
+ return tonode(nuthead)
+end
+]],
+
+step = [[
+ nuthead = tonut((%action%(tonode(nuthead),groupcode)))
+]],
+
+nut = [[
+ nuthead = %action%(nuthead,groupcode)
+]],
+
+nohead = [[
+ %action%(tonode(nuthead),groupcode)
+]],
+
+nonut = [[
+ %action%(nuthead,groupcode)
+]],
+
+ }
+}
+
-- -- hpackers -- --
-- tasks.new {
diff --git a/tex/context/base/mkxl/page-ins.mkxl b/tex/context/base/mkxl/page-ins.mkxl
index 2ab7449ab..9321b6eac 100644
--- a/tex/context/base/mkxl/page-ins.mkxl
+++ b/tex/context/base/mkxl/page-ins.mkxl
@@ -73,13 +73,6 @@
\protected\def\page_inserts_synchronize_registers
{\currentinsertionnumber\csname\??insertionnumber\currentinsertion\endcsname}
-% for practical reasons we still set these elsewhere but that might change in the future
-%
-% \global\count\currentinsertionnumber\numexpr\insertionparameter\c!factor/\insertionparameter\c!n\relax
-% \global\skip \currentinsertionnumber\insertionparameter\c!distance \relax
-% \global\dimen\currentinsertionnumber\insertionparameter\c!maxheight\relax}
-% \floatingpenalty\zerocount
-
\appendtoks
\ifempty\currentinsertionparent \else
\page_inserts_synchronize_registers
@@ -124,6 +117,50 @@
% pass pass them explicitly. Actually, when we see an insertion node at that end,
% we already know the number.
+% \insertmode\plustwo
+
+% once we made the switch we will use \ifinsert instead of the ht test
+
+\ifnum\insertmode=\plustwo
+
+ \c_syst_min_allocated_insert = 1 % 128
+ \c_syst_max_allocated_insert = 255 % 254
+ \c_syst_last_allocated_insertion = 1 %
+
+ \protected\def\page_inserts_set_limit {\insertlimit}
+ \protected\def\page_inserts_set_distance {\insertdistance}
+ \protected\def\page_inserts_set_multiplier{\insertmultiplier}
+
+ \protected\def\page_inserts_get_limit {\insertlimit}
+ \protected\def\page_inserts_get_distance {\insertdistance}
+ \protected\def\page_inserts_get_multiplier{\insertmultiplier}
+
+ \protected\def\page_inserts_get_boxed {\insertbox}
+ \protected\def\page_inserts_get_copied {\insertcopy}
+ \protected\def\page_inserts_get_unboxed {\insertunbox}
+ \protected\def\page_inserts_get_uncopied {\insertuncopy}
+
+ \protected\def\page_inserts_get_height {\insertheight}
+
+\else
+
+ \protected\def\page_inserts_set_limit {\global\dimen}
+ \protected\def\page_inserts_set_distance {\global\skip }
+ \protected\def\page_inserts_set_multiplier{\global\count}
+
+ \protected\def\page_inserts_get_limit {\dimen}
+ \protected\def\page_inserts_get_distance {\skip }
+ \protected\def\page_inserts_get_multiplier{\count}
+
+ \protected\def\page_inserts_get_boxed {\box}
+ \protected\def\page_inserts_get_copied {\copy}
+ \protected\def\page_inserts_get_unboxed {\unvbox}
+ \protected\def\page_inserts_get_uncopied {\unvcopy}
+
+ \protected\def\page_inserts_get_height {\ht}
+
+\fi
+
\appendtoks
\ifempty\currentinsertionparent
\ifcsname\??insertionnumber\currentinsertion\endcsname
@@ -140,9 +177,9 @@
\t_page_inserts_list\expandafter\expandafter\expandafter
{\expandafter\the\expandafter\t_page_inserts_list
\expandafter\page_inserts_process\csname\??insertionnumber\currentinsertion\endcsname}%
- \count\currentinsertionnumber\plusthousand
- \skip \currentinsertionnumber\zeropoint
- \dimen\currentinsertionnumber\maxdimen
+ \page_inserts_set_multiplier\currentinsertionnumber\plusthousand
+ \page_inserts_set_distance \currentinsertionnumber\zeropoint
+ \page_inserts_set_limit \currentinsertionnumber\maxdimen
\fi
\else
\letcsname\??insertionnumber\currentinsertion\expandafter\endcsname
@@ -169,41 +206,10 @@
\def\page_insert_insertion_height#1%
{\dimexpr\expandafter\page_insert_insertion_height_indeed\csname\??insertionnumber#1\endcsname\relax}
-\def\page_insert_insertion_height_indeed#1%
- {\ifvoid#1\zeropoint\else1\skip#1+\ht#1\fi}
-
-%D Obsolete:
+% \def\page_insert_insertion_height_indeed#1%
+% {\ifvoid#1\zeropoint\else1\page_inserts_get_distance#1+\ht#1\fi}
-% \installcorenamespace{insertionbackup}
-%
-% \protected\def\installbackupinsertion#1%
-% {\ifcsname\??insertionbackup\string#1\endcsname \else
-% \expandafter\newinsert\csname\??insertionbackup\string#1\endcsname
-% \count\csname\??insertionbackup\string#1\endcsname\zerocount
-% \skip \csname\??insertionbackup\string#1\endcsname\zeropoint
-% \dimen\csname\??insertionbackup\string#1\endcsname\maxdimen
-% \fi}
-%
-% \protected\def\saveinsertionbox#1% hm, actually unknown
-% {\global\setbox\csname\??insertionbackup\string#1\endcsname
-% \ifdim\ht#1>\zeropoint\box#1\else\emptybox\fi}
-%
-% \protected\def\restoreinsertionbox#1%
-% {\ifvoid\backupinsertion#1\else % if void, we keep the content
-% \global\setbox#1\box\csname\??insertionbackup\string#1\endcsname
-% \fi}
-%
-% \protected\def\eraseinsertionbackup#1%
-% {\global\setbox\csname\??insertionbackup\string#1\endcsname\emptybox}
-%
-% \protected\def\saveinsertiondata#1%
-% {\global\skip \csname\??insertionbackup\string#1\endcsname\skip #1%
-% \global\count\csname\??insertionbackup\string#1\endcsname\count#1%
-% \global\dimen\csname\??insertionbackup\string#1\endcsname\dimen#1}
-%
-% \protected\def\restoreinsertiondata#1%
-% {\global\skip #1\skip \csname\??insertionbackup\string#1\endcsname
-% \global\count#1\count\csname\??insertionbackup\string#1\endcsname
-% \global\dimen#1\dimen\csname\??insertionbackup\string#1\endcsname}
+\def\page_insert_insertion_height_indeed#1%
+ {\ifzeropt\page_inserts_get_height#1\zeropoint\else\dimexpr\page_inserts_get_distance#1\relax+\page_inserts_get_height#1\fi}
\protect \endinput
diff --git a/tex/context/base/mkxl/page-one.mkxl b/tex/context/base/mkxl/page-one.mkxl
index 4b4416fe1..7ea43c1d6 100644
--- a/tex/context/base/mkxl/page-one.mkxl
+++ b/tex/context/base/mkxl/page-one.mkxl
@@ -405,14 +405,15 @@
\page_one_command_set_bottom_insertions_indeed}
\protected\def\page_one_command_flush_top_insertions
- {\ifvoid\namedinsertionnumber\s!topfloat\else
+% {\ifvoid\namedinsertionnumber\s!topfloat\else
+ {\ifzeropt\page_inserts_get_height\namedinsertionnumber\s!topfloat\else
\page_one_command_flush_top_insertions_indeed % less tracing
\fi
\global\d_page_floats_inserted_top\zeropoint}
\def\page_one_command_flush_top_insertions_indeed
{\ifgridsnapping
- \box\namedinsertionnumber\s!topfloat
+ \page_inserts_get_boxed\namedinsertionnumber\s!topfloat
\vkern-\topskip
\vkern\strutheight % [xx] new: see icare topbleed
\else
@@ -423,11 +424,12 @@
\vskip-\topskip % skip !
\vkern\strutheight
\fi
- \unvbox\namedinsertionnumber\s!topfloat
+ \page_inserts_get_unboxed\namedinsertionnumber\s!topfloat
\fi}
\protected\def\page_one_command_flush_bottom_insertions
- {\ifvoid\namedinsertionnumber\s!bottomfloat\else
+% {\ifvoid\namedinsertionnumber\s!bottomfloat\else
+ {\ifzeropt\page_inserts_get_height\namedinsertionnumber\s!bottomfloat\else
\page_one_command_flush_bottom_insertions_indeed
\fi
\global\d_page_floats_inserted_bottom\zeropoint
@@ -436,11 +438,11 @@
\def\page_one_command_flush_bottom_insertions_indeed
{\ifgridsnapping
% \floatparameter\c!bottombefore
- \snaptogrid\hbox{\box\namedinsertionnumber\s!bottomfloat}%
+ \snaptogrid\hbox{\page_inserts_get_boxed\namedinsertionnumber\s!bottomfloat}%
% \floatparameter\c!bottomafter
\else
\floatparameter\c!bottombefore
- \unvbox\namedinsertionnumber\s!bottomfloat
+ \page_inserts_get_unboxed\namedinsertionnumber\s!bottomfloat
\floatparameter\c!bottomafter
\fi}
diff --git a/tex/context/base/mkxl/page-pcl.mkxl b/tex/context/base/mkxl/page-pcl.mkxl
index 6d186a4cd..e2cf44bd4 100644
--- a/tex/context/base/mkxl/page-pcl.mkxl
+++ b/tex/context/base/mkxl/page-pcl.mkxl
@@ -196,12 +196,12 @@
\protected\def\page_col_command_side_float_output
{% % %
- \ifvoid\namedinsertionnumber\s!topfloat\else
- \scratchwidth\wd\namedinsertionnumber\s!topfloat
+ \ifzeropt\page_inserts_get_height\namedinsertionnumber\s!topfloat\else
+ \scratchwidth\page_inserts_get_width\namedinsertionnumber\s!topfloat\relax
\ifdim\scratchwidth>\d_page_col_top_width
\global\d_page_col_top_width \scratchwidth
\fi
- \global\d_page_col_top_height\ht\namedinsertionnumber\s!topfloat
+ \global\d_page_col_top_height\page_inserts_get_height\namedinsertionnumber\s!topfloat\relax
\fi
% % %
\setbox\scratchbox\vbox\bgroup
diff --git a/tex/context/base/mkxl/strc-not.lmt b/tex/context/base/mkxl/strc-not.lmt
new file mode 100644
index 000000000..df3b00d78
--- /dev/null
+++ b/tex/context/base/mkxl/strc-not.lmt
@@ -0,0 +1,530 @@
+if not modules then modules = { } end modules ['strc-not'] = {
+ version = 1.001,
+ comment = "companion to strc-not.mkiv",
+ author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
+ copyright = "PRAGMA ADE / ConTeXt Development Team",
+ license = "see context related readme files"
+}
+
+local format = string.format
+local next = next
+
+local trace_notes = false trackers.register("structures.notes", function(v) trace_notes = v end)
+local trace_references = false trackers.register("structures.notes.references", function(v) trace_references = v end)
+
+local report_notes = logs.reporter("structure","notes")
+
+local structures = structures
+local helpers = structures.helpers
+local lists = structures.lists
+local sections = structures.sections
+local counters = structures.counters
+local notes = structures.notes
+local references = structures.references
+local counterspecials = counters.specials
+
+local texgetcount = tex.getcount
+local texgetbox = tex.getbox
+
+-- todo: allocate
+
+notes.states = notes.states or { }
+lists.enhancers = lists.enhancers or { }
+notes.numbers = notes.numbers or { }
+
+storage.register("structures/notes/states", notes.states, "structures.notes.states")
+storage.register("structures/notes/numbers", notes.numbers, "structures.notes.numbers")
+
+local notestates = notes.states
+local notedata = table.setmetatableindex("table")
+
+local variables = interfaces.variables
+local context = context
+local commands = commands
+
+local implement = interfaces.implement
+
+-- state: store, insert, postpone
+
+local function store(tag,n)
+ -- somewhat weird but this is a cheap hook spot
+ if not counterspecials[tag] then
+ counterspecials[tag] = function(tag)
+ context.doresetlinenotecompression(tag) -- maybe flag that controls it
+ end
+ end
+ --
+ local nd = notedata[tag]
+ local nnd = #nd + 1
+ nd[nnd] = n
+ local state = notestates[tag]
+ if not state then
+ report_notes("unknown state for %a",tag)
+ elseif state.kind ~= "insert" then
+ if trace_notes then
+ report_notes("storing %a with state %a as %a",tag,state.kind,nnd)
+ end
+ state.start = state.start or nnd
+ end
+ return nnd
+end
+
+notes.store = store
+
+implement {
+ name = "storenote",
+ actions = { store, context },
+ arguments = { "string", "integer" }
+}
+
+local function get(tag,n) -- tricky ... only works when defined
+ local nd = notedata[tag]
+ if not n then
+ n = #nd
+ end
+ nd = nd[n]
+ if nd then
+ if trace_notes then
+ report_notes("getting note %a of %a with listindex %a",n,tag,nd)
+ end
+ -- is this right?
+ local newdata = lists.cached[nd]
+ return newdata
+ end
+end
+
+local function getn(tag)
+ return #notedata[tag]
+end
+
+notes.get = get
+notes.getn = getn
+
+-- we could make a special enhancer
+
+local function listindex(tag,n)
+ local ndt = notedata[tag]
+ return ndt and ndt[n]
+end
+
+notes.listindex = listindex
+
+implement {
+ name = "notelistindex",
+ actions = { listindex, context },
+ arguments = { "string", "integer" }
+}
+
+local function setstate(tag,newkind)
+ local state = notestates[tag]
+ if trace_notes then
+ report_notes("setting state of %a from %s to %s",tag,(state and state.kind) or "unset",newkind)
+ end
+ if not state then
+ state = {
+ kind = newkind
+ }
+ notestates[tag] = state
+ elseif newkind == "insert" then
+ if not state.start then
+ state.kind = newkind
+ end
+ else
+-- if newkind == "postpone" and state.kind == "store" then
+-- else
+ state.kind = newkind
+-- end
+ end
+ -- state.start can already be set and will be set when an entry is added or flushed
+ return state
+end
+
+local function getstate(tag)
+ local state = notestates[tag]
+ return state and state.kind or "unknown"
+end
+
+notes.setstate = setstate
+notes.getstate = getstate
+
+
+
+implement {
+ name = "setnotestate",
+ actions = setstate,
+ arguments = "2 strings",
+}
+
+implement {
+ name = "getnotestate",
+ actions = { getstate, context },
+ arguments = "string"
+}
+
+function notes.define(tag,kind,number)
+ local state = setstate(tag,kind)
+ notes.numbers[number] = state
+ state.number = number
+end
+
+implement {
+ name = "definenote",
+ actions = notes.define,
+ arguments = { "string", "string", "integer" }
+}
+
+function notes.save(tag,newkind)
+ local state = notestates[tag]
+ if state and not state.saved then
+ if trace_notes then
+ report_notes("saving state of %a, old: %a, new %a",tag,state.kind,newkind or state.kind)
+ end
+ state.saveddata = notedata[tag]
+ state.savedkind = state.kind
+ state.kind = newkind or state.kind
+ state.saved = true
+ notedata[tag] = { }
+ end
+end
+
+function notes.restore(tag,forcedstate)
+ local state = notestates[tag]
+ if state and state.saved then
+ if trace_notes then
+ report_notes("restoring state of %a, old: %a, new: %a",tag,state.kind,state.savedkind)
+ end
+ notedata[tag] = state.saveddata
+ state.kind = forcedstate or state.savedkind
+ state.saveddata = nil
+ state.saved = false
+ end
+end
+
+implement { name = "savenote", actions = notes.save, arguments = "2 strings" }
+implement { name = "restorenote", actions = notes.restore, arguments = "2 strings" }
+
+local function hascontent(tag)
+ local ok = notestates[tag]
+ if ok then
+ if ok.kind == "insert" then
+ ok = texgetbox(ok.number)
+ if ok then
+ ok = tbs.list
+ ok = lst and lst.next
+ end
+ else
+ ok = ok.start
+ end
+ end
+ return ok and true or false
+end
+
+notes.hascontent = hascontent
+
+implement {
+ name = "doifnotecontent",
+ actions = { hascontent, commands.doif },
+ arguments = "string",
+}
+
+local function internal(tag,n)
+ local nd = get(tag,n)
+ if nd then
+ local r = nd.references
+ if r then
+ local i = r.internal
+ return i and references.internals[i] -- dependency on references
+ end
+ end
+ return nil
+end
+
+local function ordered(kind,name,n)
+ local o = lists.ordered[kind]
+ o = o and o[name]
+ return o and o[n]
+end
+
+notes.internal = internal
+notes.ordered = ordered
+
+-- local function onsamepageasprevious(tag)
+-- local same = false
+-- local n = getn(tag,n)
+-- local current = get(tag,n)
+-- local previous = get(tag,n-1)
+-- if current and previous then
+-- local cr = current.references
+-- local pr = previous.references
+-- same = cr and pr and cr.realpage == pr.realpage
+-- end
+-- return same and true or false
+-- end
+
+local function onsamepageasprevious(tag)
+ local n = getn(tag,n)
+ local current = get(tag,n)
+ if not current then
+ return false
+ end
+ local cr = current.references
+ if not cr then
+ return false
+ end
+ local previous = get(tag,n-1)
+ if not previous then
+ return false
+ end
+ local pr = previous.references
+ if not pr then
+ return false
+ end
+ return cr.realpage == pr.realpage
+end
+
+notes.doifonsamepageasprevious = onsamepageasprevious
+
+implement {
+ name = "doifnoteonsamepageasprevious",
+ actions = { onsamepageasprevious, commands.doifelse },
+ arguments = "string",
+}
+
+function notes.checkpagechange(tag) -- called before increment !
+ local nd = notedata[tag] -- can be unset at first entry
+ if nd then
+ local current = ordered("note",tag,#nd)
+ local nextone = ordered("note",tag,#nd+1)
+ if nextone then
+ -- we can use data from the previous pass
+ if nextone.pagenumber.number > current.pagenumber.number then
+ counters.reset(tag)
+ end
+ elseif current then
+ -- we need to locate the next one, best guess
+ if texgetcount("realpageno") > current.pagenumber.number then
+ counters.reset(tag)
+ end
+ end
+ end
+end
+
+function notes.postpone()
+ if trace_notes then
+ report_notes("postponing all insert notes")
+ end
+ for tag, state in next, notestates do
+ if state.kind ~= "store" then
+ setstate(tag,"postpone")
+ end
+ end
+end
+
+implement {
+ name = "postponenotes",
+ actions = notes.postpone
+}
+
+local function getinternal(tag,n)
+ local li = internal(tag,n)
+ if li then
+ local references = li.references
+ if references then
+ return references.internal or 0
+ end
+ end
+ return 0
+end
+
+local function getdeltapage(tag,n)
+ -- 0:unknown 1:textbefore, 2:textafter, 3:samepage
+ local li = internal(tag,n)
+ if li then
+ local references = li.references
+ if references then
+ -- local symb = structures.references.collected[""]["symb:"..tag..":"..n]
+ local rymb = structures.references.collected[""]
+ local symb = rymb and rymb["*"..(references.internal or 0)]
+ local notepage = references.realpage or 0
+ local symbolpage = symb and symb.references.realpage or -1
+ if trace_references then
+ report_notes("note number %a of %a points from page %a to page %a",n,tag,symbolpage,notepage)
+ end
+ if notepage < symbolpage then
+ return 3 -- after
+ elseif notepage > symbolpage then
+ return 2 -- before
+ elseif notepage > 0 then
+ return 1 -- same
+ end
+ else
+ -- might be a note that is not flushed due to to deep
+ -- nesting in a vbox
+ end
+ end
+ return 0
+end
+
+notes.getinternal = getinternal
+notes.getdeltapage = getdeltapage
+
+implement { name = "noteinternal", actions = { getinternal, context }, arguments = { "string", "integer" } }
+implement { name = "notedeltapage", actions = { getdeltapage, context }, arguments = { "string", "integer" } }
+
+local function flushnotes(tag,whatkind,how) -- store and postpone
+ local state = notestates[tag]
+ local kind = state.kind
+ if kind == whatkind then
+ local nd = notedata[tag]
+ local ns = state.start -- first index
+ if kind == "postpone" then
+ if nd and ns then
+ if trace_notes then
+ report_notes("flushing state %a of %a from %a to %a",whatkind,tag,ns,#nd)
+ end
+ for i=ns,#nd do
+ context.handlenoteinsert(tag,i)
+ end
+ end
+ state.start = nil
+ state.kind = "insert"
+ elseif kind == "store" then
+ if nd and ns then
+ if trace_notes then
+ report_notes("flushing state %a of %a from %a to %a",whatkind,tag,ns,#nd)
+ end
+ -- todo: as registers: start, stop, inbetween
+ for i=ns,#nd do
+ -- tricky : trialtypesetting
+ if how == variables.page then
+ local rp = get(tag,i)
+ rp = rp and rp.references
+ rp = rp and rp.symbolpage or 0
+ if rp > texgetcount("realpageno") then
+ state.start = i
+ return
+ end
+ end
+ if i > ns then
+ context.betweennoteitself(tag)
+ end
+ context.handlenoteitself(tag,i)
+ end
+ end
+ state.start = nil
+ elseif kind == "reset" then
+ if nd and ns then
+ if trace_notes then
+ report_notes("flushing state %a of %a from %a to %a",whatkind,tag,ns,#nd)
+ end
+ end
+ state.start = nil
+ elseif trace_notes then
+ report_notes("not flushing state %a of %a",whatkind,tag)
+ end
+ elseif trace_notes then
+ report_notes("not flushing state %a of %a",whatkind,tag)
+ end
+end
+
+local function flushpostponednotes()
+ if trace_notes then
+ report_notes("flushing all postponed notes")
+ end
+ for tag, _ in next, notestates do
+ flushnotes(tag,"postpone")
+ end
+end
+
+implement {
+ name = "flushpostponednotes",
+ actions = flushpostponednotes
+}
+
+implement {
+ name = "flushnotes",
+ actions = flushnotes,
+ arguments = "3 strings",
+}
+
+function notes.resetpostponed()
+ if trace_notes then
+ report_notes("resetting all postponed notes")
+ end
+ for tag, state in next, notestates do
+ if state.kind == "postpone" then
+ state.start = nil
+ state.kind = "insert"
+ end
+ end
+end
+
+implement {
+ name = "notetitle",
+ actions = function(tag,n) lists.savedlisttitle(tag,notedata[tag][n]) end,
+ arguments = { "string", "integer" }
+}
+
+implement {
+ name = "noteprefixednumber",
+ actions = function(tag,n) lists.savedlistprefixednumber(tag,notedata[tag][n]) end,
+ arguments = { "string", "integer" }
+}
+
+function notes.internalid(tag,n)
+ local nd = get(tag,n)
+ if nd then
+ local r = nd.references
+ return r.internal
+ end
+end
+
+-- for the moment here but better in some builder modules
+
+-- gets register "n" and location "i" (where 1 is before)
+
+-- this is an experiment, we will make a more general handler instead
+-- of the current note one
+
+local report_insert = logs.reporter("pagebuilder","insert")
+local trace_insert = false trackers.register("pagebuilder.insert",function(v) trace_insert = v end)
+
+local texgetglue = tex.getglue
+----- texsetglue = tex.setglue
+
+local tonode = nodes.nuts.tonode
+local newgluespec = nodes.nuts.pool.gluespec -- nodes.pool.gluespec
+
+-- needs to be sorted out!
+
+local function check_spacing(index,slot)
+ -- we can also check for tex.insertheights > 0 (instead of i > 1)
+ local gn, pn, mn = tex.getinsertdistance(index) -- ,true so no testing needed
+ if not pn then pn = 0 end
+ if not mn then mn = 0 end
+ local gi, pi, mi = texgetglue(slot > 1 and "s_strc_notes_inbetween" or "s_strc_notes_before")
+ if not pi then pi = 0 end
+ if not mi then mi = 0 end
+ local gt = gn + gi
+ local pt = pn + pi
+ local mt = mn + mi
+ if trace_insert then
+ report_insert("%s %i: %p plus %p minus %p","always ",n,gn,pn,mn)
+ report_insert("%s %i: %p plus %p minus %p",i > 1 and "inbetween" or "before ",n,gi,pi,mi)
+ report_insert("%s %i: %p plus %p minus %p","effective",n,gt,pt,mt)
+ end
+ return gt, pt, mt
+end
+
+notes.check_spacing = check_spacing
+
+-- only notes, kind of hardcoded .. bah
+
+callback.register("build_page_insert", function(index,slot)
+ local state = notes.numbers[index]
+ if state then
+ return tonode(newgluespec(check_spacing(index,slot)))
+ else
+ return tonode(newgluespec())
+ end
+end)
diff --git a/tex/context/base/mkxl/strc-not.mklx b/tex/context/base/mkxl/strc-not.mklx
index ac769ee38..3faf7135b 100644
--- a/tex/context/base/mkxl/strc-not.mklx
+++ b/tex/context/base/mkxl/strc-not.mklx
@@ -13,7 +13,7 @@
\writestatus{loading}{ConTeXt Structure Macros / Note Handling}
-\registerctxluafile{strc-not}{}
+\registerctxluafile{strc-not}{autosuffix}
\unprotect
@@ -24,9 +24,6 @@
\ifdefined\dotagsetnotesymbol \else \aliased\let\dotagsetnotesymbol\relax \fi
\ifdefined\dotagsetnotation \else \aliased\let\dotagsetnotation \relax \fi
-\permanent\protected\def\unvboxed {\ifvmode\unvbox \else\box \fi} % will change or used more often
-\permanent\protected\def\unvcopied{\ifvmode\unvcopy\else\copy\fi} % will change or used more often
-
%D \LMTX\ testcase:
%D
%D \starttyping
@@ -925,7 +922,7 @@
\ifempty\p_factor \else
\ifnum\p_factor<\zerocount \else
% \global
- \count\currentnoteinsertionnumber\p_factor % new: global
+ \page_inserts_set_multiplier\currentnoteinsertionnumber\p_factor % new: global
\fi
\fi}
@@ -1053,10 +1050,10 @@
{\setfalse\c_strc_notes_delayed
\strc_notes_set_distance
\strc_notes_set_columns
- \page_inserts_set_location\currentnoteinsertion\v!page % \setupinsertion[\currentnote][\c!location=\v!page]%
- \global\count\currentnoteinsertionnumber\numexpr(\plusthousand/\c_strc_notes_columns)*\nofmulticolumns\relax
- \global\dimen\currentnoteinsertionnumber\ifnotelimit\dimexpr\noteparameter\c!height*\c_strc_notes_columns\relax\else\maxdimen\fi
- \global\skip \currentnoteinsertionnumber\s_strc_notes_distance}
+ \page_inserts_set_location \currentnoteinsertion\v!page % \setupinsertion[\currentnote][\c!location=\v!page]%
+ \page_inserts_set_multiplier\currentnoteinsertionnumber\numexpr(\plusthousand/\c_strc_notes_columns)*\nofmulticolumns\relax
+ \page_inserts_set_limit \currentnoteinsertionnumber\ifnotelimit\dimexpr\noteparameter\c!height*\c_strc_notes_columns\relax\else\maxdimen\fi
+ \page_inserts_set_distance \currentnoteinsertionnumber\s_strc_notes_distance}
\def\strc_notes_set_location_columns
{\setfalse\c_strc_notes_delayed
@@ -1066,19 +1063,19 @@
\ifnum\nofcolumns=\zerocount
\c_strc_notes_columns\plusone
\fi
- \page_inserts_set_location\currentnoteinsertion\v!columns % \setupinsertion[\currentnote][\c!location=\v!columns]%
- \global\count\currentnoteinsertionnumber\numexpr\plusthousand/\c_strc_notes_columns\relax
- \global\dimen\currentnoteinsertionnumber\ifnotelimit\dimexpr\noteparameter\c!height*\c_strc_notes_columns\relax\else\maxdimen\fi
- \global\skip \currentnoteinsertionnumber\s_strc_notes_distance}
+ \page_inserts_set_location \currentnoteinsertion\v!columns % \setupinsertion[\currentnote][\c!location=\v!columns]%
+ \page_inserts_set_multiplier\currentnoteinsertionnumber\numexpr\plusthousand/\c_strc_notes_columns\relax
+ \page_inserts_set_limit \currentnoteinsertionnumber\ifnotelimit\dimexpr\noteparameter\c!height*\c_strc_notes_columns\relax\else\maxdimen\fi
+ \page_inserts_set_distance \currentnoteinsertionnumber\s_strc_notes_distance}
\def\strc_notes_set_location_somecolumn#whatcolumn%
{\setfalse\c_strc_notes_delayed
\strc_notes_set_distance
\strc_notes_set_columns
- \page_inserts_set_location\currentnoteinsertion#whatcolumn% \setupinsertion[\currentnote][\c!location=#whatcolumn]%
- \global\count\currentnoteinsertionnumber\plusthousand
- \global\dimen\currentnoteinsertionnumber\ifnotelimit\noteparameter\c!height\else\maxdimen\fi
- \global\skip \currentnoteinsertionnumber\s_strc_notes_distance}
+ \page_inserts_set_location \currentnoteinsertion#whatcolumn% \setupinsertion[\currentnote][\c!location=#whatcolumn]%
+ \page_inserts_set_multiplier\currentnoteinsertionnumber\plusthousand
+ \page_inserts_set_limit \currentnoteinsertionnumber\ifnotelimit\noteparameter\c!height\else\maxdimen\fi
+ \page_inserts_set_distance \currentnoteinsertionnumber\s_strc_notes_distance}
\def\strc_notes_set_location_firstcolumn{\strc_notes_set_location_somecolumn\v!firstcolumn}
\def\strc_notes_set_location_lastcolumn {\strc_notes_set_location_somecolumn\v!lastcolumn }
@@ -1086,10 +1083,10 @@
\def\strc_notes_set_location_text % we don't use inserts anyway (e.g. endnotes)
{\settrue\c_strc_notes_delayed
\clf_setnotestate{\currentnote}{store}%
- \page_inserts_set_location\currentnoteinsertion\v!text % \setupinsertion[\currentnote][\c!location=\v!text]%
- \global\count\currentnoteinsertionnumber\zerocount
- \global\dimen\currentnoteinsertionnumber\maxdimen
- \global\skip \currentnoteinsertionnumber\zeropoint}
+ \page_inserts_set_location \currentnoteinsertion\v!text % \setupinsertion[\currentnote][\c!location=\v!text]%
+ \page_inserts_set_multiplier\currentnoteinsertionnumber\zerocount
+ \page_inserts_set_limit \currentnoteinsertionnumber\maxdimen
+ \page_inserts_set_distance \currentnoteinsertionnumber\zeropoint}
\let\strc_notes_set_location_none\strc_notes_set_location_text
@@ -1112,8 +1109,13 @@
\newconditional\c_notes_bottom_present
+% \def\strc_notes_check_if_bottom_present_indeed % in otr !
+% {\ifvoid\currentnoteinsertionnumber\else
+% \strc_notes_set_position
+% \fi}
+
\def\strc_notes_check_if_bottom_present_indeed % in otr !
- {\ifvoid\currentnoteinsertionnumber\else
+ {\ifzeropt\page_inserts_get_height\currentnoteinsertionnumber\else
\strc_notes_set_position
\fi}
@@ -1375,7 +1377,8 @@
\def\strc_notes_place_inserts
{\strc_notes_set_delayed % \strc_notes_synchronize % we need to know if it's delayed
\ifconditional\c_strc_notes_delayed \else
- \ifdim\ht\currentnoteinsertionnumber>\zeropoint % or a faster delayed test
+% \ifdim\ht\currentnoteinsertionnumber>\zeropoint % or a faster delayed test
+ \ifcase\page_inserts_get_height\currentnoteinsertionnumber\else
\strc_notes_place_inserts_indeed
\settrue\c_strc_notes_first_placed
\fi
@@ -1383,7 +1386,8 @@
\def\strc_notes_place_inserts_indeed
{\relax
- \ifdim\ht\currentnoteinsertionnumber>\zeropoint
+% \ifdim\ht\currentnoteinsertionnumber>\zeropoint
+ \ifcase\page_inserts_get_height\currentnoteinsertionnumber\else
\endgraf
\ifvmode
\whitespace
@@ -1461,9 +1465,19 @@
\doifelse{\noteparameter\c!paragraph}\v!yes
{\leftorrightvbox % cf mail from ws to list
{\starthboxestohbox
- \iftrialtypesetting\unvcopy\else\unvbox\fi\currentnoteinsertionnumber
+ \iftrialtypesetting
+ \page_inserts_get_uncopied
+ \else
+ \page_inserts_get_unboxed
+ \fi
+ \currentnoteinsertionnumber
\stophboxestohbox}}
- {\iftrialtypesetting\unvcopied\else\unvboxed\fi\currentnoteinsertionnumber}%
+ {\iftrialtypesetting
+ \ifvmode\page_inserts_get_uncopied\else\page_inserts_get_copied\fi
+ \else
+ \ifvmode\page_inserts_get_unboxed \else\page_inserts_get_boxed \fi
+ \fi
+ \currentnoteinsertionnumber}%
\endgroup}
%D Supporting end notes is surprisingly easy. Even better, we can combine this
@@ -1741,7 +1755,8 @@
\strc_notes_process\strc_notes_check_presence}
\def\strc_notes_check_presence
- {\ifdim\ht\currentnoteinsertionnumber>\zeropoint
+% {\ifdim\page_inserts_get_height\currentnoteinsertionnumber>\zeropoint % not reliable
+ {\ifcase\page_inserts_get_height\currentnoteinsertionnumber\else
\notespresenttrue
\fi}
@@ -1770,14 +1785,13 @@
\permanent\protected\def\additionaltotalnoteheight#insert% temp hacks anyway
{\dimexpr
- \ifdim\ht#insert>\zeropoint
- \ifcase\count#insert %
- \zeropoint
- \else % todo: divide by count
- \ht#insert+\skip#insert% hm, no stretch but a dimen anyway
- \fi
- \else
+ \ifnum\page_inserts_get_height#insert=\zeropoint
+ \zeropoint
+ \orelse\ifnum\page_inserts_get_multiplier#insert=\zeropoint
\zeropoint
+ \else % todo: divide by count
+ \page_inserts_get_height #insert
+ +\page_inserts_get_distance#insert% hm, no stretch but a dimen anyway
\fi
\relax}
diff --git a/tex/context/base/mkxl/task-ini.lmt b/tex/context/base/mkxl/task-ini.lmt
index 571d31013..4989db85c 100644
--- a/tex/context/base/mkxl/task-ini.lmt
+++ b/tex/context/base/mkxl/task-ini.lmt
@@ -130,7 +130,6 @@ appendaction("finalizers", "fonts", "builders.paragraphs.solutions.split
appendaction("finalizers", "lists", "builders.paragraphs.tag", nil, "nut", "disabled" )
appendaction("finalizers", "lists", "nodes.linefillers.handler", nil, "nut", "disabled" )
-
appendaction("contributers", "normalizers", "nodes.handlers.flattenline", nil, "nut", "disabled" )
appendaction("contributers", "normalizers", "nodes.handlers.textbackgrounds", nil, "nut", "disabled" )
appendaction("contributers", "normalizers", "nodes.handlers.wipe", nil, "nut", "disabled" )
diff --git a/tex/context/base/mkxl/trac-inf.lmt b/tex/context/base/mkxl/trac-inf.lmt
index 9a4932fbc..a2366b611 100644
--- a/tex/context/base/mkxl/trac-inf.lmt
+++ b/tex/context/base/mkxl/trac-inf.lmt
@@ -266,7 +266,7 @@ local report = logs.reporter("system")
local list = {
"string", "pool", "hash", "lookup", "node", "token", "extra", "sparse", "buffer",
- "input", "file", "nest", "parameter", "save", "font", "language", "mark",
+ "input", "file", "nest", "parameter", "save", "font", "language", "mark", "insert",
}
local function show(data,fields)
diff --git a/tex/context/base/mkxl/typo-cap.lmt b/tex/context/base/mkxl/typo-cap.lmt
index 03a04a17b..02a2c1aaf 100644
--- a/tex/context/base/mkxl/typo-cap.lmt
+++ b/tex/context/base/mkxl/typo-cap.lmt
@@ -94,7 +94,7 @@ local function set(tag,font)
+ (tag << 8)
+ (run << 0)
blocked[a] = false
- -- it makes sense to fetch them all at once
+ -- it makes sense to fetch them all at once ut it doesn't happen often: tex.getglyphscales() scale xscale yscale data [script] [state]
fontstate[a] = {
texgetcount("glyphscale"),
texgetcount("glyphxscale"),
@@ -319,9 +319,9 @@ function cases.handler(head)
count = count + 1
end
local n, id, m = get(attr)
- if lastfont[n] == nil then
+-- if lastfont[n] == nil then
lastfont[n] = id
- end
+-- end
local action = actions[n] -- map back to low number
if action then
local quit
@@ -342,9 +342,9 @@ function cases.handler(head)
count = 0
end
local n, id, m = get(attr)
- if lastfont[n] == nil then
+-- if lastfont[n] == nil then
lastfont[n] = id
- end
+-- end
local action = actions[n] -- map back to low number
if action then
local pre, post, replace = getdisc(start)
diff --git a/tex/context/base/mkxl/typo-cap.mkxl b/tex/context/base/mkxl/typo-cap.mkxl
index 53b68dcb8..afdefe923 100644
--- a/tex/context/base/mkxl/typo-cap.mkxl
+++ b/tex/context/base/mkxl/typo-cap.mkxl
@@ -162,7 +162,7 @@
\def\typo_capitals_set_real#1%
{\edef\currentcapitals{#1}%
- \sc
+ \sc % \smallcaps
\clf_setcharactercasing\currentcapitals}
\permanent\protected\def\pseudosmallcapped{\triggergroupedcommandcs\font_style_pseudosmallcapped}
@@ -249,7 +249,8 @@
\definefont
[MixedCaps]
- [CurrentFont*default cp 1.2\exheight]
+% [CurrentFont*default cp 1.2\exheight]
+ [CurrentFont*default sa .8] % better adaptation to slanted
\setupcapitals
[\v!mixed]
diff --git a/tex/context/base/mkxl/typo-drp.lmt b/tex/context/base/mkxl/typo-drp.lmt
index 1885ce90d..23bf254a8 100644
--- a/tex/context/base/mkxl/typo-drp.lmt
+++ b/tex/context/base/mkxl/typo-drp.lmt
@@ -250,7 +250,7 @@ actions[v_default] = function(head,setting)
if dynamic > 0 then
setglyphdata(current,dynamic)
end
- setcoloring(ma,ca,ta)
+ setcoloring(current,ma,ca,ta)
end
if current == last then
break
@@ -270,8 +270,7 @@ actions[v_default] = function(head,setting)
local width, height, depth = getwhd(dropper)
setwhd(dropper,0,0,0)
--
- setlink(prev,dropper)
- setlink(dropper,next)
+ setlink(prev,dropper,next)
--
if next then
local current = next
@@ -323,7 +322,7 @@ end
-- we can count ... when all done, we can disable ...
-function initials.handler(head)
+function initials.handler(head,groupcode)
if getid(head) == par_code and startofpar(head) then
local settings = getprop(head,a_initial)
if settings then
diff --git a/tex/context/base/mkxl/typo-drp.mkxl b/tex/context/base/mkxl/typo-drp.mkxl
index 94e08c9b0..35bbbca8c 100644
--- a/tex/context/base/mkxl/typo-drp.mkxl
+++ b/tex/context/base/mkxl/typo-drp.mkxl
@@ -76,6 +76,9 @@
\permanent\tolerant\protected\def\setinitial[#1]#*[#2]%
{\edef\typo_initial_handle{\typo_initial_handle_indeed{#1}{#2}}}
+\permanent\tolerant\protected\def\flushinitial % when used inside a mechanism that forgets
+ {\typo_initial_handle}
+
\protected\def\typo_initial_handle_indeed#1#2%
{\dontleavehmode
\begingroup
diff --git a/tex/context/interface/mkii/keys-de.xml b/tex/context/interface/mkii/keys-de.xml
index 2f7d32e9f..259908cba 100644
--- a/tex/context/interface/mkii/keys-de.xml
+++ b/tex/context/interface/mkii/keys-de.xml
@@ -144,6 +144,7 @@
<cd:variable name='chemistry' value='chemistry'/>
<cd:variable name='cite' value='cite'/>
<cd:variable name='closed' value='closed'/>
+ <cd:variable name='collapsed' value='collapsed'/>
<cd:variable name='color' value='farbe'/>
<cd:variable name='column' value='column'/>
<cd:variable name='columns' value='spalten'/>
@@ -395,6 +396,7 @@
<cd:variable name='nostopper' value='nostopper'/>
<cd:variable name='not' value='nicht'/>
<cd:variable name='notation' value='notation'/>
+ <cd:variable name='notcollapsed' value='notcollapsed'/>
<cd:variable name='note' value='note'/>
<cd:variable name='nothanging' value='nothanging'/>
<cd:variable name='nothyphenated' value='nothyphenated'/>
@@ -767,6 +769,7 @@
<cd:constant name='coupling' value='verknuepfung'/>
<cd:constant name='couplingway' value='verkopplungsart'/>
<cd:constant name='criterium' value='kriterium'/>
+ <cd:constant name='crop' value='crop'/>
<cd:constant name='cropoffset' value='cropoffset'/>
<cd:constant name='crossreference' value='crossreference'/>
<cd:constant name='cssfile' value='cssfile'/>
diff --git a/tex/context/modules/mkxl/m-mathfun.mkxl b/tex/context/modules/mkxl/m-mathfun.mkxl
index 581f50971..8c956274c 100644
--- a/tex/context/modules/mkxl/m-mathfun.mkxl
+++ b/tex/context/modules/mkxl/m-mathfun.mkxl
@@ -31,7 +31,7 @@
local xdecimal = xdecimal
local context = context
- local ctx_mfunction = context.mfunction
+ local ctx_mfunction = context.mfunctionlabeltext
local scanoptional = tokens.scanners.optional
local scanargument = tokens.scanners.argument
@@ -196,6 +196,8 @@
\usemodule[scite] \setupbodyfont[dejavu] \setuplayout[tight] \setuppapersize[A5]
+% \mainlanguage[es]
+
\starttext
\startbuffer
diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua
index b839fa3db..2162a8957 100644
--- a/tex/generic/context/luatex/luatex-fonts-merged.lua
+++ b/tex/generic/context/luatex/luatex-fonts-merged.lua
@@ -1,6 +1,6 @@
-- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua
-- parent file : c:/data/develop/context/sources/luatex-fonts.lua
--- merge date : 2021-05-21 15:02
+-- merge date : 2021-05-25 17:54
do -- begin closure to overcome local limits and interference
diff --git a/web2c/contextcnf.lua b/web2c/contextcnf.lua
index 8c1458a5a..7867374f2 100644
--- a/web2c/contextcnf.lua
+++ b/web2c/contextcnf.lua
@@ -139,9 +139,10 @@ return {
["luametatex.nestsize"] = { size = 10000, step = 1000 }, -- max = 10000
["luametatex.parametersize"] = { size = 100000, step = 10000 }, -- max = 100000
["luametatex.savesize"] = { size = 500000, step = 10000 }, -- max = 500000
- ["luametatex.fontsize"] = { size = 250, step = 250 }, -- max = 100000
+ ["luametatex.fontsize"] = { size = 100000, step = 250 }, -- max = 100000
["luametatex.languagesize"] = { size = 250, step = 250 }, -- max = 10000
- ["luametatex.marksize"] = { size = 50, step = 50 }, -- max = 10000
+ ["luametatex.marksize"] = { size = 250, step = 50 }, -- max = 10000
+ ["luametatex.insertsize"] = { size = 250, step = 25 }, -- max = 250
-- These are for luatex: