node-par.lua /size: 1304 b    last modification: 2020-07-01 14:35
1
if
not
modules
then
modules
=
{
}
end
modules
[
'
node-par
'
]
=
{
2
version
=
1
.
001
,
3
comment
=
"
companion to node-ini.mkiv
"
,
4
author
=
"
Hans Hagen, PRAGMA-ADE, Hasselt NL
"
,
5
copyright
=
"
PRAGMA ADE / ConTeXt Development Team
"
,
6
license
=
"
see context related readme files
"
7
}
8 9
local
starttiming
=
statistics
.
starttiming
10
local
stoptiming
=
statistics
.
stoptiming
11 12
local
sequencers
=
utilities
.
sequencers
13 14
-- This are called a lot!
15 16
local
actions
=
nodes
.
tasks
.
actions
(
"
everypar
"
)
17 18
local
function
everypar
(
head
)
19
starttiming
(
builders
)
20
head
=
actions
(
head
)
21
stoptiming
(
builders
)
22
return
head
23
end
24 25
callbacks
.
register
(
"
insert_local_par
"
,
everypar
,
"
after paragraph start
"
)
26 27
local
actions
=
sequencers
.
new
{
28
name
=
"
newgraf
"
,
29
arguments
=
"
mode,indented
"
,
30
returnvalues
=
"
indented
"
,
31
results
=
"
indented
"
,
32
}
33 34
sequencers
.
appendgroup
(
actions
,
"
before
"
)
-- user
35
sequencers
.
appendgroup
(
actions
,
"
system
"
)
-- private
36
sequencers
.
appendgroup
(
actions
,
"
after
"
)
-- user
37 38
local
function
newgraf
(
mode
,
indented
)
39
local
runner
=
actions
.
runner
40
if
runner
then
41
starttiming
(
builders
)
42
indented
=
runner
(
mode
,
indented
)
43
stoptiming
(
builders
)
44
end
45
return
indented
46
end
47 48
callbacks
.
register
(
"
new_graf
"
,
newgraf
,
"
before paragraph start
"
)
49