summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/node-scn.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2017-02-20 15:53:16 +0100
committerContext Git Mirror Bot <phg42.2a@gmail.com>2017-02-20 15:53:16 +0100
commit7ddc6c5aec02c5802944772975133733dc0e7440 (patch)
tree584f033bef72a8ab4b1e2174c3b2eadef1940494 /tex/context/base/mkiv/node-scn.lua
parentb5ef32a9a6a99e134e669b702e89a55fbabf5306 (diff)
downloadcontext-7ddc6c5aec02c5802944772975133733dc0e7440.tar.gz
2017-02-20 15:15:00
Diffstat (limited to 'tex/context/base/mkiv/node-scn.lua')
-rw-r--r--tex/context/base/mkiv/node-scn.lua41
1 files changed, 30 insertions, 11 deletions
diff --git a/tex/context/base/mkiv/node-scn.lua b/tex/context/base/mkiv/node-scn.lua
index 2409750c2..67a0badec 100644
--- a/tex/context/base/mkiv/node-scn.lua
+++ b/tex/context/base/mkiv/node-scn.lua
@@ -238,9 +238,11 @@ nodes.processwords = function(attribute,data,flush,head,parent) -- we have hlist
return tonode(head), done
end
---
+-- works on lines !
+
+-- todo: stack because skip can change when nested
-local function processranges(attribute,flush,head,parent)
+local function processranges(attribute,flush,head,parent,depth,skip)
local n = head
if n then
local f, l, a
@@ -249,7 +251,8 @@ local function processranges(attribute,flush,head,parent)
local id = getid(n)
if id == glyph_code or id == rule_code then
local aa = getattr(n,attribute)
- if aa and aa ~= skip then
+-- if aa and (not skip or aa ~= skip) then
+ if aa then
if aa == a then
if not f then
f = n
@@ -257,13 +260,13 @@ local function processranges(attribute,flush,head,parent)
l = n
else
if f then
- head, done = flush(head,f,l,a,parent), true
+ head, done = flush(head,f,l,a,parent,depth), true
end
f, l, a = n, n, aa
end
else
if f then
- head, done = flush(head,f,l,a,parent), true
+ head, done = flush(head,f,l,a,parent,depth), true
end
f, l, a = nil, nil, nil
end
@@ -281,18 +284,35 @@ local function processranges(attribute,flush,head,parent)
elseif id == glue_code then
-- todo: leaders
elseif id == hlist_code or id == vlist_code then
- if f then
- l = n
+ local aa = getattr(n,attribute)
+-- if aa and (not skip or aa ~= skip) then
+ if aa then
+ if aa == a then
+ if not f then
+ f = n
+ end
+ l = n
+ else
+ if f then
+ head, done = flush(head,f,l,a,parent,depth), true
+ end
+ f, l, a = n, n, aa
+ end
+ else
+ if f then
+ head, done = flush(head,f,l,a,parent,depth), true
+ end
+ f, l, a = nil, nil, nil
end
local list = getlist(n)
if list then
- setlist(n,(processranges(attribute,flush,list,n,aa)))
+ setlist(n,(processranges(attribute,flush,list,n,depth+1,aa)))
end
end
n = getnext(n)
end
if f then
- head, done = flush(head,f,l,a,parent), true
+ head, done = flush(head,f,l,a,parent,depth), true
end
return head, done
else
@@ -305,7 +325,6 @@ nodes.processranges = function(attribute,flush,head,parent) -- we have hlistdir
if parent then
parent = tonut(parent)
end
- local head, done = processranges(attribute,flush,head,parent)
+ local head, done = processranges(attribute,flush,head,parent,0)
return tonode(head), done
end
-