diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/node-pro.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/base/node-pro.lua | 52 |
1 files changed, 22 insertions, 30 deletions
diff --git a/Master/texmf-dist/tex/context/base/node-pro.lua b/Master/texmf-dist/tex/context/base/node-pro.lua index 73d22697e05..ab5b77f908c 100644 --- a/Master/texmf-dist/tex/context/base/node-pro.lua +++ b/Master/texmf-dist/tex/context/base/node-pro.lua @@ -6,7 +6,6 @@ if not modules then modules = { } end modules ['node-pro'] = { license = "see context related readme files" } -local utf = unicode.utf8 local utfchar = utf.char local format, concat = string.format, table.concat @@ -57,9 +56,9 @@ local function tracer(what,state,head,groupcode,before,after,show) end n = n + 1 if show then - report_nodes("%s %s: %s, group: %s, nodes: %s -> %s, string: %s",what,n,state,groupcode,before,after,reconstruct(head)) + report_nodes("%s: location %a, state %a, group %a, # before %a, # after %s, stream: %s",what,n,state,groupcode,before,after,reconstruct(head)) else - report_nodes("%s %s: %s, group: %s, nodes: %s -> %s",what,n,state,groupcode,before,after) + report_nodes("%s: location %a, state %a, group %a, # before %a, # after %s",what,n,state,groupcode,before,after) end end @@ -68,21 +67,21 @@ processors.tracer = tracer processors.enabled = true -- this will become a proper state (like trackers) function processors.pre_linebreak_filter(head,groupcode,size,packtype,direction) - local first, found = first_glyph(head) + local first, found = first_glyph(head) -- they really need to be glyphs if found then if trace_callbacks then local before = nodes.count(head,true) - local head, done = actions(head,groupcode,size,packtype,direction) + local head, done = actions(head,groupcode,size,packtype,direction) -- todo : pass first local after = nodes.count(head,true) if done then tracer("pre_linebreak","changed",head,groupcode,before,after,true) else tracer("pre_linebreak","unchanged",head,groupcode,before,after,true) end - return (done and head) or true + return done and head or true else - local head, done = actions(head,groupcode,size,packtype,direction) - return (done and head) or true + local head, done = actions(head,groupcode,size,packtype,direction) -- todo : pass first + return done and head or true end elseif trace_callbacks then local n = nodes.count(head,false) @@ -95,7 +94,7 @@ local enabled = true function processors.hpack_filter(head,groupcode,size,packtype,direction) if enabled then - local first, found = first_glyph(head) + local first, found = first_glyph(head) -- they really need to be glyphs if found then if trace_callbacks then local before = nodes.count(head,true) @@ -128,8 +127,8 @@ function nodes.fasthpack(...) -- todo: pass explicit arguments return hp, b end -callbacks.register('pre_linebreak_filter', processors.pre_linebreak_filter,"all kind of horizontal manipulations (before par break)") -callbacks.register('hpack_filter' , processors.hpack_filter,"all kind of horizontal manipulations") +callbacks.register('pre_linebreak_filter', processors.pre_linebreak_filter, "all kind of horizontal manipulations (before par break)") +callbacks.register('hpack_filter' , processors.hpack_filter, "all kind of horizontal manipulations (before hbox creation)") local actions = tasks.actions("finalizers") -- head, where @@ -141,27 +140,20 @@ local actions = tasks.actions("finalizers") -- head, where -- something weird here .. group mvl when making a vbox function processors.post_linebreak_filter(head,groupcode) ---~ local first, found = first_glyph(head) ---~ if found then - if trace_callbacks then - local before = nodes.count(head,true) - local head, done = actions(head,groupcode) - local after = nodes.count(head,true) - if done then - tracer("post_linebreak","changed",head,groupcode,before,after,true) - else - tracer("post_linebreak","unchanged",head,groupcode,before,after,true) - end - return (done and head) or true + if trace_callbacks then + local before = nodes.count(head,true) + local head, done = actions(head,groupcode) + local after = nodes.count(head,true) + if done then + tracer("post_linebreak","changed",head,groupcode,before,after,true) else - local head, done = actions(head,groupcode) - return (done and head) or true + tracer("post_linebreak","unchanged",head,groupcode,before,after,true) end ---~ elseif trace_callbacks then ---~ local n = nodes.count(head,false) ---~ tracer("post_linebreak","no chars",head,groupcode,n,n) ---~ end ---~ return true + return (done and head) or true + else + local head, done = actions(head,groupcode) + return (done and head) or true + end end callbacks.register('post_linebreak_filter', processors.post_linebreak_filter,"all kind of horizontal manipulations (after par break)") |