diff options
Diffstat (limited to 'tex/context/base/mkiv/node-par.lua')
-rw-r--r-- | tex/context/base/mkiv/node-par.lua | 47 |
1 files changed, 38 insertions, 9 deletions
diff --git a/tex/context/base/mkiv/node-par.lua b/tex/context/base/mkiv/node-par.lua index bcb4621c9..56741e765 100644 --- a/tex/context/base/mkiv/node-par.lua +++ b/tex/context/base/mkiv/node-par.lua @@ -9,19 +9,48 @@ if not modules then modules = { } end modules ['node-par'] = { local starttiming = statistics.starttiming local stoptiming = statistics.stoptiming -local actions = nodes.tasks.actions("everypar") +local sequencers = utilities.sequencers --- this one is called a lot! +-- This are called a lot! + +if LUATEXFUNCTIONALITY > 6857 then + + local actions = nodes.tasks.actions("everypar") + + local function everypar(head) + starttiming(builders) + head = actions(head) + stoptiming(builders) + return head + end + + callbacks.register("insert_local_par",everypar,"after paragraph start") -local function everypar(head) - starttiming(builders) - head = actions(head) - stoptiming(builders) - return head end -if LUATEXFUNCTIONALITY > 6857 then +if LUATEXFUNCTIONALITY > 6870 then + + local actions = sequencers.new { + name = "newgraf", + arguments = "mode,indented", + returnvalues = "indented", + results = "indented", + } + + sequencers.appendgroup(actions,"before") -- user + sequencers.appendgroup(actions,"system") -- private + sequencers.appendgroup(actions,"after" ) -- user + + local function newgraf(mode,indented) + local runner = actions.runner + if runner then + starttiming(builders) + indent = runner(mode,indented) + stoptiming(builders) + end + return indented + end - callbacks.register("insert_local_par",everypar,"paragraph start") + callbacks.register("new_graf",newgraf,"before paragraph start") end |