diff options
Diffstat (limited to 'tex/context/base/mkiv/node-par.lmt')
-rw-r--r-- | tex/context/base/mkiv/node-par.lmt | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/tex/context/base/mkiv/node-par.lmt b/tex/context/base/mkiv/node-par.lmt new file mode 100644 index 000000000..af3125d23 --- /dev/null +++ b/tex/context/base/mkiv/node-par.lmt @@ -0,0 +1,48 @@ +if not modules then modules = { } end modules ['node-par'] = { + version = 1.001, + comment = "companion to node-ini.mkiv", + author = "Hans Hagen, PRAGMA-ADE, Hasselt NL", + copyright = "PRAGMA ADE / ConTeXt Development Team", + license = "see context related readme files" +} + +local starttiming = statistics.starttiming +local stoptiming = statistics.stoptiming + +local sequencers = utilities.sequencers + +-- This are called a lot! + +local actions = nodes.tasks.actions("everypar") + +local function everypar(head) + starttiming(builders) + head = actions(head) + stoptiming(builders) + return head +end + +callbacks.register("insert_par",everypar,"after paragraph start") + +local actions = sequencers.new { + name = "paragraph", + arguments = "mode,indented", + returnvalues = "indented", + results = "indented", +} + +sequencers.appendgroup(actions,"before") -- user +sequencers.appendgroup(actions,"system") -- private +sequencers.appendgroup(actions,"after" ) -- user + +local function paragraph(mode,indented) + local runner = actions.runner + if runner then + starttiming(builders) + indented = runner(mode,indented) + stoptiming(builders) + end + return indented +end + +callbacks.register("begin_paragraph",paragraph,"before paragraph start") |