summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/lang-rep.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2017-02-17 10:31:56 +0100
committerContext Git Mirror Bot <phg42.2a@gmail.com>2017-02-17 10:31:56 +0100
commitb14f992ef5f4e868c9959b174278c86516d60dbc (patch)
tree28587bb46c025ea7b0d27ba93f09c93dcf53c73a /tex/context/base/mkiv/lang-rep.lua
parent95a1799032dc61dbca4a11e495be34b4397c8fec (diff)
downloadcontext-b14f992ef5f4e868c9959b174278c86516d60dbc.tar.gz
2017-02-17 10:23:00
Diffstat (limited to 'tex/context/base/mkiv/lang-rep.lua')
-rw-r--r--tex/context/base/mkiv/lang-rep.lua23
1 files changed, 14 insertions, 9 deletions
diff --git a/tex/context/base/mkiv/lang-rep.lua b/tex/context/base/mkiv/lang-rep.lua
index 2e998b7fb..6fde353f7 100644
--- a/tex/context/base/mkiv/lang-rep.lua
+++ b/tex/context/base/mkiv/lang-rep.lua
@@ -52,11 +52,13 @@ local getchar = nuts.getchar
local isglyph = nuts.isglyph
local setfield = nuts.setfield
+local getfield = nuts.getfield
local setattr = nuts.setattr
local setlink = nuts.setlink
local setnext = nuts.setnext
local setprev = nuts.setprev
local setchar = nuts.setchar
+local setattrlist = nuts.setattrlist
local insert_node_before = nuts.insert_before
local remove_node = nuts.remove
@@ -70,6 +72,8 @@ local new_disc = nodepool.disc
local texsetattribute = tex.setattribute
local unsetvalue = attributes.unsetvalue
+local enableaction = nodes.tasks.enableaction
+
local v_reset = interfaces.variables.reset
local implement = interfaces.implement
@@ -222,34 +226,35 @@ function replacements.handler(head)
local i = 1
while i <= newlength do
local codes = newcodes[i]
- local new = nil
if type(codes) == "table" then
local method = codes[1]
if method == "discretionary" then
local pre, post, replace = codes[2], codes[3], codes[4]
- new = new_disc()
if pre then
- setfield(new,"pre",tonodes(pre,last))
+ pre = tonodes(pre,last)
end
if post then
- setfield(new,"post",tonodes(post,last))
+ post = tonodes(post,last)
end
if replace then
- setfield(new,"replace",tonodes(replace,last))
+ replace = tonodes(replace,last)
end
+ -- todo: also set attr
+ local new = new_disc(pre,post,replace)
+ setattrlist(new,last)
head, current = insert_after(head,current,new)
elseif method == "noligature" then
-- not that efficient to copy but ok for testing
local list = codes[2]
if list then
for i=1,#list do
- new = copy_node(last)
+ local new = copy_node(last)
setchar(new,list[i])
setattr(new,a_noligature,1)
head, current = insert_after(head,current,new)
end
else
- new = copy_node(last)
+ local new = copy_node(last)
setchar(new,zwnj)
head, current = insert_after(head,current,new)
end
@@ -257,7 +262,7 @@ function replacements.handler(head)
-- todo
end
else
- new = copy_node(last)
+ local new = copy_node(last)
setchar(new,codes)
head, current = insert_after(head,current,new)
end
@@ -310,7 +315,7 @@ function replacements.set(n)
else
n = lists[n].attribute
if not enabled then
- nodes.tasks.enableaction("processors","languages.replacements.handler")
+ enableaction("processors","languages.replacements.handler")
if trace_replacements then
report_replacement("enabling replacement handler")
end