summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/node-fin.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2018-08-15 19:40:19 +0200
committerContext Git Mirror Bot <phg@phi-gamma.net>2018-08-15 19:40:19 +0200
commitd6850b00fa0f937514389e8d090db87b0163a703 (patch)
tree145d9be2d7f5c5bddf908c014954911e50e1c6ea /tex/context/base/mkiv/node-fin.lua
parent36a37da721032b8d02fad41f22ad717ee8136f34 (diff)
downloadcontext-d6850b00fa0f937514389e8d090db87b0163a703.tar.gz
2018-08-15 18:54:00
Diffstat (limited to 'tex/context/base/mkiv/node-fin.lua')
-rw-r--r--tex/context/base/mkiv/node-fin.lua38
1 files changed, 30 insertions, 8 deletions
diff --git a/tex/context/base/mkiv/node-fin.lua b/tex/context/base/mkiv/node-fin.lua
index 3e7a4cd1b..ff7ac7598 100644
--- a/tex/context/base/mkiv/node-fin.lua
+++ b/tex/context/base/mkiv/node-fin.lua
@@ -23,6 +23,7 @@ local getlist = nuts.getlist
local getleader = nuts.getleader
local getattr = nuts.getattr
local getwidth = nuts.getwidth
+local getwhd = nuts.getwhd
local setlist = nuts.setlist
local setleader = nuts.setleader
@@ -295,7 +296,9 @@ local function process(attribute,head,inheritance,default) -- one attribute
-- end nested --
end
elseif id == rule_code then
- check = getwidth(stack) ~= 0
+-- check = getwidth(stack) ~= 0
+local wd, ht, dp = getwhd(stack)
+check = wd ~= 0 or (ht+dp) ~= 0
end
-- much faster this way than using a check() and nested() function
if check then
@@ -491,7 +494,9 @@ local function selective(attribute,head,inheritance,default) -- two attributes
-- end nested
end
elseif id == rule_code then
- check = getwidth(stack) ~= 0
+-- check = getwidth(stack) ~= 0
+local wd, ht, dp = getwhd(stack)
+check = wd ~= 0 or (ht+dp) ~= 0
end
if check then
@@ -601,7 +606,9 @@ local function stacked(attribute,head,default) -- no triggering, no inheritance,
end
end
elseif id == rule_code then
- check = getwidth(stack) ~= 0
+-- check = getwidth(stack) ~= 0
+local wd, ht, dp = getwhd(stack)
+check = wd ~= 0 or (ht+dp) ~= 0
end
if check then
local a = getattr(stack,attribute)
@@ -612,9 +619,12 @@ local function stacked(attribute,head,default) -- no triggering, no inheritance,
current = a
end
if leader then
- local list = stacked(attribute,content,current)
- if leader ~= list then
- setleader(stack,list) -- only if ok
+ local content = getlist(leader)
+ if content then
+ local list = stacked(attribute,content,current)
+ if leader ~= list then
+ setleader(stack,list) -- only if ok
+ end
end
leader = false
end
@@ -683,7 +693,9 @@ local function stacker(attribute,head,default) -- no triggering, no inheritance,
end
end
elseif id == rule_code then
- check = getwidth(current) ~= 0
+-- check = getwidth(current) ~= 0
+local wd, ht, dp = getwhd(current)
+check = wd ~= 0 or (ht+dp) ~= 0
end
if check then
@@ -700,7 +712,17 @@ local function stacker(attribute,head,default) -- no triggering, no inheritance,
attrib = a
if leader then
-- tricky as a leader has to be a list so we cannot inject before
- local list = stacker(attribute,leader,attrib)
+ -- local list = stacker(attribute,leader,attrib)
+ -- leader = false
+
+ local content = getlist(leader)
+ if content then
+ local list = stacker(attribute,leader,attrib)
+ if leader ~= list then
+ setleader(current,list)
+ end
+ end
+
leader = false
end
end