summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2018-04-19 17:37:21 +0200
committerContext Git Mirror Bot <phg42.2a@gmail.com>2018-04-19 17:37:21 +0200
commitd817aef76ab8b606c02bd0636661b634b43a68a6 (patch)
treeb222d7a356ebe7f1f2267f6aa4f4e424a4d6d88c /tex/context/base/mkiv
parentd57683f5f67d6651f7b3353ff347ae57a409e0d4 (diff)
downloadcontext-d817aef76ab8b606c02bd0636661b634b43a68a6.tar.gz
2018-04-19 16:02:00
Diffstat (limited to 'tex/context/base/mkiv')
-rw-r--r--tex/context/base/mkiv/buff-ini.mkiv8
-rw-r--r--tex/context/base/mkiv/cldf-scn.lua5
-rw-r--r--tex/context/base/mkiv/cont-new.mkiv2
-rw-r--r--tex/context/base/mkiv/context.mkiv2
-rw-r--r--tex/context/base/mkiv/font-cff.lua15
-rw-r--r--tex/context/base/mkiv/font-dsp.lua23
-rw-r--r--tex/context/base/mkiv/font-osd.lua62
-rw-r--r--tex/context/base/mkiv/font-otr.lua28
-rw-r--r--tex/context/base/mkiv/font-ttf.lua17
-rw-r--r--tex/context/base/mkiv/font-web.lua20
-rw-r--r--tex/context/base/mkiv/luat-lib.mkiv3
-rw-r--r--tex/context/base/mkiv/mult-ini.mkiv2
-rw-r--r--tex/context/base/mkiv/mult-low.lua2
-rw-r--r--tex/context/base/mkiv/mult-prm.lua12
-rw-r--r--tex/context/base/mkiv/node-bck.lua187
-rw-r--r--tex/context/base/mkiv/node-bck.mkiv19
-rw-r--r--tex/context/base/mkiv/node-nut.lua18
-rw-r--r--tex/context/base/mkiv/node-rul.lua45
-rw-r--r--tex/context/base/mkiv/node-rul.mkiv8
-rw-r--r--tex/context/base/mkiv/node-tsk.lua54
-rw-r--r--tex/context/base/mkiv/pack-bck.mkvi48
-rw-r--r--tex/context/base/mkiv/status-files.pdfbin26106 -> 26106 bytes
-rw-r--r--tex/context/base/mkiv/status-lua.pdfbin256772 -> 256921 bytes
-rw-r--r--tex/context/base/mkiv/strc-sbe.mkiv4
-rw-r--r--tex/context/base/mkiv/tabl-tbl.mkiv114
-rw-r--r--tex/context/base/mkiv/task-ini.lua20
-rw-r--r--tex/context/base/mkiv/toks-scn.lua70
-rw-r--r--tex/context/base/mkiv/typo-bld.lua57
-rw-r--r--tex/context/base/mkiv/util-seq.lua75
29 files changed, 673 insertions, 247 deletions
diff --git a/tex/context/base/mkiv/buff-ini.mkiv b/tex/context/base/mkiv/buff-ini.mkiv
index 6baf752cd..b139e2b51 100644
--- a/tex/context/base/mkiv/buff-ini.mkiv
+++ b/tex/context/base/mkiv/buff-ini.mkiv
@@ -44,8 +44,12 @@
% \def\buff_start_indeed#1#2#3#4#5% \donothing needed ! #5=undent)
% {\normalexpanded{\buff_pickup{#2}{#3}{#4}{}{\buff_stop{#4}}\plusone}}
+% \def\buff_start_indeed#1#2#3#4%
+% {\normalexpanded{\buff_pickup{#2}{#3}{#4}{}{\buff_stop{#4}}\plusone}}
+
\def\buff_start_indeed#1#2#3#4%
- {\normalexpanded{\buff_pickup{#2}{#3}{#4}{}{\buff_stop{#4}}\plusone}}
+ {\edef\p_strip{\namedbufferparameter{#1}\c!strip}% for aditya
+ \normalexpanded{\buff_pickup{#2}{#3}{#4}{}{\buff_stop{#4}}\ifx\p_strip\v!no\zerocount\else\plusone\fi}}
\unexpanded\def\grabbufferdata % was: \dostartbuffer
{\begingroup % (4)
@@ -155,7 +159,7 @@
\setexpandedbufferparameter\c!number{\number\c_buff_n_of_defined}%
\edef\currentdefinedbuffer{def-\number\c_buff_n_of_defined}%
\setuevalue{\e!start\currentbuffer}{\buff_start_defined{\currentbuffer}{\currentdefinedbuffer}{\e!start\currentbuffer}{\e!stop\currentbuffer}}%
- \setuevalue{\e!get\currentbuffer }{\buff_get_stored{\currentbuffer}{\currentdefinedbuffer}}%
+ \setuevalue{\e!get \currentbuffer}{\buff_get_stored {\currentbuffer}{\currentdefinedbuffer}}%
\to \everydefinebuffer
\unexpanded\def\buff_start_defined
diff --git a/tex/context/base/mkiv/cldf-scn.lua b/tex/context/base/mkiv/cldf-scn.lua
index ccf1f01c6..a8dddc6c8 100644
--- a/tex/context/base/mkiv/cldf-scn.lua
+++ b/tex/context/base/mkiv/cldf-scn.lua
@@ -25,6 +25,7 @@ local scanners = interfaces.scanners
local register = interfaces.registerscanner
local compile = tokens.compile or function() end
+local presets = tokens.presets
local dummy = function() end
@@ -47,6 +48,10 @@ function interfaces.implement(specification)
if name == "" then
name = nil
end
+ local p = arguments and presets[arguments]
+ if p then
+ arguments = p
+ end
local scanner
local resetter = onlyonce and name and commands.ctxresetter(name)
if resetter then
diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv
index e0353b955..9fa8f68a4 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.04.16 12:05}
+\newcontextversion{2018.04.19 15:53}
%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 9a05525a1..24482906c 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.04.16 12:05}
+\edef\contextversion{2018.04.19 15:53}
\edef\contextkind {beta}
%D For those who want to use this:
diff --git a/tex/context/base/mkiv/font-cff.lua b/tex/context/base/mkiv/font-cff.lua
index 1d4f01007..87234dd46 100644
--- a/tex/context/base/mkiv/font-cff.lua
+++ b/tex/context/base/mkiv/font-cff.lua
@@ -47,6 +47,21 @@ local setposition = streamreader.setposition
local getposition = streamreader.getposition
local readbytetable = streamreader.readbytetable
+directives.register("fonts.streamreader",function()
+
+ streamreader = utilities.streams
+
+ readstring = streamreader.readstring
+ readbyte = streamreader.readcardinal1
+ readushort = streamreader.readcardinal2
+ readuint = streamreader.readcardinal3
+ readulong = streamreader.readcardinal4
+ setposition = streamreader.setposition
+ getposition = streamreader.getposition
+ readbytetable = streamreader.readbytetable
+
+end)
+
local setmetatableindex = table.setmetatableindex
local trace_charstrings = false trackers.register("fonts.cff.charstrings",function(v) trace_charstrings = v end)
diff --git a/tex/context/base/mkiv/font-dsp.lua b/tex/context/base/mkiv/font-dsp.lua
index 77b2b7ff0..c896aa711 100644
--- a/tex/context/base/mkiv/font-dsp.lua
+++ b/tex/context/base/mkiv/font-dsp.lua
@@ -97,6 +97,29 @@ local readfword = readshort
local readbytetable = streamreader.readbytetable
local readbyte = streamreader.readbyte
+directives.register("fonts.streamreader",function()
+
+ streamreader = utilities.streams
+
+ setposition = streamreader.setposition
+ getposition = streamreader.getposition
+ readushort = streamreader.readcardinal2
+ readulong = streamreader.readcardinal4
+ readinteger = streamreader.readinteger1
+ readshort = streamreader.readinteger2
+ readstring = streamreader.readstring
+ readtag = streamreader.readtag
+ readbytes = streamreader.readbytes
+ readfixed = streamreader.readfixed4
+ read2dot14 = streamreader.read2dot14
+ skipshort = streamreader.skipshort
+ skipbytes = streamreader.skip
+ readfword = readshort
+ readbytetable = streamreader.readbytetable
+ readbyte = streamreader.readbyte
+
+end)
+
local gsubhandlers = { }
local gposhandlers = { }
diff --git a/tex/context/base/mkiv/font-osd.lua b/tex/context/base/mkiv/font-osd.lua
index 9f99fd57f..51f644ad1 100644
--- a/tex/context/base/mkiv/font-osd.lua
+++ b/tex/context/base/mkiv/font-osd.lua
@@ -293,10 +293,6 @@ if not indicgroups and characters then
characters.indicgroups = indicgroups
-else
-
- indicgroups = table.setmetatableindex("table")
-
end
local consonant = indicgroups.consonant
@@ -422,19 +418,19 @@ local sequence_remove_joiners = {
-- as it might depends on the font. Not that it's a bottleneck.
local basic_shaping_forms = {
- init = true, -- new
- abvs = true, -- new
+ -- init = true, -- new
+ -- abvs = true, -- new
akhn = true,
blwf = true,
- calt = true, -- new
+ -- calt = true, -- new
cjct = true,
half = true,
- haln = true, -- new
+ -- haln = true, -- new
nukt = true,
pref = true,
- pres = true, -- new
+ -- pres = true, -- new
pstf = true,
- psts = true, -- new
+ -- psts = true, -- new
rkrf = true,
rphf = true,
vatu = true,
@@ -605,9 +601,7 @@ local function initializedevanagi(tfmdata)
end
end
end
-if reph then
- seqsubset[#seqsubset+1] = { kind, coverage, reph }
-end
+ seqsubset[#seqsubset+1] = { kind, coverage, reph }
end
end
end
@@ -691,6 +685,19 @@ registerotffeature {
},
}
+local show_syntax_errors = false
+
+local function inject_syntax_error(head,current,char)
+ local signal = copy_node(current)
+ copyinjection(signal,current)
+ if pre_mark[char] then
+ setchar(signal,dotted_circle)
+ else
+ setchar(current,dotted_circle)
+ end
+ return insert_node_after(head,current,signal)
+end
+
-- hm, this is applied to one character:
local function initialize_one(font,attr) -- we need a proper hook into the dataset initializer
@@ -793,10 +800,9 @@ local function reorder_one(head,start,stop,font,attr,nbspaces)
setprop(tempcurrent,a_state,unsetvalue)
if getchar(next) == getchar(tempcurrent) then
flush_list(tempcurrent)
- local n = copy_node(current)
- copyinjection(n,current) -- KE: necessary? HH: probably not as positioning comes later and we rawget/set
- setchar(current,dotted_circle)
- head = insert_node_after(head, current, n)
+ if show_syntax_errors then
+ head, current = inject_syntax_error(head,current,char)
+ end
else
setchar(current,getchar(tempcurrent)) -- we assumes that the result of blwf consists of one node
local freenode = getnext(current)
@@ -1217,7 +1223,7 @@ function handlers.devanagari_reorder_reph(head,start)
while current do
local char = ischar(current,startfont)
if char and getprop(current,a_syllabe) == startattr then
- if not c and mark_above_below_post[char] and after_subscript[char] then
+ if not c and mark_above_below_post[char] and not after_subscript[char] then
c = current
end
current = getnext(current)
@@ -1560,10 +1566,9 @@ local function reorder_two(head,start,stop,font,attr,nbspaces) -- maybe do a pas
setprop(current,a_state,unsetvalue)
if halant[getchar(current)] then
setnext(getnext(current),tmp)
- local nc = copy_node(current)
- copyinjection(nc,current)
- setchar(current,dotted_circle)
- head = insert_node_after(head,current,nc)
+ if show_syntax_errors then
+ head, current = inject_syntax_error(head,current,char)
+ end
else
setnext(current,tmp) -- assumes that result of pref, blwf, or pstf consists of one node
if changestop then
@@ -2058,19 +2063,6 @@ local function analyze_next_chars_two(c,font)
end
end
-local show_syntax_errors = false
-
-local function inject_syntax_error(head,current,char)
- local signal = copy_node(current)
- copyinjection(signal,current)
- if pre_mark[char] then
- setchar(signal,dotted_circle)
- else
- setchar(current,dotted_circle)
- end
- return insert_node_after(head,current,signal)
-end
-
-- It looks like these two analyzers were written independently but they share
-- a lot. Common code has been synced.
diff --git a/tex/context/base/mkiv/font-otr.lua b/tex/context/base/mkiv/font-otr.lua
index 5bac75052..8b5c676c1 100644
--- a/tex/context/base/mkiv/font-otr.lua
+++ b/tex/context/base/mkiv/font-otr.lua
@@ -126,6 +126,34 @@ function streamreader.readtag(f)
return lower(stripstring(readstring(f,4)))
end
+directives.register("fonts.streamreader",function()
+
+ streamreader = utilities.streams
+
+ openfile = streamreader.open
+ closefile = streamreader.close
+ setposition = streamreader.setposition
+ skipshort = streamreader.skipshort
+ readbytes = streamreader.readbytes
+ readstring = streamreader.readstring
+ readbyte = streamreader.readcardinal1
+ readushort = streamreader.readcardinal2
+ readuint = streamreader.readcardinal3
+ readulong = streamreader.readcardinal4
+ readshort = streamreader.readinteger2
+ readlong = streamreader.readinteger4
+ readfixed = streamreader.readfixed4
+ read2dot14 = streamreader.read2dot14
+ readfword = readshort
+ readufword = readushort
+ readoffset = readushort
+
+ function streamreader.readtag(f)
+ return lower(stripstring(readstring(f,4)))
+ end
+
+end)
+
-- date represented in number of seconds since 12:00 midnight, January 1, 1904. The value is represented as a
-- signed 64-bit integer
diff --git a/tex/context/base/mkiv/font-ttf.lua b/tex/context/base/mkiv/font-ttf.lua
index df08787f9..181bfbcc6 100644
--- a/tex/context/base/mkiv/font-ttf.lua
+++ b/tex/context/base/mkiv/font-ttf.lua
@@ -56,6 +56,23 @@ local readshort = streamreader.readinteger2 -- 16-bit signed integer
local read2dot14 = streamreader.read2dot14 -- 16-bit signed fixed number with the low 14 bits of fraction (2.14) (F2DOT14)
local readinteger = streamreader.readinteger1
+directives.register("fonts.streamreader",function()
+
+ streamreader = utilities.streams
+
+ setposition = streamreader.setposition
+ getposition = streamreader.getposition
+ skipbytes = streamreader.skip
+ readbyte = streamreader.readcardinal1
+ readushort = streamreader.readcardinal2
+ readulong = streamreader.readcardinal4
+ readchar = streamreader.readinteger1
+ readshort = streamreader.readinteger2
+ read2dot14 = streamreader.read2dot14
+ readinteger = streamreader.readinteger1
+
+end)
+
local helpers = readers.helpers
local gotodatatable = helpers.gotodatatable
diff --git a/tex/context/base/mkiv/font-web.lua b/tex/context/base/mkiv/font-web.lua
index 452a8f59b..376b036f2 100644
--- a/tex/context/base/mkiv/font-web.lua
+++ b/tex/context/base/mkiv/font-web.lua
@@ -23,18 +23,30 @@ local streamwriter = readers and readers.streamwriter or utilities.files
local readstring = streamreader.readstring
local readcardinal2 = streamreader.readcardinal2
local readcardinal4 = streamreader.readcardinal4
+local getsize = streamreader.getsize
+local setposition = streamreader.setposition
+local getposition = streamreader.getposition
local writestring = streamwriter.writestring
local writecardinal4 = streamwriter.writecardinal4
local writecardinal2 = streamwriter.writecardinal2
local writebyte = streamwriter.writebyte
-local getsize = streamreader.getsize
-local setposition = streamreader.setposition
-local getposition = streamreader.getposition
-
local decompress = zlib.decompress
+directives.register("fonts.streamreader",function()
+
+ streamreader = utilities.streams
+
+ readstring = streamreader.readstring
+ readcardinal2 = streamreader.readcardinal2
+ readcardinal4 = streamreader.readcardinal4
+ getsize = streamreader.getsize
+ setposition = streamreader.setposition
+ getposition = streamreader.getposition
+
+end)
+
local infotags = {
["os/2"] = true,
["head"] = true,
diff --git a/tex/context/base/mkiv/luat-lib.mkiv b/tex/context/base/mkiv/luat-lib.mkiv
index 0df31a4e5..320d68920 100644
--- a/tex/context/base/mkiv/luat-lib.mkiv
+++ b/tex/context/base/mkiv/luat-lib.mkiv
@@ -19,7 +19,7 @@
\registerctxluafile{util-sac}{optimize}
\registerctxluafile{util-sto}{} % could also be done in trac-deb.mkiv
\registerctxluafile{util-pck}{}
-\registerctxluafile{util-seq}{}
+% \registerctxluafile{util-seq}{}
%registerctxluafile{util-mrg}{} % not needed in context itself, only mtxrun
%registerctxluafile{util-lua}{} % moved
\registerctxluafile{util-prs}{}
@@ -35,6 +35,7 @@
\registerctxluafile{util-deb}{} % could also be done in trac-deb.mkiv
\registerctxluafile{util-tpl}{} % needs tracker
+\registerctxluafile{util-seq}{}
\registerctxluafile{util-sta}{}
diff --git a/tex/context/base/mkiv/mult-ini.mkiv b/tex/context/base/mkiv/mult-ini.mkiv
index d66749d14..ef9dcd249 100644
--- a/tex/context/base/mkiv/mult-ini.mkiv
+++ b/tex/context/base/mkiv/mult-ini.mkiv
@@ -111,6 +111,8 @@
\def\s!spread{spread} \let\!!spread\s!spread % obsolete
\def\s!plus {plus} \let\!!plus \s!plus % obsolete
\def\s!minus {minus} \let\!!minus \s!minus % obsolete
+\def\s!left {left}
+\def\s!right {right}
\def\s!fil {fil}
\def\s!fill {fill} \let\!!fill \s!fill % obsolete
\def\s!filll {filll}
diff --git a/tex/context/base/mkiv/mult-low.lua b/tex/context/base/mkiv/mult-low.lua
index be5e90889..e10a8e6fa 100644
--- a/tex/context/base/mkiv/mult-low.lua
+++ b/tex/context/base/mkiv/mult-low.lua
@@ -165,6 +165,8 @@ return {
"then",
"begcsname",
--
+ "autorule",
+ --
"strippedcsname","checkedstrippedcsname",
--
"firstargumentfalse", "firstargumenttrue",
diff --git a/tex/context/base/mkiv/mult-prm.lua b/tex/context/base/mkiv/mult-prm.lua
index 50b798b79..6351df180 100644
--- a/tex/context/base/mkiv/mult-prm.lua
+++ b/tex/context/base/mkiv/mult-prm.lua
@@ -231,8 +231,8 @@ return {
"breakafterdirmode",
"catcodetable",
"clearmarks",
- "copyfont",
"compoundhyphenmode",
+ "copyfont",
"crampeddisplaystyle",
"crampedscriptscriptstyle",
"crampedscriptstyle",
@@ -298,10 +298,10 @@ return {
"mathpenaltiesmode",
"mathrulesfam",
"mathrulesmode",
- "mathscriptsmode",
- "mathscriptcharmode",
- "mathscriptboxmode",
"mathrulethicknessmode",
+ "mathscriptboxmode",
+ "mathscriptcharmode",
+ "mathscriptsmode",
"mathstyle",
"mathsurroundmode",
"mathsurroundskip",
@@ -425,9 +425,9 @@ return {
"pdflastypos",
"pdflinkmargin",
"pdfliteral",
+ "pdfmajorversion",
"pdfmapfile",
"pdfmapline",
- "pdfmajorversion",
"pdfminorversion",
"pdfnames",
"pdfnoligatures",
@@ -826,4 +826,4 @@ return {
["xetex"]={
"XeTeXversion",
},
-}
+} \ No newline at end of file
diff --git a/tex/context/base/mkiv/node-bck.lua b/tex/context/base/mkiv/node-bck.lua
index 054135669..995620710 100644
--- a/tex/context/base/mkiv/node-bck.lua
+++ b/tex/context/base/mkiv/node-bck.lua
@@ -38,11 +38,13 @@ local getattr = nuts.getattr
local getsubtype = nuts.getsubtype
local getwhd = nuts.getwhd
local getwidth = nuts.getwidth
+local getprop = nuts.getprop
local setattr = nuts.setattr
local setlink = nuts.setlink
local setlist = nuts.setlist
local setattributelist = nuts.setattributelist
+local setprop = nuts.setprop
local takebox = nuts.takebox
local findtail = nuts.tail
@@ -56,6 +58,7 @@ local new_rule = nodepool.rule
local new_kern = nodepool.kern
local privateattributes = attributes.private
+local unsetvalue = attributes.unsetvalue
local linefillers = nodes.linefillers
@@ -67,8 +70,19 @@ local a_alignbackground = privateattributes("alignbackground")
local a_linefiller = privateattributes("linefiller")
local a_ruled = privateattributes("ruled")
--- actually we can be more clever now: we can store cells and row data
--- and apply it
+local trace_alignment = false
+local report_alignment = logs.reported("backgrounds","alignment")
+
+trackers.register("backgrounds.alignments",function(v) trace_alignment = v end)
+
+-- We can't use listbuilders with where=alignment because at that stage we have
+-- unset boxes. Also, post_linebreak is unsuitable for nested processing as we
+-- get the same stuff many times (wrapped again and again).
+--
+-- After many experiments with different callbacks the shipout is still the best
+-- place but then we need to store some settings longer or save them with the node.
+-- For color only we can get away with it with an extra attribute flagging a row
+-- but for more complex stuff we can better do as we do here now.
local function colored_a(current,list,template,id)
local width, height, depth = getwhd(current)
@@ -117,84 +131,112 @@ local function colored_b(current,list,template,id,indent)
end
end
-local function add_backgrounds(head)
- for current, id in traverse(head) do
- if id == hlist_code or id == vlist_code then
- local list = getlist(current)
- if list then
- local head = add_backgrounds(list)
- if head then
- setlist(current,head)
- list = head
- end
- end
- local background = getattr(current,a_background)
- if background then
- local list = colored_a(current,list,current,id)
- if list then
- setlist(current,list)
- end
- end
- end
- end
- return head, true
-end
-
--- We use a fake hlist with proper attributes.
-
local templates = { }
local currentrow = 0
+local enabled = false
+local alignments = false
-local function add_alignbackgrounds(head)
- for current in traverse_id(hlist_code,head) do -- what is valign?
- if getsubtype(current) == alignment_code then
+local function add_alignbackgrounds(head,list)
+ for current in traverse_id(hlist_code,list) do
+ if getsubtype(current) == cell_code then
local list = getlist(current)
if list then
- for current in traverse_id(hlist_code,list) do
- if getsubtype(current) == cell_code then
- local list = getlist(current)
+ for template in traverse_id(hlist_code,list) do
+ local background = getattr(template,a_alignbackground)
+ if background then
+ local list = colored_a(current,list,template)
if list then
- for template in traverse_id(hlist_code,list) do
- local background = getattr(template,a_alignbackground)
- if background then
- local list = colored_a(current,list,template)
- if list then
- setlist(current,list)
- end
- end
- break
- end
+ setlist(current,list)
end
+ setattr(template,a_alignbackground,unsetvalue) -- or property
end
+ break
end
end
- currentrow = currentrow + 1
- local template = templates[currentrow]
- if template then
- local list = colored_b(current,list,template[1],hlist_code,template[2])
+ end
+ end
+ local template = getprop(head,"alignmentchecked")
+ if template then
+ list = colored_b(head,list,template[1],hlist_code,template[2])
+ flush_node_list(template)
+ templates[currentrow] = false
+ return list
+ end
+end
+
+local function add_backgrounds(head,id,list)
+ if list then
+ for current, id in traverse(list) do
+ if id == hlist_code or id == vlist_code then
+ local list = getlist(current)
if list then
- setlist(current,list)
+ if alignments and getsubtype(current) == alignment_code then
+ local l = add_alignbackgrounds(current,list)
+ if l then
+ list = l
+ setlist(current,list)
+ end
+ end
+ local l = add_backgrounds(current,id,list)
+ if l then
+ list = l
+ setlist(current,l)
+ end
end
- flush_node_list(template)
- templates[currentrow] = false
end
end
end
+ if id == hlist_code or id == vlist_code then
+ local background = getattr(head,a_background)
+ if background then
+ list = colored_a(head,list,head,id)
+ -- not needed
+ setattr(head,a_background,unsetvalue) -- or property
+ return list
+ end
+ end
+end
+
+function nodes.handlers.backgrounds(head)
+ local h = tonut(head)
+ add_backgrounds(h,getid(h),getlist(h))
return head, true
end
-function nodes.handlers.backgrounds(head,where)
- local head, done = add_backgrounds(tonut(head))
- return tonode(head), done
+function nodes.handlers.backgroundspage(head,where)
+ if head and where == "alignment" then
+ local head = tonut(head)
+ for n in traverse_id(hlist_code,head) do
+ local p = getprop(n,"alignmentchecked")
+ if not p and getsubtype(n) == alignment_code then
+ currentrow = currentrow + 1
+ local template = templates[currentrow]
+ if trace_alignment then
+ report_alignment("%03i %s %s",currentrow,"page",template and "+" or "-")
+ end
+ setprop(n,"alignmentchecked",template)
+ end
+ end
+ end
+ return head, true
end
-function nodes.handlers.alignbackgrounds(head,where)
- if where == "alignment" and head then
- local head, done = add_alignbackgrounds(tonut(head))
- return tonode(head), done
- else
- return head, false
+function nodes.handlers.backgroundsvbox(head,where)
+ if head and where == "vbox" then
+ local head = tonut(head)
+ for n in traverse_id(hlist_code,getlist(head)) do
+ local p = getprop(n,"alignmentchecked")
+ if not p and getsubtype(n) == alignment_code then
+ currentrow = currentrow + 1
+ local template = templates[currentrow]
+ if trace_alignment then
+ report_alignment("%03i %s %s",currentrow,"vbox",template and "+" or "-")
+ end
+ setprop(n,"alignmentchecked",template)
+ end
+ end
end
+ return head, true
end
-- interfaces.implement {
@@ -206,21 +248,29 @@ end
--
-- doing it in the shipout works as well but this is nicer
+local function enable(alignmentstoo)
+ if not enabled then
+ enabled = true
+ enableaction("shipouts","nodes.handlers.backgrounds")
+ end
+ if not alignments and alignmentstoo then
+ alignments = true
+ enableaction("vboxbuilders","nodes.handlers.backgroundsvbox")
+ enableaction("mvlbuilders", "nodes.handlers.backgroundspage")
+ end
+end
+
interfaces.implement {
name = "enablebackgroundboxes",
onlyonce = true,
- actions = function()
- enableaction("mvlbuilders", "nodes.handlers.backgrounds")
- enableaction("vboxbuilders","nodes.handlers.backgrounds")
- end,
+ actions = enable,
}
interfaces.implement {
name = "enablebackgroundalign",
onlyonce = true,
actions = function()
- enableaction("mvlbuilders", "nodes.handlers.alignbackgrounds")
- enableaction("vboxbuilders","nodes.handlers.alignbackgrounds")
+ enable(true)
end,
}
@@ -228,7 +278,12 @@ interfaces.implement {
name = "setbackgroundrowdata",
arguments = { "integer", "integer", "dimension" },
actions = function(row,box,indent)
- templates[row] = { takebox(box), indent }
+ row = row -1 -- better here than in tex
+ if box == 0 then
+ templates[row] = false
+ else
+ templates[row] = { takebox(box), indent }
+ end
end,
}
diff --git a/tex/context/base/mkiv/node-bck.mkiv b/tex/context/base/mkiv/node-bck.mkiv
index 6bfc43d6a..47aaa1629 100644
--- a/tex/context/base/mkiv/node-bck.mkiv
+++ b/tex/context/base/mkiv/node-bck.mkiv
@@ -16,8 +16,6 @@
%D This is first attempt to replacing backgrounds in a few tables
%D mechanisms. When used more frequently, we can store the color
%D spec in the attribute.
-%D
-%D Maybe move some to the bar handler.
\unprotect
@@ -74,6 +72,9 @@
\unexpanded\def\backgroundvbox{\node_backgrounds_boxes_add\vbox}
\unexpanded\def\backgroundvtop{\node_backgrounds_boxes_add\vtop}
+\unexpanded\def\backgroundline{\dontleavehmode
+ \node_backgrounds_boxes_add\hbox}
+
% \def\node_backgrounds_boxes_add#1[#2]%
% {\begingroup
% \clf_enablebackgroundboxes
@@ -90,18 +91,4 @@
{\clf_enablebackgroundboxes
#1\backgroundcolorattr{#2}}
-% less argument carry over:
-%
-% \def\node_backgrounds_boxes_add#1[#2]%
-% {\clf_enablebackgroundboxes#1%
-% \ifcsname\??colorattribute\currentcolorprefix#2\endcsname
-% \thebackgroundcolorattr{\currentcolorprefix#2}%
-% \else\ifcsname\??colorattribute#2\endcsname
-% \thebackgroundcolorattr{#2}%
-% \fi\fi}
-
-% \def\backgroundvbox[#1]{\vbox \backgroundcolorattr{#1}}
-% \def\backgroundvtop[#1]{\vtop \backgroundcolorattr{#1}}
-% \def\backgroundhbox[#1]{\hbox \backgroundcolorattr{#1}}
-
\protect \endinput
diff --git a/tex/context/base/mkiv/node-nut.lua b/tex/context/base/mkiv/node-nut.lua
index 302ece4bf..282a37e2e 100644
--- a/tex/context/base/mkiv/node-nut.lua
+++ b/tex/context/base/mkiv/node-nut.lua
@@ -780,8 +780,22 @@ nuts.theprop = function(n)
return p
end
-nodes.setprop = nodes.setproperty
-nodes.getprop = nodes.getproperty
+nuts.isdone = function(n,k)
+ local p = propertydata[n]
+ if not p then
+ propertydata[n] = { [k] = true }
+ return false
+ end
+ local v = p[k]
+ if v == nil then
+ propertydata[n] = { [k] = true }
+ return false
+ end
+ return v
+end
+
+-- nodes.setprop = nodes.setproperty
+-- nodes.getprop = nodes.getproperty
function nuts.copy_properties(source,target,what)
local newprops = propertydata[source]
diff --git a/tex/context/base/mkiv/node-rul.lua b/tex/context/base/mkiv/node-rul.lua
index b8388f373..7c4c2c2f2 100644
--- a/tex/context/base/mkiv/node-rul.lua
+++ b/tex/context/base/mkiv/node-rul.lua
@@ -49,6 +49,7 @@ local setattrlist = nuts.setattrlist
local setshift = nuts.setshift
local getwidth = nuts.getwidth
local setwidth = nuts.setwidth
+local setfield = nuts.setfield
local flushlist = nuts.flush_list
local effective_glue = nuts.effective_glue
@@ -348,12 +349,13 @@ local function flush_ruled(head,f,l,d,level,parent,strip) -- not that fast but a
else
local tx = d.text
if tx then
- tx = copy_list(tx)
+ local l = copy_list(tx)
if d["repeat"] == v_yes then
- tx = new_leader(w,tx)
+ l = new_leader(w,l)
+ setattrlist(l,tx)
end
- local r = hpack_nodes(tx,w,"exactly")
- inject(r,w,ht,dp)
+ l = hpack_nodes(l,w,"exactly")
+ inject(l,w,ht,dp)
else
for i=1,level do
local ht = (offset+(i-1)*dy)*e + rulethickness - m
@@ -746,3 +748,38 @@ implement {
onlyonce = true,
actions = nodes.linefillers.enable
}
+
+-- We add a bonus feature here:
+
+local new_rule = nodes.pool.rule
+
+interfaces.implement {
+ name = "autorule",
+ arguments = {
+ {
+ { "width", "dimension" },
+ { "height", "dimension" },
+ { "depth", "dimension" },
+ { "left", "dimension" },
+ { "right", "dimension" },
+ },
+ },
+ actions = function(t)
+ local l = t.left
+ local r = t.right
+ local n = new_rule(
+ t.width,
+ t.height,
+ t.depth
+ )
+ if LUATEXFUNCTIONALITY >= 6710 then
+ if l then
+ n.left = l
+ end
+ if r then
+ n.right = r
+ end
+ end
+ context(n)
+ end
+}
diff --git a/tex/context/base/mkiv/node-rul.mkiv b/tex/context/base/mkiv/node-rul.mkiv
index a7ec99f7d..c413edb1c 100644
--- a/tex/context/base/mkiv/node-rul.mkiv
+++ b/tex/context/base/mkiv/node-rul.mkiv
@@ -592,10 +592,10 @@
{\bgroup
\clf_enablebackgroundboxes
\dowithnextbox{%
- \node_linefiller_set{#3}%
+ \node_linefiller_set{#3}% already sets the attribute
#1%
attr \backgroundattribute \plusone
- attr \linefillerattribute \the\attribute\linefillerattribute
+ % attr \linefillerattribute \the\attribute\linefillerattribute
{\box\nextbox}%
\egroup}%
#2}
@@ -604,4 +604,8 @@
\unexpanded\def\linefillervbox{\node_backgrounds_filler_box\vpack\vbox}
\unexpanded\def\linefillervtop{\node_backgrounds_filler_box\tpack\vtop}
+%D Bonus:
+
+\unexpanded\def\autorule{\clf_autorule}
+
\protect \endinput
diff --git a/tex/context/base/mkiv/node-tsk.lua b/tex/context/base/mkiv/node-tsk.lua
index 1ce7ab1dc..4aec3a038 100644
--- a/tex/context/base/mkiv/node-tsk.lua
+++ b/tex/context/base/mkiv/node-tsk.lua
@@ -52,19 +52,20 @@ end
function tasks.new(specification) -- was: name,arguments,list
local name = specification.name
- local arguments = specification.arguments or 0
local sequence = specification.sequence
if name and sequence then
local tasklist = newsequencer {
-- we can move more to the sequencer now .. todo
}
tasksdata[name] = {
+ name = name,
list = tasklist,
runner = false,
- arguments = arguments,
- -- sequence = sequence,
frozen = { },
- processor = specification.processor or nodeprocessor
+ processor = specification.processor or nodeprocessor,
+ -- could be metatable but best freeze it
+ arguments = specification.arguments or 0,
+ templates = specification.templates,
}
for l=1,#sequence do
appendgroup(tasklist,sequence[l])
@@ -219,6 +220,22 @@ end)
function tasks.actions(name) -- we optimize for the number or arguments (no ...)
local data = tasksdata[name]
if data then
+ local t = data.templates
+ if t then
+ return function(...)
+ total = total + 1 -- will go away
+ local runner = data.runner
+ if not runner then
+ created = created + 1
+-- if trace_tasks then
+ report_tasks("creating runner %a",name)
+-- end
+ runner = compile(data.list,data.processor,t)
+ data.runner = runner
+ end
+ return runner(...)
+ end
+ end
local n = data.arguments or 0
if n == 0 then
return function(head)
@@ -452,3 +469,32 @@ tasks.new {
}
}
+-- for now quite useless (too fuzzy0
+--
+-- tasks.new {
+-- name = "listbuilders",
+-- processor = nodeprocessor,
+-- sequence = {
+-- "before", -- for users
+-- "normalizers",
+-- "after", -- for users
+-- },
+-- templates = {
+-- -- we don't need a default
+-- default = [[
+-- return function(box,location,prevdepth)
+-- return box, prevdepth
+-- end
+-- ]],
+-- process = [[
+-- %localize%
+-- return function(box,location,prevdepth,mirrored)
+-- %actions%
+-- return box, prevdepth
+-- end
+-- ]],
+-- step = [[
+-- box, prevdepth = %action%(box,location,prevdepth,mirrored)
+-- ]],
+-- },
+-- }
diff --git a/tex/context/base/mkiv/pack-bck.mkvi b/tex/context/base/mkiv/pack-bck.mkvi
index 346e7df57..9f9d843ce 100644
--- a/tex/context/base/mkiv/pack-bck.mkvi
+++ b/tex/context/base/mkiv/pack-bck.mkvi
@@ -245,18 +245,42 @@
%D \macros
%D {backgroundline}
-\unexpanded\def\backgroundline[#color]%
- {\dontleavehmode
- \dowithnextbox{\pack_backgrounds_add_to_nextbox{#color}}\hbox}
+% \unexpanded\def\backgroundline[#color]%
+% {\dontleavehmode
+% \dowithnextbox{\pack_backgrounds_add_to_nextbox{#color}}\hbox}
+%
+% \unexpanded\def\pack_backgrounds_add_to_nextbox#color% handy helper
+% {\hpack
+% {\dousecolorparameter{#color}%
+% \vrule
+% \??width \nextboxwd
+% \??height\nextboxht
+% \??depth \nextboxdp
+% \hskip-\nextboxwd
+% \flushnextbox}}
+
+%D We implement this elsewhere avoiding the rule.
-\unexpanded\def\pack_backgrounds_add_to_nextbox#color% handy helper
- {\hbox
- {\dousecolorparameter{#color}%
- \vrule
- \!!width \nextboxwd
- \!!height\nextboxht
- \!!depth \nextboxdp
- \hskip-\nextboxwd
- \flushnextbox}}
+% \unexpanded\def\backgroundline
+% {\dontleavehmode
+% \pack_backgrounds_add_to_nextbox\hbox\hpack}
+%
+% \unexpanded\def\pack_backgrounds_add_to_nextbox#box#pack[#color]%
+% {\dontleavehmode
+% \dowithnextbox{\pack_backgrounds_add_to_nextbox_indeed#pack{#color}}#box}
+%
+% \unexpanded\def\pack_backgrounds_add_to_nextbox_indeed#pack#color% handy helper
+% {#pack%
+% {\dousecolorparameter{#color}%
+% \vrule
+% \??width \nextboxwd
+% \??height\nextboxht
+% \??depth \nextboxdp
+% \hskip-\nextboxwd
+% \flushnextbox}}
+%
+% \unexpanded\def\backgroundhbox{\pack_backgrounds_add_to_nextbox\hbox\hpack}
+% \unexpanded\def\backgroundvtop{\pack_backgrounds_add_to_nextbox\vtop\tpack}
+% \unexpanded\def\backgroundvbox{\pack_backgrounds_add_to_nextbox\vbox\vpack}
\protect \endinput
diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf
index 489383f73..c8ca9b98e 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 f0e3e40b0..16940503b 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-sbe.mkiv b/tex/context/base/mkiv/strc-sbe.mkiv
index 9f1d214cf..005f03df3 100644
--- a/tex/context/base/mkiv/strc-sbe.mkiv
+++ b/tex/context/base/mkiv/strc-sbe.mkiv
@@ -45,7 +45,7 @@
\def\strc_sectionblock_define[#1][#2][#3]% singular plural settings
{\strc_sectionblock_define_normal[#1][#3]%
- \expandafter\newif\csname if#2\endcsname % obsolete
+ %\expandafter\newif\csname if#2\endcsname % obsolete
\strc_sectionblock_set_environment{#1}\empty
\setuvalue{\e!start#2}{\startsectionblock[#1]}%
\setuvalue{\e!stop #2}{\stopsectionblock}}
@@ -98,7 +98,7 @@
\clf_pushsectionblock{#1}
bookmark {\sectionblockparameter\c!bookmark}%
\relax
- \csname #1true\endcsname % obsolete
+ %\csname #1true\endcsname % obsolete
\setsystemmode\currentsectionblock
\the\everybeforesectionblock\relax
\showmessage\m!structures1\currentsectionblock}
diff --git a/tex/context/base/mkiv/tabl-tbl.mkiv b/tex/context/base/mkiv/tabl-tbl.mkiv
index 033b5cff6..f80813eef 100644
--- a/tex/context/base/mkiv/tabl-tbl.mkiv
+++ b/tex/context/base/mkiv/tabl-tbl.mkiv
@@ -176,6 +176,7 @@
\newcount \c_tabl_tabulate_minusnoflines
\newcount \c_tabl_tabulate_align
\newcount \c_tabl_tabulate_nofrealrows
+\newcount \c_tabl_tabulate_autocolor
\newcount \c_tabl_tabulate_nofcolumns % set at the lua end by parser
\newcount \c_tabl_tabulate_has_rule_spec_first % set at the lua end by parser (for the moment a count)
@@ -1327,6 +1328,7 @@
\edef\p_bodyfont {\tabulationparameter\c!bodyfont}
\edef\p_indenting {\tabulationparameter\c!indenting}%
\edef\p_keeptogether {\tabulationparameter\c!keeptogether}%
+ \edef\p_blank {\tabulationparameter\c!blank}%
%
\ifx\p_keeptogether\v!no
\settrue \c_tabl_tabulate_tolerant_break
@@ -1339,6 +1341,8 @@
\settrue\c_tabl_tabulate_split
\csname\??tabulatesplit\tabulationparameter\c!split\endcsname
%
+ \let\m_tabl_tabulate_blank_default\p_blank
+ %
\d_tabl_tabulate_unit\tabulationparameter\c!unit
\d_tabl_tabulate_margin\tabulationparameter\c!margin
\let\m_tabl_tabulate_vrule_color_default\p_rulecolor
@@ -1385,6 +1389,7 @@
\let\m_tabl_tabulate_vrule_color_local \empty
\let\m_tabl_tabulate_vrule_color_default\empty % used local
\let\m_tabl_tabulate_hrule_color_default\empty % used local
+\let\m_tabl_tabulate_blank_default \empty
\appendtoks
\global\let\m_tabl_tabulate_color_previous \empty
@@ -1639,10 +1644,11 @@
#1}
\def\tabl_tabulate_hrule_inject_normal
- {\hrule
- \s!height.5\d_tabl_tabulate_hrulethickness_local
- \s!depth .5\d_tabl_tabulate_hrulethickness_local
- \relax}
+ {\autorule
+ \s!height .5\d_tabl_tabulate_hrulethickness_local
+ \s!depth .5\d_tabl_tabulate_hrulethickness_local
+ \s!left \d_tabl_tabulate_indent
+ \relax}
\def\tabl_tabulate_hrule_inject_colored
{\dousecolorparameter\currenttabulationlocalhrulecolor
@@ -2518,9 +2524,11 @@
\def\tabl_tabulate_TB_indeed[#1]%
{\iffirstargument
\blank[#1]
- \else
+ \else\ifx\m_tabl_tabulate_blank_default\empty
\blank
- \fi
+ \else
+ \blank[\m_tabl_tabulate_blank_default]%
+ \fi\fi
\stoptabulatenoalign}
% to be tested:
@@ -2825,6 +2833,7 @@
\let\m_table_current_row_background_default \empty
\let\m_table_current_row_background_filler \empty
\let\m_table_current_row_background_defaultfiller\empty
+\let\m_table_current_row_background_auto \empty
\unexpanded\def\tabl_register_row_background#1%
{\xdef\m_table_current_row_background{#1}}
@@ -2837,6 +2846,7 @@
\ifx\m_table_current_row_background_filler\empty
\ifx\m_table_current_row_background\empty
% nothing
+ \tabl_synchronize_row_background_dummy
\else
\tabl_synchronize_row_background_indeed\m_table_current_row_background
\fi
@@ -2845,26 +2855,41 @@
\fi
\fi}
+\unexpanded\def\tabl_synchronize_row_background_dummy
+ {\iftrialtypesetting\else
+ \begingroup
+ %\clf_setbackgroundrowdata\numexpr\c_tabl_tabulate_nofrealrows+\minusone\relax\zerocount\zeropoint
+ \clf_setbackgroundrowdata\c_tabl_tabulate_nofrealrows\zerocount\zeropoint
+ \endgroup
+ \fi}
+
\unexpanded\def\tabl_synchronize_row_background_indeed#1%
- {\begingroup
- \clf_enablebackgroundalign % can be moved into \clf_setbackgroundrowdata
- \directcolor[#1]%
- \setbox\scratchbox\hpack{}%
- \clf_setbackgroundrowdata\numexpr\c_tabl_tabulate_nofrealrows+\minusone\relax\scratchbox\d_tabl_tabulate_indent
- \endgroup}
+ {\iftrialtypesetting\else
+ \begingroup
+ \clf_enablebackgroundalign % can be moved into \clf_setbackgroundrowdata
+ \dousecolorparameter{#1}%
+ \setbox\scratchbox\hpack{}%
+ %\clf_setbackgroundrowdata\numexpr\c_tabl_tabulate_nofrealrows+\minusone\relax\scratchbox\d_tabl_tabulate_indent
+ \clf_setbackgroundrowdata\c_tabl_tabulate_nofrealrows\scratchbox\d_tabl_tabulate_indent
+ \endgroup
+ \fi}
\unexpanded\def\tabl_synchronize_row_background_filler_indeed#1%
- {\begingroup
- \clf_enablebackgroundalign % can be moved into \clf_setbackgroundrowdata
- \node_linefiller_set{#1}%
- \setbox\scratchbox\hpack{}%
- \clf_setbackgroundrowdata\numexpr\c_tabl_tabulate_nofrealrows+\minusone\relax\scratchbox\d_tabl_tabulate_indent
- \endgroup}
+ {\iftrialtypesetting\else
+ \begingroup
+ \clf_enablebackgroundalign % can be moved into \clf_setbackgroundrowdata
+ \node_linefiller_set{#1}%
+ \setbox\scratchbox\hpack{}%
+ %\clf_setbackgroundrowdata\numexpr\c_tabl_tabulate_nofrealrows+\minusone\relax\scratchbox\d_tabl_tabulate_indent
+ \clf_setbackgroundrowdata\c_tabl_tabulate_nofrealrows\scratchbox\d_tabl_tabulate_indent
+ \endgroup
+ \fi}
\appendtoks
\glet\m_table_current_row_background\empty
\glet\m_table_current_row_background_filler\empty
\global\c_tabl_tabulate_nofrealrows\zerocount
+ \global\c_tabl_tabulate_autocolor\zerocount
\clf_resetbackgroundrowdata
\to \t_tabl_tabulate_initializers_first
@@ -2872,6 +2897,7 @@
\glet\m_table_current_row_background\empty
\glet\m_table_current_row_background_filler\empty
\global\c_tabl_tabulate_nofrealrows\zerocount
+ \global\c_tabl_tabulate_autocolor\zerocount
\clf_resetbackgroundrowdata
\to \t_tabl_tabulate_initializers_second
@@ -2959,26 +2985,60 @@
\usetabulationstyleandcolor\c!foregroundstyle\c!foregroundcolor
\fi}
+\unexpanded\def\tabl_tabulate_A_first
+ {\global\advance\c_tabl_tabulate_autocolor\plusone
+ \edef\m_table_current_row_background_auto{\tabulateparameter{\c!backgroundcolor:\number\c_tabl_tabulate_autocolor}}%
+ \ifx\m_table_current_row_background_auto\empty
+ \global\c_tabl_tabulate_autocolor\plusone
+ \edef\m_table_current_row_background_auto{\tabulateparameter{\c!backgroundcolor:\number\c_tabl_tabulate_autocolor}}%
+ \fi
+ \ifx\m_table_current_row_background_auto\empty
+ \let\m_table_current_row_background_auto\empty % \m_table_current_row_background_default
+ \fi
+ \tabl_register_row_background{\m_table_current_row_background_auto}}
+
+\unexpanded\def\tabl_tabulate_NA_first
+ {\tabl_tabulate_column_normal\zerocount\zerocount\relax
+ \iftrialtypesetting\else
+ \ifcase\c_tabl_tabulate_column\or
+ \tabl_tabulate_A_first
+ \fi
+ \fi
+ \ignorespaces}
+
+\unexpanded\def\tabl_tabulate_BA_first
+ {\tabl_tabulate_column_normal\plusone\zerocount\relax
+ \iftrialtypesetting\else
+ \ifcase\c_tabl_tabulate_column\or
+ \tabl_tabulate_A_first
+ \fi
+ \fi
+ \usetabulationstyleandcolor\c!foregroundstyle\c!foregroundcolor
+ \ignorespaces}
+
\appendtoks
- \let\NL\tabl_tabulate_NL_first % NC = NC with Line
- \let\ND\tabl_tabulate_ND_first % NC = NC with Default Line
- \let\LB\tabl_tabulate_LB_first % BC = BC with Line
- \let\DB\tabl_tabulate_DB_first % BC = BC with Default Line
- \let\NF\tabl_tabulate_NF_first % NF = NC with Filler
- \let\NP\tabl_tabulate_NP_first % NP = NC with Predefined Fller
- \let\FB\tabl_tabulate_FB_first % FB = BC with Filler
- \let\PB\tabl_tabulate_PB_first % PB = BC with Predefined Fller
+ \let\NL\tabl_tabulate_NL_first % NC with Line
+ \let\ND\tabl_tabulate_ND_first % NC with Default Line
+ \let\LB\tabl_tabulate_LB_first % BC with Line
+ \let\DB\tabl_tabulate_DB_first % BC with Default Line
+ \let\NF\tabl_tabulate_NF_first % NC with Filler
+ \let\NP\tabl_tabulate_NP_first % NC with Predefined Filler
+ \let\FB\tabl_tabulate_FB_first % BC with Filler
+ \let\PB\tabl_tabulate_PB_first % BC with Predefined Filler
+ \let\NA\tabl_tabulate_NA_first % NC with Auto Line
+ \let\BA\tabl_tabulate_BA_first % NC with Auto Line
\to \t_tabl_tabulate_initializers_first
\appendtoks
\edef\m_table_current_row_background_default {\tabulateparameter\c!backgroundcolor}%
\edef\m_table_current_row_background_default_filler{\tabulateparameter\c!background}%
+ \let \m_table_current_row_background_auto \empty
\to \everytabulate
-
\setuptabulate
[\c!headcolor=,
\c!headstyle=\bf,
+ \c!backgroundcolor=\tabulationparameter\c!rulecolor,
\c!foregroundcolor=,
\c!foregroundstyle=\tabulationparameter\c!headstyle]
diff --git a/tex/context/base/mkiv/task-ini.lua b/tex/context/base/mkiv/task-ini.lua
index 02713320e..27d997584 100644
--- a/tex/context/base/mkiv/task-ini.lua
+++ b/tex/context/base/mkiv/task-ini.lua
@@ -78,7 +78,7 @@ appendaction("shipouts", "normalizers", "nodes.rules.handler")
appendaction("shipouts", "normalizers", "nodes.shifts.handler") -- disabled
appendaction("shipouts", "normalizers", "structures.tags.handler") -- disabled
appendaction("shipouts", "normalizers", "nodes.handlers.accessibility") -- disabled
-------------("shipouts", "normalizers", "nodes.handlers.backgrounds") -- disabled
+appendaction("shipouts", "normalizers", "nodes.handlers.backgrounds") -- disabled
------------("shipouts", "normalizers", "nodes.handlers.export") -- disabled
appendaction("shipouts", "normalizers", "typesetters.rubies.attach") -- disabled
@@ -132,11 +132,8 @@ appendaction("finalizers", "lists", "nodes.linefillers.handler")
appendaction("contributers", "normalizers", "nodes.handlers.flattenline")
appendaction("contributers", "normalizers", "nodes.handlers.textbackgrounds")
-appendaction("mvlbuilders", "normalizers", "nodes.handlers.alignbackgrounds")
-appendaction("vboxbuilders", "normalizers", "nodes.handlers.alignbackgrounds")
-
-appendaction("mvlbuilders", "normalizers", "nodes.handlers.backgrounds")
-appendaction("vboxbuilders", "normalizers", "nodes.handlers.backgrounds")
+appendaction("vboxbuilders", "normalizers", "nodes.handlers.backgroundsvbox")
+appendaction("mvlbuilders", "normalizers", "nodes.handlers.backgroundspage")
appendaction("mvlbuilders", "normalizers", "typesetters.margins.globalhandler") -- disabled
appendaction("mvlbuilders", "normalizers", "nodes.handlers.migrate")
@@ -203,9 +200,9 @@ disableaction("shipouts", "attributes.viewerlayers.handler")
disableaction("shipouts", "structures.tags.handler")
disableaction("shipouts", "nodes.visualizers.handler")
disableaction("shipouts", "nodes.handlers.accessibility")
--------------("shipouts", "nodes.handlers.backgrounds")
disableaction("shipouts", "nodes.references.handler")
disableaction("shipouts", "nodes.destinations.handler")
+disableaction("shipouts", "nodes.handlers.backgrounds")
-------------("shipouts", "nodes.handlers.export")
disableaction("shipouts", "typesetters.rubies.attach")
@@ -219,6 +216,9 @@ disableaction("finalizers", "nodes.linefillers.handler")
disableaction("contributers","nodes.handlers.flattenline")
disableaction("contributers","nodes.handlers.textbackgrounds")
+disableaction("vboxbuilders","nodes.handlers.backgroundsvbox")
+disableaction("mvlbuilders", "nodes.handlers.backgroundspage")
+
disableaction("math", "noads.handlers.showtree")
disableaction("math", "noads.handlers.tags")
disableaction("math", "noads.handlers.italics")
@@ -230,12 +230,6 @@ disableaction("math", "noads.handlers.autofences")
disableaction("math", "noads.handlers.makeup")
disableaction("math", "typesetters.directions.processmath")
-disableaction("mvlbuilders", "nodes.handlers.backgrounds")
-disableaction("vboxbuilders", "nodes.handlers.backgrounds")
-
-disableaction("mvlbuilders", "nodes.handlers.alignbackgrounds")
-disableaction("vboxbuilders", "nodes.handlers.alignbackgrounds")
-
disableaction("mvlbuilders", "typesetters.margins.globalhandler")
disableaction("mvlbuilders", "nodes.handlers.migrate")
disableaction("mvlbuilders", "typesetters.checkers.handler")
diff --git a/tex/context/base/mkiv/toks-scn.lua b/tex/context/base/mkiv/toks-scn.lua
index fe32a1de4..f73ecc86c 100644
--- a/tex/context/base/mkiv/toks-scn.lua
+++ b/tex/context/base/mkiv/toks-scn.lua
@@ -106,7 +106,40 @@ local function scanconditional()
return nil
end
+local function scantable(t,data)
+ if not data then
+ data = { }
+ end
+ local wrapped = scanopen()
+ while true do
+ local key = scanword()
+ if key then
+ local get = t[key]
+ if get then
+ data[key] = get()
+ else
+ -- catch all we can get
+ end
+ else
+ break
+ end
+ end
+ if wrapped then
+ scanclose()
+ end
+ return data
+end
+
+function tokens.constant(s)
+ if type(s) == "string" then
+ return "'" .. s .. "'"
+ else
+ return s
+ end
+end
+
scanners.list = scanlist
+scanners.table = scantable
scanners.conditional = scanconditional
local shortcuts = {
@@ -118,6 +151,7 @@ local shortcuts = {
scanstring = scanstring,
scaninteger = scaninteger,
scannumber = scannumber,
+ scantable = scantable,
scankeyword = scankeyword,
scankeywordcs = scankeywordcs,
scanword = scanword,
@@ -254,6 +288,8 @@ local presets = {
["8 strings"] = { "string", "string", "string", "string", "string", "string", "string", "string" },
}
+tokens.presets = presets
+
function tokens.compile(specification)
local f = { }
local n = 0
@@ -319,7 +355,7 @@ function tokens.compile(specification)
return c
end
end
- local p = t and presets[t]
+ local p = t and presets[t] -- already done in implement
if p then
t = p
end
@@ -460,35 +496,3 @@ end
-- }
--
-- os.exit()
-
-function tokens.scantable(t,data)
- if not data then
- data = { }
- end
- local wrapped = scanopen()
- while true do
- local key = scanword()
- if key then
- local get = t[key]
- if get then
- data[key] = get()
- else
- -- catch all we can get
- end
- else
- break
- end
- end
- if wrapped then
- scanclose()
- end
- return data
-end
-
-function tokens.constant(s)
- if type(s) == "string" then
- return "'" .. s .. "'"
- else
- return s
- end
-end
diff --git a/tex/context/base/mkiv/typo-bld.lua b/tex/context/base/mkiv/typo-bld.lua
index 753748a2e..8d349f3a6 100644
--- a/tex/context/base/mkiv/typo-bld.lua
+++ b/tex/context/base/mkiv/typo-bld.lua
@@ -54,10 +54,12 @@ storage.register("builders/paragraphs/constructors/names", names, "builders.
storage.register("builders/paragraphs/constructors/numbers", numbers, "builders.paragraphs.constructors.numbers")
local trace_page_builder = false trackers.register("builders.page", function(v) trace_page_builder = v end)
+local trace_vbox_builder = false trackers.register("builders.vbox", function(v) trace_vbox_builder = v end)
local trace_post_builder = false trackers.register("builders.post", function(v) trace_post_builder = v end)
-local report_par_builder = logs.reporter("builders","par")
local report_page_builder = logs.reporter("builders","page")
+local report_vbox_builder = logs.reporter("builders","vbox")
+local report_par_builder = logs.reporter("builders","par")
local mainconstructor = nil -- not stored in format
local nofconstructors = 0
@@ -193,7 +195,7 @@ function builders.vpack_filter(head,groupcode,size,packtype,maxdepth,direction)
local done = false
if head then
starttiming(builders)
- if trace_vpacking then
+ if trace_vbox_builder then
local before = count_nodes(head)
head, done = vboxactions(head,groupcode,size,packtype,maxdepth,direction)
local after = count_nodes(head)
@@ -258,9 +260,53 @@ function builders.buildpage_filter(groupcode)
end
end
-registercallback('vpack_filter', builders.vpack_filter, "vertical spacing etc")
-registercallback('buildpage_filter', builders.buildpage_filter, "vertical spacing etc (mvl)")
-----------------('contribute_filter', builders.contribute_filter, "adding content to lists")
+------------------------
+
+-- do
+--
+-- local nuts = nodes.nuts
+-- local tonut = nodes.tonut
+-- local tonode = nuts.tonode
+-- local getglue = tex.getglue
+-- local getwhd = nuts.getwhd
+-- local new_b_skip = nuts.pool.baselineskip
+-- local new_l_skip = nuts.pool.lineskip
+-- local find_tail = nuts.tail
+-- local setlink = nuts.setlink
+--
+-- function nodes.setprevdepth(box,prevdepth) -- this will become a helper
+-- local head = tonut(box)
+-- local wd, ht, dp = getwhd(head)
+-- if prevdepth > -65536000 then
+-- local b_width, b_stretch, b_shrink = getglue("baselineskip")
+-- local l_width, l_stretch, l_shrink = getglue("lineskip")
+-- local correction = b_width - prevdepth - (mirrored and dp or ht)
+-- if correction < l_width then
+-- head = setlink(new_l_skip(l_width,l_stretch,l_shrink),head)
+-- else
+-- head = setlink(new_b_skip(correction,b_stretch,b_shrink),head)
+-- end
+-- end
+-- return tonode(head), mirrored and ht or dp
+-- end
+--
+-- end
+--
+-- local setprevdepth = nodes.setprevdepth
+-- local appendactions = nodes.tasks.actions("listbuilders")
+--
+-- function builders.append_filter(box,location,prevdepth,mirrored)
+-- starttiming(builders)
+-- box, prevdepth = appendactions(box,location,prevdepth,mirrored)
+-- box, prevdepth = setprevdepth(box,prevdepth)
+-- stoptiming(builders)
+-- return box, prevdepth
+-- end
+
+registercallback('vpack_filter', builders.vpack_filter, "vertical spacing etc")
+registercallback('buildpage_filter', builders.buildpage_filter, "vertical spacing etc (mvl)")
+----------------("append_to_vlist_filter",builders.append_filter, "add content to the vlist")
+----------------('contribute_filter', builders.contribute_filter, "adding content to lists")
statistics.register("v-node processing time", function()
return statistics.elapsedseconds(builders)
@@ -387,3 +433,4 @@ end)
-- end,
-- "experimental prevdepth checking"
-- )
+
diff --git a/tex/context/base/mkiv/util-seq.lua b/tex/context/base/mkiv/util-seq.lua
index d302ff276..ec6ed2ceb 100644
--- a/tex/context/base/mkiv/util-seq.lua
+++ b/tex/context/base/mkiv/util-seq.lua
@@ -20,17 +20,18 @@ use locals to refer to them when compiling the chain.</p>
local gsub, concat, gmatch = string.gsub, table.concat, string.gmatch
local type, load = type, load
-utilities = utilities or { }
-local tables = utilities.tables
-local allocate = utilities.storage.allocate
+utilities = utilities or { }
+local tables = utilities.tables
+local allocate = utilities.storage.allocate
-local formatters = string.formatters
+local formatters = string.formatters
+local replacer = utilities.templates.replacer
-local sequencers = { }
-utilities.sequencers = sequencers
+local sequencers = { }
+utilities.sequencers = sequencers
-local functions = allocate()
-sequencers.functions = functions
+local functions = allocate()
+sequencers.functions = functions
local removevalue = tables.removevalue
local replacevalue = tables.replacevalue
@@ -66,6 +67,7 @@ function sequencers.new(t) -- was reset
}
if t then
s.arguments = t.arguments
+ s.templates = t.templates
s.returnvalues = t.returnvalues
s.results = t.results
local name = t.name
@@ -253,7 +255,6 @@ local function construct(t)
t.compiled = formatters["%s\nreturn function(%s)\n%s\nend"](variables,arguments,calls)
end
end
--- print(t.compiled)
return t.compiled -- also stored so that we can trace
end
@@ -276,7 +277,6 @@ compile = function(t,compiler,n) -- already referred to in sequencers.new
if compiled == "" then
runner = false
else
--- inspect(compiled)
runner = compiled and load(compiled)() -- we can use loadstripped here
end
t.runner = runner
@@ -313,7 +313,7 @@ return function()
return false, false
end]]
-function sequencers.nodeprocessor(t,nofarguments) -- todo: handle 'kind' in plug into tostring
+local function nodeprocessor(t,nofarguments) -- todo: handle 'kind' in plug into tostring
local list, order, kind, gskip, askip = t.list, t.order, t.kind, t.gskip, t.askip
local nostate = t.nostate
local vars, calls, args, n = { }, { }, nil, 0
@@ -364,3 +364,56 @@ function sequencers.nodeprocessor(t,nofarguments) -- todo: handle 'kind' in plug
-- print(processor)
return processor
end
+
+function sequencers.nodeprocessor(t,nofarguments)
+ local kind = type(nofarguments)
+ if kind == "number" then
+ return nodeprocessor(t,nofarguments)
+ elseif kind ~= "table" then
+ return
+ end
+ --
+ local templates = nofarguments
+ local process = templates.process
+ local step = templates.step
+ --
+ if not process or not step then
+ return ""
+ end
+ --
+ local construct = replacer(process)
+ local newaction = replacer(step)
+ local calls = { }
+ local aliases = { }
+ local n = 0
+ --
+ local list = t.list
+ local order = t.order
+ local kind = t.kind
+ local gskip = t.gskip
+ local askip = t.askip
+ --
+ for i=1,#order do
+ local group = order[i]
+ if not gskip[group] then
+ local actions = list[group]
+ for i=1,#actions do
+ local action = actions[i]
+ if not askip[action] then
+ local localized = localize(action)
+ n = n + 1
+ aliases[n] = formatters["local %s = %s"](localized,action)
+ calls[n] = newaction { action = localized }
+ end
+ end
+ end
+ end
+ if n == 0 then
+ return templates.default or construct { }
+ end
+ local processor = construct {
+ localize = concat(aliases,"\n"),
+ actions = concat(calls,"\n"),
+ }
+ return processor
+end