summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/luatex/nodetree/nodetree.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/luatex/nodetree/nodetree.lua')
-rw-r--r--Master/texmf-dist/doc/luatex/nodetree/nodetree.lua45
1 files changed, 33 insertions, 12 deletions
diff --git a/Master/texmf-dist/doc/luatex/nodetree/nodetree.lua b/Master/texmf-dist/doc/luatex/nodetree/nodetree.lua
index a123bc42562..170f040c348 100644
--- a/Master/texmf-dist/doc/luatex/nodetree/nodetree.lua
+++ b/Master/texmf-dist/doc/luatex/nodetree/nodetree.lua
@@ -152,8 +152,8 @@ function tpl.round(number)
end
function tpl.length(input)
input = tonumber(input)
- input = input / 2^16
- return string.format('%gpt', tpl.round(input))
+ input = input / tex.sp('1' .. options.unit)
+ return string.format('%g%s', tpl.round(input), options.unit)
end
function tpl.fill(number, order, field)
if order ~= nil and order ~= 0 then
@@ -345,7 +345,15 @@ function tpl.branches(level, connection_type)
return out
end
function tpl.print(text)
- print(text)
+
+ if options.channel == 'log' then
+ if not log then
+ log = io.open(tex.jobname .. '_nodetree.log', 'a')
+ end
+ log:write(text, '\n')
+ else
+ print(' ' .. text)
+ end
end
function tree.format_field(head, field)
local out = ''
@@ -353,10 +361,23 @@ function tree.format_field(head, field)
return ''
end
if options.verbosity < 2 and
+ -- glyph
+ field == 'font' or
+ field == 'left' or
+ field == 'right' or
+ field == 'uchyph' or
+ -- hlist
+ field == 'dir' or
+ field == 'glue_order' or
+ field == 'glue_sign' or
+ field == 'glue_set' or
+ -- glue
+ field == 'stretch_order' then
+ return ''
+ elseif options.verbosity < 3 and
field == 'prev' or
field == 'next' or
field == 'id'
- or field == 'attr'
then
return ''
end
@@ -425,7 +446,6 @@ function tree.analyze_node(head, level)
for field_id, field_name in pairs(node.fields(head.id, head.subtype)) do
if field_name ~= 'next' and
field_name ~= 'prev' and
- field_name ~= 'attr' and
node.is_node(head[field_name]) then
fields[field_name] = head[field_name]
else
@@ -495,7 +515,7 @@ function callbacks.vpack_filter(head, groupcode, size, packtype, maxdepth, direc
groupcode = groupcode,
size = size,
packtype = packtype,
- maxdepth = maxdepth,
+ maxdepth = tpl.length(maxdepth),
direction = direction,
attributelist = attributelist,
}
@@ -503,27 +523,25 @@ function callbacks.vpack_filter(head, groupcode, size, packtype, maxdepth, direc
tree.analyze_callback(head)
return true
end
-function callbacks.hpack_qualtity(incident, detail, head, first, last)
+function callbacks.hpack_quality(incident, detail, head, first, last)
local variables = {
incident = incident,
detail = detail,
first = first,
last = last,
}
- tpl.callback('hpack_qualtity', variables)
+ tpl.callback('hpack_quality', variables)
tree.analyze_callback(head)
- return true
end
-function callbacks.vpack_qualtity(incident, detail, head, first, last)
+function callbacks.vpack_quality(incident, detail, head, first, last)
local variables = {
incident = incident,
detail = detail,
first = first,
last = last,
}
- tpl.callback('vpack_qualtity', variables)
+ tpl.callback('vpack_quality', variables)
tree.analyze_callback(head)
- return true
end
function callbacks.process_rule(head, width, height)
local variables = {
@@ -579,6 +597,7 @@ function callbacks.mlist_to_hlist(head, display_type, need_penalties)
}
tpl.callback('mlist_to_hlist', variables)
tree.analyze_callback(head)
+ return node.mlist_to_hlist(head, display_type, need_penalties)
end
function base.normalize_options()
options.verbosity = tonumber(options.verbosity)
@@ -591,6 +610,8 @@ function base.set_default_options()
engine = 'luatex',
color = 'colored',
decimalplaces = 2,
+ unit = 'pt',
+ channel = 'term',
}
if not options then
options = {}