From e09328e5e3230ee408f6af2cd454848c4d056702 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Wed, 18 Jul 2018 18:32:31 +0200 Subject: 2018-07-18 17:40:00 --- doc/context/documents/general/qrcs/setup-cs.pdf | Bin 842776 -> 842777 bytes doc/context/documents/general/qrcs/setup-de.pdf | Bin 841989 -> 841990 bytes doc/context/documents/general/qrcs/setup-en.pdf | Bin 846611 -> 846612 bytes doc/context/documents/general/qrcs/setup-fr.pdf | Bin 841041 -> 841044 bytes doc/context/documents/general/qrcs/setup-it.pdf | Bin 844305 -> 844311 bytes .../documents/general/qrcs/setup-mapping-cs.pdf | Bin 346144 -> 346144 bytes .../documents/general/qrcs/setup-mapping-de.pdf | Bin 429315 -> 429316 bytes .../documents/general/qrcs/setup-mapping-en.pdf | Bin 343639 -> 343646 bytes .../documents/general/qrcs/setup-mapping-fr.pdf | Bin 346244 -> 346246 bytes .../documents/general/qrcs/setup-mapping-it.pdf | Bin 344849 -> 344850 bytes .../documents/general/qrcs/setup-mapping-nl.pdf | Bin 343937 -> 343940 bytes .../documents/general/qrcs/setup-mapping-ro.pdf | Bin 598649 -> 598649 bytes doc/context/documents/general/qrcs/setup-nl.pdf | Bin 837084 -> 837087 bytes doc/context/documents/general/qrcs/setup-ro.pdf | Bin 839541 -> 839541 bytes metapost/context/base/mpiv/mp-node.mpiv | 14 ++- tex/context/base/mkii/cont-new.mkii | 2 +- tex/context/base/mkii/context.mkii | 2 +- tex/context/base/mkii/core-sys.mkii | 12 +-- tex/context/base/mkiv/back-exp.lua | 62 +++++++++-- tex/context/base/mkiv/back-exp.mkiv | 2 +- tex/context/base/mkiv/cont-new.mkiv | 2 +- tex/context/base/mkiv/context.mkiv | 2 +- tex/context/base/mkiv/node-ini.lua | 20 ++++ tex/context/base/mkiv/node-ini.mkiv | 1 + tex/context/base/mkiv/node-par.lua | 21 ++++ tex/context/base/mkiv/node-tra.lua | 40 ++++++-- tex/context/base/mkiv/node-tsk.lua | 39 ++++--- tex/context/base/mkiv/page-flt.mkiv | 10 +- tex/context/base/mkiv/page-otr.mkvi | 14 +-- tex/context/base/mkiv/spac-ver.lua | 114 ++++++++------------- tex/context/base/mkiv/spac-ver.mkiv | 22 +++- tex/context/base/mkiv/status-files.pdf | Bin 26137 -> 26146 bytes tex/context/base/mkiv/status-lua.pdf | Bin 263993 -> 264927 bytes tex/context/base/mkiv/strc-blk.lua | 23 +++-- tex/context/base/mkiv/strc-blk.mkiv | 9 +- tex/context/base/mkiv/task-ini.lua | 4 + tex/context/base/mkiv/typo-bld.lua | 2 +- tex/context/interface/mkiv/i-context.pdf | Bin 846611 -> 846612 bytes tex/context/interface/mkiv/i-readme.pdf | Bin 61211 -> 61212 bytes tex/generic/context/luatex/luatex-fonts-merged.lua | 2 +- 40 files changed, 275 insertions(+), 144 deletions(-) create mode 100644 tex/context/base/mkiv/node-par.lua diff --git a/doc/context/documents/general/qrcs/setup-cs.pdf b/doc/context/documents/general/qrcs/setup-cs.pdf index 02343be47..597e89e0c 100644 Binary files a/doc/context/documents/general/qrcs/setup-cs.pdf and b/doc/context/documents/general/qrcs/setup-cs.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-de.pdf b/doc/context/documents/general/qrcs/setup-de.pdf index 0b516d013..4838c00e5 100644 Binary files a/doc/context/documents/general/qrcs/setup-de.pdf and b/doc/context/documents/general/qrcs/setup-de.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-en.pdf b/doc/context/documents/general/qrcs/setup-en.pdf index aa46a705e..b467a753e 100644 Binary files a/doc/context/documents/general/qrcs/setup-en.pdf and b/doc/context/documents/general/qrcs/setup-en.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-fr.pdf b/doc/context/documents/general/qrcs/setup-fr.pdf index d129d2ac8..2f550ac44 100644 Binary files a/doc/context/documents/general/qrcs/setup-fr.pdf and b/doc/context/documents/general/qrcs/setup-fr.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-it.pdf b/doc/context/documents/general/qrcs/setup-it.pdf index 4c881adce..4e39b5e08 100644 Binary files a/doc/context/documents/general/qrcs/setup-it.pdf and b/doc/context/documents/general/qrcs/setup-it.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-mapping-cs.pdf b/doc/context/documents/general/qrcs/setup-mapping-cs.pdf index a901f72f5..faf79f9b7 100644 Binary files a/doc/context/documents/general/qrcs/setup-mapping-cs.pdf and b/doc/context/documents/general/qrcs/setup-mapping-cs.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-mapping-de.pdf b/doc/context/documents/general/qrcs/setup-mapping-de.pdf index ae003afed..7037db2c0 100644 Binary files a/doc/context/documents/general/qrcs/setup-mapping-de.pdf and b/doc/context/documents/general/qrcs/setup-mapping-de.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-mapping-en.pdf b/doc/context/documents/general/qrcs/setup-mapping-en.pdf index fb3776d3a..5f495892a 100644 Binary files a/doc/context/documents/general/qrcs/setup-mapping-en.pdf and b/doc/context/documents/general/qrcs/setup-mapping-en.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-mapping-fr.pdf b/doc/context/documents/general/qrcs/setup-mapping-fr.pdf index d5ec100ab..c92fdf0d9 100644 Binary files a/doc/context/documents/general/qrcs/setup-mapping-fr.pdf and b/doc/context/documents/general/qrcs/setup-mapping-fr.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-mapping-it.pdf b/doc/context/documents/general/qrcs/setup-mapping-it.pdf index 3a48e7b63..ad7c68621 100644 Binary files a/doc/context/documents/general/qrcs/setup-mapping-it.pdf and b/doc/context/documents/general/qrcs/setup-mapping-it.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-mapping-nl.pdf b/doc/context/documents/general/qrcs/setup-mapping-nl.pdf index e103eb66a..d09218df0 100644 Binary files a/doc/context/documents/general/qrcs/setup-mapping-nl.pdf and b/doc/context/documents/general/qrcs/setup-mapping-nl.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-mapping-ro.pdf b/doc/context/documents/general/qrcs/setup-mapping-ro.pdf index a7be6b1b4..3312cbd36 100644 Binary files a/doc/context/documents/general/qrcs/setup-mapping-ro.pdf and b/doc/context/documents/general/qrcs/setup-mapping-ro.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-nl.pdf b/doc/context/documents/general/qrcs/setup-nl.pdf index fec41eb5b..20965c2b7 100644 Binary files a/doc/context/documents/general/qrcs/setup-nl.pdf and b/doc/context/documents/general/qrcs/setup-nl.pdf differ diff --git a/doc/context/documents/general/qrcs/setup-ro.pdf b/doc/context/documents/general/qrcs/setup-ro.pdf index 901c93588..729ff45d1 100644 Binary files a/doc/context/documents/general/qrcs/setup-ro.pdf and b/doc/context/documents/general/qrcs/setup-ro.pdf differ diff --git a/metapost/context/base/mpiv/mp-node.mpiv b/metapost/context/base/mpiv/mp-node.mpiv index b7abcd5e5..5829558e6 100644 --- a/metapost/context/base/mpiv/mp-node.mpiv +++ b/metapost/context/base/mpiv/mp-node.mpiv @@ -51,7 +51,9 @@ clearnodepath ; vardef makenode@#(text t) = for a = t : - if (path a) or (unknown a) or ((string a) and (length(a) = 0)) : + if (path a) or (unknown a) : + mfun_makenode@#(t,) + elseif (string a) and (length(a) = 0) : mfun_makenode@#(t,) else : mfun_makenode@#(nodepath, t,) @@ -62,7 +64,9 @@ enddef ; vardef node@#(text t) = for a = t : - if (path a) or (unknown a) or ((string a) and (length(a) = 0)) : + if (path a) or (unknown a) : + mfun_node@#(t,) + elseif (string a) and (length(a) = 0) : mfun_node@#(t,) else : mfun_node@#(nodepath, t,) @@ -73,7 +77,9 @@ enddef ; vardef nodeboundingpoint@#(text t) = for a = t : - if (path a) or (unknown a) or ((string a) and (length(a) = 0)) : + if (path a) or (unknown a) : + mfun_nodeboundingpoint@#(t) + elseif (string a) and (length(a) = 0) : mfun_nodeboundingpoint@#(t) else : mfun_nodeboundingpoint@#(nodepath,a) @@ -231,7 +237,7 @@ vardef betweennodes@#(suffix p)(expr f)(suffix q)(text s) = for a = s : if unknown t : t = a ; - nodeboundingpoint@#(q,t) + nodeboundingpoint@#(p,f) + mfun_nodeboundingpoint@#(q,t) + mfun_nodeboundingpoint@#(p,f) else : + relative@#(a) fi diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index 9517e6bb4..26e92909a 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{2018.07.17 17:25} +\newcontextversion{2018.07.18 17:33} %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 f95afa0af..0ce44438c 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{2018.07.17 17:25} +\edef\contextversion{2018.07.18 17:33} %D For those who want to use this: diff --git a/tex/context/base/mkii/core-sys.mkii b/tex/context/base/mkii/core-sys.mkii index 54778eeed..5aa669d2c 100644 --- a/tex/context/base/mkii/core-sys.mkii +++ b/tex/context/base/mkii/core-sys.mkii @@ -167,7 +167,7 @@ \def\stoplocal {\dostopglobaldefs} \def\startglobal {\dostartglobaldefs<+} \def\stopglobal {\dostopglobaldefs} - + \def\complexstart[#1]{\bgroup\getvalue{\e!start#1}} \def\complexstop [#1]{\getvalue{\e!stop #1}\egroup} @@ -215,7 +215,7 @@ \def\setupstartstop {\dodoubleargument\dosetupstartstop} - + % \docommand kan niet worden gebruikt omdat deze macro % soms lokaal wordt gebruikt @@ -275,7 +275,7 @@ \def\docommand##1{\setbox0\hbox{\getvalue{\string##1}##1}}% \processcommalist[#1]\docommand \egroup} - + \newif\ifforcefileexpansion % handy for document level overload %D The next implementation is about 4 times as faster than a @@ -374,7 +374,7 @@ \let\unicodechar\numbertoutf \edef\ascii{#1}% \expandafter\endgroup\expandafter\edef\expandafter#2\expandafter{\ascii}} - + % \setvalue{statevalue\v!stop }{0} % \setvalue{statevalue\v!start }{1} % \setvalue{statevalue\v!normaal}{2} @@ -385,12 +385,12 @@ % {\chardef\currentstate=0\getvalue{statevalue\getvalue{#1\c!state}\relax} % % \ifcase\currentstate ... - + \def\redo{\dorepeat} % [n*10], kind of obsolete % obsolete, use \dorecurse instead % % \def\herhaler {\repeater} % \def\herhaalmetcommando {\dorepeatwithcommand} - + \protect \endinput diff --git a/tex/context/base/mkiv/back-exp.lua b/tex/context/base/mkiv/back-exp.lua index d993b6da0..41e3cbbf8 100644 --- a/tex/context/base/mkiv/back-exp.lua +++ b/tex/context/base/mkiv/back-exp.lua @@ -2057,7 +2057,7 @@ do local f_detail = formatters[' detail="%s"'] local f_chain = formatters[' chain="%s"'] local f_index = formatters[' n="%s"'] - local f_spacing = formatters['%s'] + local f_spacing = formatters['%s'] local f_empty_inline = formatters["<%s/>"] local f_empty_mixed = formatters["%w<%s/>\n"] @@ -2235,8 +2235,14 @@ do end local a = di.attributes if a then + if trace_spacing then + a.p = di.parnumber or 0 + end n = n + 1 r[n] = attributes(a) + elseif trace_spacing then + n = n + 1 + r[n] = attributes { p = di.parnumber or 0 } end if n == 0 then if nature == "inline" or inline > 0 then @@ -2826,6 +2832,7 @@ local collectresults do -- too many locals otherwise local kern_code = nodecodes.kern local disc_code = nodecodes.disc local whatsit_code = nodecodes.whatsit + local localpar_code = nodecodes.localpar local userskip_code = skipcodes.userskip local rightskip_code = skipcodes.rightskip @@ -2869,8 +2876,30 @@ local collectresults do -- too many locals otherwise local nexthlist = nuts.traversers.hlist local nextnode = nuts.traversers.node + local function addtomaybe(maybewrong,c,case) + if trace_export then + report_export("%w",currentdepth,c,at,case) + else + local s = formatters["%C"](c) + if maybewrong then + maybewrong[#maybewrong+1] = s + else + maybewrong = { s } + end + return maybewrong + end + end + + local function showmaybe(maybewrong) + if not trace_export then + report_export("fuzzy paragraph: % t",maybewrong) + end + end + local function collectresults(head,list,pat,pap) -- is last used (we also have currentattribute) local p + local localparagraph + local maybewrong for n, id, subtype in nextnode, head do -- can go : if not subtype then @@ -2891,9 +2920,13 @@ end else if last ~= at then local tl = taglist[at] + local ap = getattr(n,a_taggedpar) or pap +if localparagraph and (not ap or ap < localparagraph) then + maybewrong = addtomaybe(maybewrong,c,1) +end pushcontent() - currentnesting = tl - currentparagraph = getattr(n,a_taggedpar) or pap + currentnesting = tl + currentparagraph = ap currentattribute = at last = at pushentry(currentnesting) @@ -2924,12 +2957,15 @@ end currentattribute = last currentparagraph = ap end +if localparagraph and (not ap or ap < localparagraph) then + maybewrong = addtomaybe(maybewrong,c,2) +end if trace_export then - report_export("%w",currentdepth,c,last) + report_export("%w",currentdepth,c,last) end else if trace_export then - report_export("%w",currentdepth,c,at) + report_export("%w",currentdepth,c,at) end end local s = getattr(n,a_exportstatus) @@ -3118,8 +3154,11 @@ end end end elseif subtype == parfillskip_code then - -- deal with paragaph endings (crossings) elsewhere and we quit here + -- deal with paragraph endings (crossings) elsewhere and we quit here -- as we don't want the rightskip space addition + if maybewrong then + showmaybe(maybewrong) + end return end elseif id == hlist_code or id == vlist_code then @@ -3196,9 +3235,14 @@ end last = nil currentparagraph = nil end + elseif id == localpar_code then + localparagraph = getattr(n,a_taggedpar) end p = n end + if maybewrong then + showmaybe(maybewrong) + end end function nodes.handlers.export(head) -- hooks into the page builder @@ -3216,6 +3260,11 @@ end return head end + function nodes.handlers.checkparcounter(p) + setattr(p,a_taggedpar,texgetcount("tagparcounter") + 1) + return p + end + function builders.paragraphs.tag(head) -- traverse_list noftextblocks = noftextblocks + 1 for n in nexthlist, head do @@ -3982,6 +4031,7 @@ local htmltemplate = [[ enableaction("shipouts","nodes.handlers.export") enableaction("shipouts","nodes.handlers.accessibility") enableaction("math", "noads.handlers.tags") + enableaction("everypar","nodes.handlers.checkparcounter") luatex.registerstopactions(structurestags.finishexport) exporting = true end diff --git a/tex/context/base/mkiv/back-exp.mkiv b/tex/context/base/mkiv/back-exp.mkiv index c4610f854..8220aca66 100644 --- a/tex/context/base/mkiv/back-exp.mkiv +++ b/tex/context/base/mkiv/back-exp.mkiv @@ -17,7 +17,7 @@ %D This is an experimental exporter and a logical follow up on tagging. The %D exporter assumes a properly tagged document. Some elements get a couple -%D of attributes becaus eitherwise rendering information would get lost. In +%D of attributes because otherwise rendering information would get lost. In %D general we assume that when the \XML\ is converted to \HTML\ some stylesheet %D is applied anyway. diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index ef8c995df..a09dbd99c 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2018.07.17 17:25} +\newcontextversion{2018.07.18 17:33} %D This file is loaded at runtime, thereby providing an excellent place for %D hacks, patches, extensions and new features. diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index b8b306c6c..07cda500d 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -42,7 +42,7 @@ %D has to match \type {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2018.07.17 17:25} +\edef\contextversion{2018.07.18 17:33} \edef\contextkind {beta} %D For those who want to use this: diff --git a/tex/context/base/mkiv/node-ini.lua b/tex/context/base/mkiv/node-ini.lua index 2fa679030..a9f8850b4 100644 --- a/tex/context/base/mkiv/node-ini.lua +++ b/tex/context/base/mkiv/node-ini.lua @@ -383,6 +383,26 @@ nodes.dirvalues = dirvalues nodes.gluevalues = gluevalues nodes.pdfliteralvalues = pdfliteralvalues +nodes.subtypes = { + [nodecodes.accent] = accentcodes, + [nodecodes.boundary] = boundarycodes, + [nodecodes.dir] = dircodes, + [nodecodes.disc] = disccodes, + [nodecodes.fence] = fencecodes, + [nodecodes.glue] = gluecodes, + [nodecodes.glyph] = glyphcodes, + [nodecodes.hlist] = listcodes, + [nodecodes.kern] = kerncodes, + [nodecodes.marginkern] = margincodes, + [nodecodes.math] = mathcodes, + [nodecodes.noad] = noadcodes, + [nodecodes.penalty] = penaltycodes, + [nodecodes.radical] = radicalcodes, + [nodecodes.rule] = rulecodes, + [nodecodes.vlist] = listcodes, + [nodecodes.whatsit] = whatcodes, +} + nodes.skipcodes = gluecodes -- more friendly nodes.directioncodes = dircodes -- more friendly nodes.whatsitcodes = whatcodes -- more official diff --git a/tex/context/base/mkiv/node-ini.mkiv b/tex/context/base/mkiv/node-ini.mkiv index 8f1079163..063f8a8d0 100644 --- a/tex/context/base/mkiv/node-ini.mkiv +++ b/tex/context/base/mkiv/node-ini.mkiv @@ -37,6 +37,7 @@ \registerctxluafile{node-ppt}{} \registerctxluafile{node-scn}{} \registerctxluafile{node-syn}{} +\registerctxluafile{node-par}{} \newcount\c_node_tracers_show_box % box number diff --git a/tex/context/base/mkiv/node-par.lua b/tex/context/base/mkiv/node-par.lua new file mode 100644 index 000000000..e45e6dc16 --- /dev/null +++ b/tex/context/base/mkiv/node-par.lua @@ -0,0 +1,21 @@ +if not modules then modules = { } end modules ['node-par'] = { + version = 1.001, + comment = "companion to node-ini.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local starttiming = statistics.starttiming +local stoptiming = statistics.stoptiming + +local actions = nodes.tasks.actions("everypar") + +local function everypar(head) + starttiming(builders) + head = actions(head) + stoptiming(builders) + return head +end + +callback.register("insert_local_par",everypar,"paragraph start") diff --git a/tex/context/base/mkiv/node-tra.lua b/tex/context/base/mkiv/node-tra.lua index 077506e46..7f359d7fd 100644 --- a/tex/context/base/mkiv/node-tra.lua +++ b/tex/context/base/mkiv/node-tra.lua @@ -70,6 +70,8 @@ local whatcodes = nodes.whatcodes local skipcodes = nodes.skipcodes local fillcodes = nodes.fillcodes +local subtypes = nodes.subtypes + local glyph_code = nodecodes.glyph local hlist_code = nodecodes.hlist local vlist_code = nodecodes.vlist @@ -99,8 +101,9 @@ end function nodes.handlers.checkglyphs(head,message) local h = tonut(head) local t = { } + local f = formatters["%U:%s"] for g in nextglyph, h do - t[#t+1] = formatters["%U:%s"](getchar(g),getsubtype(g)) + t[#t+1] = f(getchar(g),getsubtype(g)) end if #t > 0 then if message and message ~= "" then @@ -125,11 +128,11 @@ function nodes.handlers.checkforleaks(sparse) end end -local f_sequence = formatters["U+%04X:%s"] -local f_subrange = formatters["[[ %s ][ %s ][ %s ]]"] local function tosequence(start,stop,compact) if start then + local f_sequence = formatters["U+%04X:%s"] + local f_subrange = formatters["[[ %s ][ %s ][ %s ]]"] start = tonut(start) stop = stop and tonut(stop) local t = { } @@ -204,6 +207,8 @@ function nodes.idstostring(head,tail) local t = { } local last_id = nil local last_n = 0 + local f_two = formatters["[%s*%s]"] + local f_one = formatters["[%s]"] for n, id, subtype in nextnode, head do if id == whatsit_code then id = whatcodes[subtype] @@ -217,9 +222,9 @@ function nodes.idstostring(head,tail) last_n = last_n + 1 else if last_n > 1 then - t[#t+1] = formatters["[%s*%s]"](last_n,last_id) + t[#t+1] = f_two(last_n,last_id) else - t[#t+1] = formatters["[%s]"](last_id) + t[#t+1] = f_one(last_id) end last_id = id last_n = 1 @@ -232,14 +237,29 @@ function nodes.idstostring(head,tail) t[#t+1] = "no nodes" else if last_n > 1 then - t[#t+1] = formatters["[%s*%s]"](last_n,last_id) + t[#t+1] = f_two(last_n,last_id) else - t[#t+1] = formatters["[%s]"](last_id) + t[#t+1] = f_one(last_id) end end return concat(t," ") end +function nodes.idsandsubtypes(head) + local h = tonut(head) + local t = { } + local f = formatters["%s:%s"] + for n, id, subtype in nextnode, h do + local c = nodecodes[id] + if subtype then + t[#t+1] = f(c,subtypes[id][subtype]) + else + t[#t+1] = c + end + end + return concat(t, " ") +end + -- function nodes.xidstostring(head,tail) -- only for special tracing of backlinks -- head = tonut(head) -- tail = tonut(tail) @@ -304,17 +324,19 @@ nodes.showsimplelist = function(h,depth) showsimplelist(h,depth,0) end local function listtoutf(h,joiner,textonly,last,nodisc) local w = { } local n = 0 + local g = formatters["<%i>"] + local d = formatters["[%s|%s|%s]"] while h do local c, id = isglyph(h) if c then - n = n + 1 ; w[n] = c >= 0 and utfchar(c) or formatters["<%i>"](c) + n = n + 1 ; w[n] = c >= 0 and utfchar(c) or g(c) if joiner then n = n + 1 ; w[n] = joiner end elseif id == disc_code then local pre, pos, rep = getdisc(h) if not nodisc then - n = n + 1 ; w[n] = formatters["[%s|%s|%s]"] ( + n = n + 1 ; w[n] = d( pre and listtoutf(pre,joiner,textonly) or "", pos and listtoutf(pos,joiner,textonly) or "", rep and listtoutf(rep,joiner,textonly) or "" diff --git a/tex/context/base/mkiv/node-tsk.lua b/tex/context/base/mkiv/node-tsk.lua index b61515aed..aa59d1d5d 100644 --- a/tex/context/base/mkiv/node-tsk.lua +++ b/tex/context/base/mkiv/node-tsk.lua @@ -277,22 +277,12 @@ function tasks.table(name) --maybe move this to task-deb.lua end end --- -- shipouts -- -- +-- -- shipouts everypar -- -- -- the shipout handlers acts on boxes so we don't need to return something -- and also don't need to keep the state (done) -tasks.new { - name = "shipouts", - processor = nodeprocessor, - sequence = { - "before", -- users - "normalizers", -- system - "finishers", -- system - "after", -- users - "wrapup", -- system - }, - templates = { +local templates = { default = [[ return function(head) @@ -330,7 +320,30 @@ nonut = [[ %action%(nuthead) ]], - } +} + +tasks.new { + name = "shipouts", + processor = nodeprocessor, + sequence = { + "before", -- users + "normalizers", -- system + "finishers", -- system + "after", -- users + "wrapup", -- system + }, + templates = templates +} + +tasks.new { + name = "everypar", + processor = nodeprocessor, + sequence = { + "before", -- users + "normalizers", -- system + "after", -- users + }, + templates = templates, } -- -- finalizers -- -- diff --git a/tex/context/base/mkiv/page-flt.mkiv b/tex/context/base/mkiv/page-flt.mkiv index a06c90ec1..83e2b4954 100644 --- a/tex/context/base/mkiv/page-flt.mkiv +++ b/tex/context/base/mkiv/page-flt.mkiv @@ -284,16 +284,16 @@ \doifnotinset\v!low\floatspecification\vfill}% \page_otr_fill_and_eject_page} -\let\m_page_otf_checked_page_float\relax +\let\m_page_otr_checked_page_float\relax \unexpanded\def\page_floats_flush_page_floats % used in postpone - {\edef\m_page_otf_checked_page_float{\clf_checkedpagefloat}% - \ifx\m_page_otf_checked_page_float\empty + {\edef\m_page_otr_checked_page_float{\clf_checkedpagefloat}% + \ifx\m_page_otr_checked_page_float\empty % nothing - \else\ifx\m_page_otf_checked_page_float\v!empty + \else\ifx\m_page_otr_checked_page_float\v!empty \emptyhbox \page_otr_fill_and_eject_page % why not dummy_page \else - \page_floats_flush_page_floats_indeed\m_page_otf_checked_page_float + \page_floats_flush_page_floats_indeed\m_page_otr_checked_page_float \fi\fi} % temp hack, needed to prevent floatbox being forgotten during diff --git a/tex/context/base/mkiv/page-otr.mkvi b/tex/context/base/mkiv/page-otr.mkvi index ebaf17ebc..909f5cd4d 100644 --- a/tex/context/base/mkiv/page-otr.mkvi +++ b/tex/context/base/mkiv/page-otr.mkvi @@ -97,7 +97,7 @@ \newconstant\c_page_otr_eject_penalty \c_page_otr_eject_penalty -\plustenthousand \newconstant\c_page_otr_super_penalty \c_page_otr_super_penalty -\plustwentythousand -\newcount \c_page_otf_trigger_penalty \c_page_otf_trigger_penalty -100010 +\newcount \c_page_otr_trigger_penalty \c_page_otr_trigger_penalty -100010 \newif \ifinotr % we keep this (name) for old times sake @@ -127,9 +127,9 @@ \endgroup} \unexpanded\def\installoutputroutine#invoke#action% \invoke \action - {\global\advance\c_page_otf_trigger_penalty\minusone - \edef#invoke{\page_otr_trigger{\number\c_page_otf_trigger_penalty}}% - \setvalue{\??otrtriggers\number\c_page_otf_trigger_penalty}{#action}} + {\global\advance\c_page_otr_trigger_penalty\minusone + \edef#invoke{\page_otr_trigger{\number\c_page_otr_trigger_penalty}}% + \setvalue{\??otrtriggers\number\c_page_otr_trigger_penalty}{#action}} \unexpanded\def\page_otr_triggered_output_routine_traced {\ifcsname\??otrtriggers\the\outputpenalty\endcsname @@ -160,7 +160,7 @@ \ifdefined\everybeforeoutput \else \newtoks\everybeforeoutput \fi \ifdefined\everyafteroutput \else \newtoks\everyafteroutput \fi -\def\page_otf_set_engine_output_routine#content% +\def\page_otr_set_engine_output_routine#content% {\global\output {\inotrtrue \the\everybeforeoutput @@ -172,7 +172,7 @@ % \ifdefined\everybeforeoutputgroup \else \newtoks\everybeforeoutputgroup \fi % \ifdefined\everyafteroutputgroup \else \newtoks\everyafteroutputgroup \fi % -% \def\page_otf_set_engine_output_routine#content% +% \def\page_otr_set_engine_output_routine#content% % {\the\everybeforeoutputgroup % \global\output % {\inotrtrue @@ -187,7 +187,7 @@ % \fi % \to \everyafteroutputgroup -\page_otf_set_engine_output_routine\page_otr_triggered_output_routine +\page_otr_set_engine_output_routine\page_otr_triggered_output_routine \installoutputroutine\synchronizeoutput % use \triggerpagebuilder instead {\ifvoid\normalpagebox\else diff --git a/tex/context/base/mkiv/spac-ver.lua b/tex/context/base/mkiv/spac-ver.lua index 4a09379b1..06b05f5e0 100644 --- a/tex/context/base/mkiv/spac-ver.lua +++ b/tex/context/base/mkiv/spac-ver.lua @@ -171,7 +171,8 @@ local new_rule = nodepool.rule local nodecodes = nodes.nodecodes local skipcodes = nodes.skipcodes -local penaltycodes = nodes.penaltycodes +----- penaltycodes = nodes.penaltycodes +----- listcodes = nodes.listcodes local penalty_code = nodecodes.penalty local kern_code = nodecodes.kern @@ -179,9 +180,10 @@ local glue_code = nodecodes.glue local insert_code = nodecodes.ins local hlist_code = nodecodes.hlist local vlist_code = nodecodes.vlist +local rule_code = nodecodes.rule local localpar_code = nodecodes.localpar -local linebreak_code = penaltycodes.linebreakpenalty +local linebreak_code = nodes.penaltycodes.linebreakpenalty local userskip_code = skipcodes.userskip local lineskip_code = skipcodes.lineskip @@ -190,6 +192,8 @@ local parskip_code = skipcodes.parskip local topskip_code = skipcodes.topskip local splittopskip_code = skipcodes.splittopskip +local line_code = nodes.listcodes.line + local abovedisplayskip_code = skipcodes.abovedisplayskip local belowdisplayskip_code = skipcodes.belowdisplayskip local abovedisplayshortskip_code = skipcodes.abovedisplayshortskip @@ -2023,7 +2027,6 @@ do local outer = texnest[0] local enabled = true - local count = true local trace = false local report = logs.reporter("vspacing") @@ -2032,38 +2035,9 @@ do end) directives.register("vspacing.synchronizepage",function(v) - if v == true or v == "count" then - enabled = true - count = true - elseif v == "first" then - enabled = true - count = false - else - enabled = false - count = false - end + enabled = v end) - -- hm, check the old one - - -- function vspacing.synchronizepage() - -- if enabled then - -- local head = texlists.hold_head - -- local skip = 0 - -- while head and head.id == insert_code do - -- head = head.next - -- skip = skip + 1 - -- end - -- if head then - -- outer.prevdepth = 0 - -- end - -- if trace then - -- report("prevdepth %s at page %i, skipped %i, value %p", - -- head and "reset" or "kept",texgetcount("realpageno"),skip,outer.prevdepth) - -- end - -- end - -- end - local ignoredepth = -65536000 function vspacing.synchronizepage() @@ -2072,60 +2046,60 @@ do local olddepth = newdepth local oldlines = outer.prevgraf local newlines = 0 - local boxfound = false - local head = texlists.contrib_head + local head = texlists.page_head if head then - local tail = find_node_tail(tonut(head)) - while tail do - local id = getid(tail) - if id == hlist_code then - if not boxfound then - newdepth = getdepth(tail) - boxfound = true - end - newlines = newlines + 1 - if not count then - break - end - elseif id == vlist_code then - if not boxfound then - newdepth = getdepth(tail) - boxfound = true - end - break - elseif id == glue_code then - local subtype = getsubtype(tail) - if not (subtype == baselineskip_code or subtype == lineskip_code) then - break - elseif boxfound and not count then + head = tonut(head) + if getid(head) == glue_code and getsubtype(head) == topskip_code then + local tail = find_node_tail(head) + while tail do + local id = getid(tail) + if id == hlist_code then + if getsubtype(tail) == line_code then + newlines = newlines + 1 + else + break + end + elseif id == vlist_code then break - end - elseif id == penalty_code then - if boxfound and not count then + elseif id == glue_code then + local subtype = getsubtype(tail) + if subtype == baselineskip_code or subtype == lineskip_code then + -- we're ok + elseif subtype == parskip_code then + if getwidth(tail) > 0 then + break + else + -- we assume we're ok + end + end + elseif id == penalty_code then + -- we're probably ok + elseif id == rule_code or id == kern_code then break + else + -- ins, mark, boundary, whatsit end - else - -- ins, mark, kern, rule, boundary, whatsit - break + tail = getprev(tail) end - tail = getprev(tail) end - end - if boxfound then - -- what if newdepth ... else + newdepth = ignoredepth texset("prevdepth",ignoredepth) outer.prevdepth = ignoredepth end texset("prevgraf", newlines) outer.prevgraf = newlines if trace then - report("page %i, prevdepth %p (last depth %p), prevgraf %i (from %i), %sboxes", - texgetcount("realpageno"),olddepth,newdepth,oldlines,newlines,boxfound and "" or "no ") + report("page %i, prevdepth %p => %p, prevgraf %i => %i", + texgetcount("realpageno"),olddepth,newdepth,oldlines,newlines) + report("list %s",nodes.idsandsubtypes(head)) end end end + + + local trace = false trackers.register("vspacing.forcestrutdepth",function(v) trace = v end) diff --git a/tex/context/base/mkiv/spac-ver.mkiv b/tex/context/base/mkiv/spac-ver.mkiv index d67cb4faf..e49784753 100644 --- a/tex/context/base/mkiv/spac-ver.mkiv +++ b/tex/context/base/mkiv/spac-ver.mkiv @@ -1309,9 +1309,27 @@ \let\normaloffinterlineskip\offinterlineskip % knuth's original +%D This is tricky. The prevdepth value is still set to the last +%D one even if there is nothing on the page. The same is true for +%D prevgraf, which doesn't resemble the value on the current page. +%D +%D So, here we kick in a checker but it has to happen after the +%D output group and it only has to be done once (output can trigger +%D itself!). + +\unexpanded\def\page_otr_synchronize_page_yes + {\aftergroup\page_otr_synchronize_page_indeed + \glet\page_otr_synchronize_page\relax} + +\unexpanded\def\page_otr_synchronize_page_indeed + {\clf_synchronizepage + \glet\page_otr_synchronize_page\page_otr_synchronize_page_yes} + +\let\page_otr_synchronize_page\page_otr_synchronize_page_yes + \appendtoks - \ifvmode\clf_synchronizepage\fi % a nasty hack (tested for a while now) -\to \everyafteroutput + \page_otr_synchronize_page +\to \everyaftershipout %D My own one: diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf index e9de48e49..3106a2cfb 100644 Binary files a/tex/context/base/mkiv/status-files.pdf and b/tex/context/base/mkiv/status-files.pdf differ diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf index a3627d2c6..61d33704a 100644 Binary files a/tex/context/base/mkiv/status-lua.pdf and b/tex/context/base/mkiv/status-lua.pdf differ diff --git a/tex/context/base/mkiv/strc-blk.lua b/tex/context/base/mkiv/strc-blk.lua index 703d36379..4e129a842 100644 --- a/tex/context/base/mkiv/strc-blk.lua +++ b/tex/context/base/mkiv/strc-blk.lua @@ -43,11 +43,11 @@ job.register('structures.blocks.collected', tobesaved, initializer) local listitem = utilities.parsers.listitem -function blocks.print(name,data,hide) +function blocks.print(name,data,parameters,hide) if hide then - context.dostarthiddenblock(name) + context.dostarthiddenblock(name, parameters) else - context.dostartnormalblock(name) + context.dostartnormalblock(name, parameters) end context.viafile(data,format("block.%s",validstring(name,"noname"))) if hide then @@ -98,12 +98,12 @@ function blocks.select(state,name,tag,criterium) local metadata = ri.metadata if names[metadata.name] then if all then - blocks.print(name,ri.data,hide) + blocks.print(name,ri.data,ri.parameters,hide) else local mtags = metadata.tags for tag, sta in next, tags do if mtags[tag] then - blocks.print(name,ri.data,hide) + blocks.print(name,ri.data,ri.parameters,hide) break end end @@ -112,7 +112,7 @@ function blocks.select(state,name,tag,criterium) end end -function blocks.save(name,tag,buffer) -- wrong, not yet adapted +function blocks.save(name,tag,parameters,buffer) -- wrong, not yet adapted local data = buffers.getcontent(buffer) local tags = settings_to_set(tag) local plus, minus = false, false @@ -129,24 +129,25 @@ function blocks.save(name,tag,buffer) -- wrong, not yet adapted section = sections.currentid(), }, data = data or "error", + parameters = parameters, } local allstate = states[name].all if not next(tags) then if allstate ~= "hide" then - blocks.print(name,data) + blocks.print(name,data,parameters) elseif plus then - blocks.print(name,data,true) + blocks.print(name,data,parameters,true) end else local sn = states[name] for tag, _ in next, tags do if sn[tag] == nil then if allstate ~= "hide" then - blocks.print(name,data) + blocks.print(name,data,parameters) break end elseif sn[tag] ~= "hide" then - blocks.print(name,data) + blocks.print(name,data,parameters) break end end @@ -157,6 +158,6 @@ end -- interface implement { name = "definestructureblock", actions = blocks.define, arguments = "string" } -implement { name = "savestructureblock", actions = blocks.save, arguments = "3 strings" } +implement { name = "savestructureblock", actions = blocks.save, arguments = "4 strings" } implement { name = "selectstructureblock", actions = blocks.select, arguments = "4 strings" } implement { name = "setstructureblockstate", actions = blocks.setstate, arguments = "3 strings" } diff --git a/tex/context/base/mkiv/strc-blk.mkiv b/tex/context/base/mkiv/strc-blk.mkiv index c42bb25ec..1ff7ec51b 100644 --- a/tex/context/base/mkiv/strc-blk.mkiv +++ b/tex/context/base/mkiv/strc-blk.mkiv @@ -34,14 +34,14 @@ \appendtoks \clf_definestructureblock{\currentblock}% - \setuevalue{\e!begin\currentblock}{\dodoubleempty\strc_blocks_begin[\currentblock]}% + \setuevalue{\e!begin\currentblock}{\dotripleempty\strc_blocks_begin[\currentblock]}% \setuevalue{\e!end \currentblock}{}% \to \everydefineblock -\unexpanded\def\strc_blocks_begin[#1][#2]% +\unexpanded\def\strc_blocks_begin[#1][#2][#3]% {\normalexpanded{\buff_pickup{@block@}{\e!begin#1}{\e!end#1}} {}% before - {\clf_savestructureblock{#1}{#2}{@block@}}% + {\clf_savestructureblock{#1}{#2}{#3}{@block@}}% \plusone}% after \let\strc_blocks_setup\relax @@ -54,10 +54,11 @@ {\dostopnormalblock \stopnointerference} -\unexpanded\def\dostartnormalblock#1% called at lua end +\unexpanded\def\dostartnormalblock#1#2% called at lua end {\bgroup \visibletrue % will change \edef\currentblock{#1}% + \setupcurrentblock[#2]% \strc_blocks_setup \let\strc_blocks_setup\relax \blockparameter\c!before diff --git a/tex/context/base/mkiv/task-ini.lua b/tex/context/base/mkiv/task-ini.lua index 3d16482a5..5695be936 100644 --- a/tex/context/base/mkiv/task-ini.lua +++ b/tex/context/base/mkiv/task-ini.lua @@ -139,6 +139,8 @@ appendaction("mvlbuilders", "normalizers", "builders.vspacing.pagehandler", appendaction("mvlbuilders", "normalizers", "builders.profiling.pagehandler", nil, "nut", "disabled" ) appendaction("mvlbuilders", "normalizers", "typesetters.checkers.handler", nil, "nut", "disabled" ) +appendaction("everypar", "normalizers", "nodes.handlers.checkparcounter", nil, "nut", "disabled" ) + -- some protection freezecallbacks("find_.*_file", "find file using resolver") @@ -173,6 +175,8 @@ freezegroup("vboxbuilders", "normalizers") freezegroup("math", "normalizers") freezegroup("math", "builders") +freezegroup("everypar", "normalizers") + -- new: disabled here directives.register("nodes.basepass", function(v) diff --git a/tex/context/base/mkiv/typo-bld.lua b/tex/context/base/mkiv/typo-bld.lua index d3dddc990..54dfacc15 100644 --- a/tex/context/base/mkiv/typo-bld.lua +++ b/tex/context/base/mkiv/typo-bld.lua @@ -139,7 +139,7 @@ end -- also for testing (now also surrounding spacing done) -function builders.paragraphs.constructors.methods.oneline(head,followed_by_display) +function parbuilders.constructors.methods.oneline(head,followed_by_display) -- when needed we will turn this into a helper local t = texnest[texnest.ptr] local h = hpack_node(head) diff --git a/tex/context/interface/mkiv/i-context.pdf b/tex/context/interface/mkiv/i-context.pdf index aa46a705e..b467a753e 100644 Binary files a/tex/context/interface/mkiv/i-context.pdf and b/tex/context/interface/mkiv/i-context.pdf differ diff --git a/tex/context/interface/mkiv/i-readme.pdf b/tex/context/interface/mkiv/i-readme.pdf index 49e97c2b7..a7b264970 100644 Binary files a/tex/context/interface/mkiv/i-readme.pdf and b/tex/context/interface/mkiv/i-readme.pdf differ diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 536e4f7ee..043b461d7 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 : 07/17/18 17:25:02 +-- merge date : 07/18/18 17:33:07 do -- begin closure to overcome local limits and interference -- cgit v1.2.3