diff options
author | Norbert Preining <preining@logic.at> | 2019-02-24 15:12:57 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2019-02-24 15:12:57 +0000 |
commit | 1314fbe93790c501dc436a5cf99f106b9e5c0f63 (patch) | |
tree | 04dc7734c8be8ffe385d41f4388826ef5857b6f9 /Master/texmf-dist/tex/context/base/mkiv/lang-hyp.lua | |
parent | eb80ce7b34f59896a1dfee5ca422495394d6677f (diff) |
Revert "ConTeXt version 2019.02.22 19:35"
This reverts commit 5c6357cdb820b4f628d036ba7b2248f221d50c0b.
git-svn-id: svn://tug.org/texlive/trunk@50112 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/lang-hyp.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/base/mkiv/lang-hyp.lua | 68 |
1 files changed, 28 insertions, 40 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/lang-hyp.lua b/Master/texmf-dist/tex/context/base/mkiv/lang-hyp.lua index 92b400d4f53..e29446b65ac 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/lang-hyp.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/lang-hyp.lua @@ -626,10 +626,13 @@ if context then local math_code = nodecodes.math local hlist_code = nodecodes.hlist - local automaticdisc_code = disccodes.automatic - local regulardisc_code = disccodes.regular + local discretionary_code = disccodes.discretionary + local explicit_code = disccodes.explicit + local automatic_code = disccodes.automatic + local regular_code = disccodes.regular local nuts = nodes.nuts + local tonut = nodes.tonut local tonode = nodes.tonode local nodepool = nuts.pool @@ -663,9 +666,7 @@ if context then local remove_node = nuts.remove local end_of_math = nuts.end_of_math local node_tail = nuts.tail - - local nexthlist = nuts.traversers.hlist - local nextdisc = nuts.traversers.disc + local traverse_id = nuts.traverse_id local setcolor = nodes.tracers.colors.set @@ -1027,7 +1028,9 @@ featureset.hyphenonly = hyphenonly == v_yes function traditional.hyphenate(head) - local first = head + local first = tonut(head) + + local tail = nil local last = nil local current = first @@ -1286,7 +1289,7 @@ featureset.hyphenonly = hyphenonly == v_yes if leftchar then post = serialize(true,leftchar) end - setdisc(disc,pre,post,nil,regulardisc_code,hyphenpenalty) + setdisc(disc,pre,post,nil,regular_code,hyphenpenalty) if attrnode then setattrlist(disc,attrnode) end @@ -1321,7 +1324,7 @@ featureset.hyphenonly = hyphenonly == v_yes end end -- maybe regular code - setdisc(disc,pre,post,replace,regulardisc_code,hyphenpenalty) + setdisc(disc,pre,post,replace,regular_code,hyphenpenalty) if attrnode then setattrlist(disc,attrnode) end @@ -1361,7 +1364,7 @@ featureset.hyphenonly = hyphenonly == v_yes end pre = copy_node(glyph) setchar(pre,rightchar and rightchar > 0 and rightchar or code) - setdisc(disc,pre,post,replace,automaticdisc_code,hyphenpenalty) -- ex ? + setdisc(disc,pre,post,replace,automatic_code,hyphenpenalty) -- ex ? if attrnode then setattrlist(disc,attrnode) end @@ -1383,7 +1386,7 @@ featureset.hyphenonly = hyphenonly == v_yes local pre = copy_list(start) local post = nil local replace = start - setdisc(disc,pre,post,replace,automaticdisc_code,hyphenpenalty) -- ex ? + setdisc(disc,pre,post,replace,automatic_code,hyphenpenalty) -- ex ? if attrnode then setattrlist(disc,attrnode) end @@ -1582,7 +1585,7 @@ featureset.hyphenonly = hyphenonly == v_yes stoptiming(traditional) - return head + return head, true end statistics.register("hyphenation",function() @@ -1610,31 +1613,15 @@ featureset.hyphenonly = hyphenonly == v_yes -- local replaceaction = nodes.tasks.replaceaction -- no longer overload this way (too many local switches) - local hyphenate = lang.hyphenate - local hyphenating = nuts.hyphenating - local methods = { } - local usedmethod = false - local stack = { } - - local original = hyphenating and - function(head) - return (hyphenating(head)) - end - or - function(head) - hyphenate(tonode(head)) - return head -- a nut - end + local hyphenate = lang.hyphenate + local methods = { } + local usedmethod = false + local stack = { } - -- local has_language = lang.has_language - -- - -- local function original(head) -- kernel.hyphenation(head) - -- local h = tonode(head) - -- if has_language(h) then - -- hyphenate(h) - -- end - -- return head - -- end + local function original(head) + local done = hyphenate(head) + return head, done + end local getcount = tex.getcount @@ -1650,13 +1637,13 @@ featureset.hyphenonly = hyphenonly == v_yes forced = false return usedmethod(head) else - return head + return head, false end else return usedmethod(head) end else - return head + return head, false end end @@ -1742,12 +1729,13 @@ featureset.hyphenonly = hyphenonly == v_yes } function nodes.stripdiscretionaries(head) - for l in nexthlist, head do - for d in nextdisc, getlist(l) do + local h = tonut(head) + for l in traverse_id(hlist_code,h) do + for d in traverse_id(disc_code,getlist(l)) do remove_node(h,false,true) end end - return head + return tonode(h) end |