summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/node-shp.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/node-shp.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/node-shp.lua42
1 files changed, 23 insertions, 19 deletions
diff --git a/Master/texmf-dist/tex/context/base/node-shp.lua b/Master/texmf-dist/tex/context/base/node-shp.lua
index 50b16efa581..75177a4edde 100644
--- a/Master/texmf-dist/tex/context/base/node-shp.lua
+++ b/Master/texmf-dist/tex/context/base/node-shp.lua
@@ -6,27 +6,32 @@ if not modules then modules = { } end modules ['node-shp'] = {
license = "see context related readme files"
}
-local hlist = node.id('hlist')
-local vlist = node.id('vlist')
-local disc = node.id('disc')
-local mark = node.id('mark')
-local kern = node.id('kern')
-local glue = node.id('glue')
+local nodes, node = nodes, node
+
+local nodecodes = nodes.nodecodes
+local tasks = nodes.tasks
+
+local hlist_code = nodecodes.hlist
+local vlist_code = nodecodes.vlist
+local disc_code = nodecodes.disc
+local mark_code = nodecodes.mark
+local kern_code = nodecodes.kern
+local glue_code = nodecodes.glue
local free_node = node.free
local remove_node = node.remove
-local function cleanup_page(head) -- rough
+local function cleanup(head) -- rough
local start = head
while start do
local id = start.id
- if id == disc or (id == glue and not start.writable) or (id == kern and start.kern == 0) or id == mark then
+ if id == disc_code or (id == glue_code and not start.writable) or (id == kern_code and start.kern == 0) or id == mark_code then
head, start, tmp = remove_node(head,start)
free_node(tmp)
- elseif id == hlist or id == vlist then
+ elseif id == hlist_code or id == vlist_code then
local sl = start.list
if sl then
- start.list = cleanup_page(sl)
+ start.list = cleanup(sl)
start = start.next
else
head, start, tmp = remove_node(head,start)
@@ -39,20 +44,19 @@ local function cleanup_page(head) -- rough
return head
end
-nodes.cleanup_page_first = false
+directives.register("backend.cleanup", function()
+ tasks.enableaction("shipouts","nodes.handlers.cleanuppage")
+end)
-function nodes.cleanup_page(head)
+function nodes.handlers.cleanuppage(head)
-- about 10% of the nodes make no sense for the backend
- if nodes.cleanup_page_first then
- head = cleanup_page(head)
- end
- return head, false
+ return cleanup(head), true
end
-local actions = tasks.actions("shipouts",0) -- no extra arguments
+local actions = tasks.actions("shipouts") -- no extra arguments
-function nodes.process_page(head) -- problem, attr loaded before node, todo ...
+function nodes.handlers.finalize(head) -- problem, attr loaded before node, todo ...
return actions(head)
end
---~ nodes.process_page = actions
+--~ nodes.handlers.finalize = actions