s-references-identify.mkiv /size: 1831 b    last modification: 2020-07-01 14:35
1%D \module
2%D   [      file=s-references-identity,
3%D        version=2018.09.15,
4%D          title=\CONTEXT\ Style File,
5%D       subtitle=Analyze References,
6%D         author=Hans Hagen,
7%D           date=\currentdate,
8%D      copyright={PRAGMA ADE \& \CONTEXT\ Development Team}]
9%C
10%C This module is part of the \CONTEXT\ macro||package and is
11%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
12%C details.
13
14% begin info
15%
16% title   : analyze reference
17%
18% comment : show the building blocks of a reference (list)
19%
20% end info
21
22\startmodule[references-identify]
23
24\startluacode
25
26moduledata.references = moduledata.references or { }
27
28local context = context
29local NC, NR = context.NC, context.NR
30local bold = context.bold
31local text = context
32
33function moduledata.references.show(str)
34    local t = structures.references.identify(str)
35    context.starttabulate { "|T|T|T|" }
36    for i=1,#t do
37        if i == 1 then
38            context.FL()
39        else
40            context.ML()
41        end
42        local ti = t[i]
43        NC() bold(i) NC() bold("reference") NC() bold(ti.reference)      NC() NR()
44        NC()         NC() text("kind")      NC() text(ti.kind)           NC() NR()
45        NC()         NC() text("operation") NC() text(ti.operation)      NC() NR()
46        NC()         NC() text("arguments") NC() text(ti.arguments)      NC() NR()
47        NC()         NC() text("special")   NC() text(ti.special)        NC() NR()
48    end
49    context.LL()
50    context.stoptabulate()
51end
52
53\stopluacode
54
55\installmodulecommandluasingle \showreference {moduledata.references.show}
56
57\stopmodule
58
59\continueifinputfile{s-references-identify.mkiv}
60
61\usemodule[art-01]
62
63\starttext
64
65    \showreference[page(123),StartMovie{mymovie}]
66    \showreference[JS(Forget_Changes),CloseDocument]
67    \showreference[manual::contents]
68
69\stoptext
70