summaryrefslogtreecommitdiff
path: root/tex/context/base/node-acc.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/node-acc.lua')
-rw-r--r--tex/context/base/node-acc.lua16
1 files changed, 16 insertions, 0 deletions
diff --git a/tex/context/base/node-acc.lua b/tex/context/base/node-acc.lua
index 537405921..d773b7acf 100644
--- a/tex/context/base/node-acc.lua
+++ b/tex/context/base/node-acc.lua
@@ -14,6 +14,7 @@ local tasks = nodes.tasks
local traverse_nodes = node.traverse
local traverse_id = node.traverse_id
local has_attribute = node.has_attribute
+local set_attribute = node.set_attribute
local copy_node = node.copy
local free_nodelist = node.flush_list
@@ -22,6 +23,10 @@ local glyph_code = nodecodes.glyph
local hlist_code = nodecodes.hlist
local vlist_code = nodecodes.vlist
+local a_characters = attributes.private("characters")
+
+-- todo: nbsp etc
+
local function injectspaces(head)
local p
for n in traverse_nodes(head) do
@@ -29,6 +34,10 @@ local function injectspaces(head)
if id == glue_code then -- todo: check for subtype related to spacing (13/14 but most seems to be 0)
-- local at = has_attribute(n,attribute)
-- if at then
+--~ local a = has_attribute(n,a_characters)
+--~ if a then
+--~ -- handle this in the export
+--~ else
if p and p.id == glyph_code then
local g = copy_node(p)
local c = g.components
@@ -37,13 +46,20 @@ local function injectspaces(head)
g.components = nil
g.subtype = 256
end
+ local a = has_attribute(n,a_characters)
local s = copy_node(n.spec)
g.char, n.spec = 32, s
p.next, g.prev = g, p
g.next, n.prev = n, g
s.width = s.width - g.width
+ if a then
+ set_attribute(g,a_characters,a)
+ end
+ set_attribute(s,a_characters,0)
+ set_attribute(n,a_characters,0)
end
-- end
+--~ end
elseif id == hlist_code or id == vlist_code then
injectspaces(n.list,attribute)
end