summaryrefslogtreecommitdiff
path: root/tex/context/base/node-tra.lua
diff options
context:
space:
mode:
authorMarius <mariausol@gmail.com>2012-10-19 01:20:13 +0300
committerMarius <mariausol@gmail.com>2012-10-19 01:20:13 +0300
commit69d2352af4b60929b37fc49f3bdb263977016244 (patch)
treedb5eb11398e345dfa23b4c4500fb93575d2afb7c /tex/context/base/node-tra.lua
parentc18f7cbe51449a611ea1819fedd9a4ff18529b7d (diff)
downloadcontext-69d2352af4b60929b37fc49f3bdb263977016244.tar.gz
stable 2012.05.30 11:26
Diffstat (limited to 'tex/context/base/node-tra.lua')
-rw-r--r--tex/context/base/node-tra.lua90
1 files changed, 14 insertions, 76 deletions
diff --git a/tex/context/base/node-tra.lua b/tex/context/base/node-tra.lua
index 6b5f49964..70e4639b8 100644
--- a/tex/context/base/node-tra.lua
+++ b/tex/context/base/node-tra.lua
@@ -46,7 +46,6 @@ local copy_node_list = node.copy_list
local hpack_node_list = node.hpack
local free_node_list = node.flush_list
local traverse_nodes = node.traverse
-local traverse_by_id = node.traverse_id
local nodecodes = nodes.nodecodes
local whatcodes = nodes.whatcodes
@@ -220,7 +219,7 @@ function step_tracers.nofsteps()
return context(#collection)
end
-function step_tracers.glyphs(n,i) -- no need for hpack
+function step_tracers.glyphs(n,i)
local c = collection[i]
if c then
tex.box[n] = hpack_node_list(copy_node_list(c))
@@ -353,7 +352,7 @@ end
function nodes.handlers.checkglyphs(head,message)
local t = { }
- for g in traverse_by_id(glyph_code,head) do
+ for g in traverse_id(glyph_code,head) do
t[#t+1] = format("U+%04X:%s",g.char,g.subtype)
end
if #t > 0 then
@@ -540,7 +539,7 @@ end
nodes.showsimplelist = function(h,depth) showsimplelist(h,depth,0) end
-local function listtoutf(h,joiner,textonly,last)
+local function listtoutf(h,joiner,textonly)
local joiner = (joiner == true and utfchar(0x200C)) or joiner -- zwnj
local w = { }
while h do
@@ -558,17 +557,13 @@ local function listtoutf(h,joiner,textonly,last)
mid and listtoutf(mid,joiner,textonly) or ""
)
elseif textonly then
- if id == glue_code and h.spec and h.spec.width > 0 then
+ if id == glue_code and h.width > 0 then
w[#w+1] = " "
end
else
w[#w+1] = "[-]"
end
- if h == last then
- break
- else
- h = h.next
- end
+ h = h.next
end
return concat(w)
end
@@ -715,79 +710,22 @@ local get_attribute = node.has_attribute
local set_attribute = node.set_attribute
local unset_attribute = node.unset_attribute
-local a_color = attributes.private('color')
-local a_colormodel = attributes.private('colormodel')
-local a_state = attributes.private('state')
-local m_color = attributes.list[a_color] or { }
+local attribute = attributes.private('color')
+local colormodel = attributes.private('colormodel')
+local mapping = attributes.list[attribute] or { }
function colors.set(n,c,s)
- local mc = m_color[c]
+ local mc = mapping[c]
if not mc then
- unset_attribute(n,a_color)
+ unset_attribute(n,attribute)
else
- if not get_attribute(n,a_colormodel) then
- set_attribute(n,a_colormodel,s or 1)
- end
- set_attribute(n,a_color,mc)
- end
-end
-
-function colors.setlist(n,c,s)
- while n do
- local mc = m_color[c]
- if not mc then
- unset_attribute(n,a_color)
- else
- if not get_attribute(n,a_colormodel) then
- set_attribute(n,a_colormodel,s or 1)
- end
- set_attribute(n,a_color,mc)
+ if not get_attribute(n,colormodel) then
+ set_attribute(n,colormodel,s or 1)
end
- n = n.next
+ set_attribute(n,attribute,mc)
end
end
function colors.reset(n)
- unset_attribute(n,a_color)
-end
-
--- maybe
-
-local transparencies = { }
-tracers.transparencies = transparencies
-
-local a_transparency = attributes.private('transparency')
-local m_transparency = attributes.list[a_transparency] or { }
-
-function transparencies.set(n,t)
- local mt = m_transparency[t]
- if not mt then
- unset_attribute(n,a_transparency)
- else
- set_attribute(n,a_transparency,mt)
- end
-end
-
-function transparencies.setlist(n,c,s)
- while n do
- local mt = m_transparency[c]
- if not mt then
- unset_attribute(n,a_transparency)
- else
- set_attribute(n,a_transparency,mt)
- end
- n = n.next
- end
-end
-
-function transparencies.reset(n)
- unset_attribute(n,a_transparency)
-end
-
--- for the moment here
-
-nodes.visualizers = { }
-
-function nodes.visualizers.handler(head)
- return head, false
+ unset_attribute(n,attribute)
end