1
2
3
4
5
6
7
8
9
10
11
12
13
14\unprotect
15
16\startluacode
17 local context = context
18 local ctx_NC, ctx_NR = context.NC, context.NR
19 local ctx_bold = context.bold
20
21 structures.tracers = structures.tracers or { }
22
23 function structures.tracers.showsections()
24
25 local list = structures.sections.registered
26 local keys = table.keys(list)
27 table.sort(keys,function(a,b)
28 local la, lb = list[a].level, list[b].level
29 if la == lb then
30 return a < b
31 else
32 return la < lb
33 end
34 end)
35 context.start()
36 context.switchtobodyfont { "tt" }
37 context.starttabulate { "||c||||" }
38 context.FL()
39 ctx_NC() ctx_bold("name")
40 ctx_NC() ctx_bold("level")
41 ctx_NC() ctx_bold("parent")
42 ctx_NC() ctx_bold("section")
43 ctx_NC() ctx_bold("coupling")
44 ctx_NC() context.NR()
45 context.ML()
46 for i=1,#keys do
47 local k = keys[i]
48 local v = list[k]
49 ctx_NC() ctx_bold(k)
50 ctx_NC() context(v.level)
51 ctx_NC() context(v.parent)
52 ctx_NC() context(v.section)
53 ctx_NC() context(v.coupling)
54 ctx_NC() context.NR()
55 end
56 context.LL()
57 context.stoptabulate()
58 context.stop()
59
60 end
61\stopluacode
62
63
64\starttexdefinition showstructuresections
65
66
67
68 \ctxlua{structures.tracers.showsections()}
69
70\stoptexdefinition
71
72\protect
73
74\continueifinputfile{sstructuresections.mkiv}
75
76\starttext
77
78 \showstructuresections
79
80\stoptext
81 |