diff options
author | Marius <mariausol@gmail.com> | 2014-01-07 15:20:21 +0200 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2014-01-07 15:20:21 +0200 |
commit | ff54944f72aa8a402a330a82e847c9c19fba5f24 (patch) | |
tree | 961dc9e94862dbc1f3cbc98d55f81b66b7c8bda4 /tex/context/base/math-dir.lua | |
parent | 9e10531d96003139dbb12ef6c59f9b9827a65121 (diff) | |
download | context-ff54944f72aa8a402a330a82e847c9c19fba5f24.tar.gz |
beta 2014.01.07 14:00
Diffstat (limited to 'tex/context/base/math-dir.lua')
-rw-r--r-- | tex/context/base/math-dir.lua | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/tex/context/base/math-dir.lua b/tex/context/base/math-dir.lua index 507a24e41..ec64e6787 100644 --- a/tex/context/base/math-dir.lua +++ b/tex/context/base/math-dir.lua @@ -23,8 +23,19 @@ local trace_directions = false trackers.register("typesetters.directions.math local report_directions = logs.reporter("typesetting","math directions") -local insert_node_before = nodes.insert_before -local insert_node_after = nodes.insert_after +local nuts = nodes.nuts +local tonut = nuts.tonut +local tonode = nuts.tonode + +local getnext = nuts.getnext +local getchar = nuts.getchar +local getid = nuts.getid +local getlist = nuts.getlist +local setfield = nuts.setfield +local getattr = nuts.getattr + +local insert_node_before = nuts.insert_before +local insert_node_after = nuts.insert_after local nodecodes = nodes.nodecodes local tasks = nodes.tasks @@ -33,7 +44,7 @@ local glyph_code = nodecodes.glyph local hlist_code = nodecodes.hlist local vlist_code = nodecodes.vlist -local nodepool = nodes.pool +local nodepool = nuts.pool local new_textdir = nodepool.textdir @@ -61,9 +72,9 @@ local function processmath(head) stop = nil end while current do - local id = current.id + local id = getid(current) if id == glyph_code then - local char = current.char + local char = getchar(current) local cdir = chardirections[char] if cdir == "en" or cdir == "an" then -- we could check for mathclass punctuation if not start then @@ -83,7 +94,7 @@ local function processmath(head) if mirror then local class = charclasses[char] if class == "open" or class == "close" then - current.char = mirror + setfield(current,"char",mirror) if trace_directions then report_directions("mirrored: %C to %C",char,mirror) end @@ -101,14 +112,14 @@ local function processmath(head) -- math can pack things into hlists .. we need to make sure we don't process -- too often: needs checking if id == hlist_code or id == vlist_code then - local list, d = processmath(current.list) - current.list = list + local list, d = processmath(getlist(current)) + setfield(current,"list",list) if d then done = true end end end - current = current.next + current = getnext(current) end if not start then -- nothing @@ -124,9 +135,11 @@ local enabled = false function directions.processmath(head) -- style, penalties if enabled then - local a = head[a_mathbidi] + local h = tonut(head) + local a = getattr(h,a_mathbidi) if a and a > 0 then - return processmath(head) + local head, done = processmath(h) + return tonode(head), done end end return head, false |