1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32\input mtx context common . tex
33
34\setupbodyfont
35 [ dejavu , 1 1 pt , tt , \getdocumentargument { bodyfont } ]
36
37\setuptyping
38 [ lines = yes ]
39
40\setuplayout
41 [ header = 0 cm ,
42 footer = 1 . 5 cm ,
43 topspace = \getdocumentargumentdefault { topspace } { 1 . 5 cm } ,
44 backspace = \getdocumentargumentdefault { backspace } { 1 . 5 cm } ,
45 width = middle ,
46 height = middle ]
47
48\setuppapersize
49 [ \getdocumentargument { paperformat paper } ]
50 [ \getdocumentargument { paperformat print } ]
51
52\usemodule [ xml analyzers ]
53
54\starttext
55
56\startluacode
57 local files = document . files
58 local pattern = document . arguments . pattern or ( # files = = 1 and files [ 1 ] )
59 local analyze = document . arguments . analyze
60 local template = document . arguments . template
61
62 if pattern then
63 files = dir . glob ( pattern )
64 context . setupfootertexts ( { pattern } , { " pagenumber " } )
65 else
66 context . setupfootertexts ( { table . concat ( files , " " ) } , { " pagenumber " } )
67 end
68
69 if # files > 0 then
70 if analyze then
71 moduledata . xml . analyzers . structure ( files )
72 context . page ( )
73 moduledata . xml . analyzers . characters ( files )
74 context . page ( )
75 moduledata . xml . analyzers . entities ( files )
76 if template then
77 moduledata . xml . analyzers . allsetups ( files , type ( template ) = = " string " and template or nil )
78 end
79 context . page ( )
80 for i = 1 , # files do
81 context . type ( files [ i ] )
82 context . par ( )
83 end
84 else
85 context ( " no action given " )
86 end
87 else
88 context ( " no files given " )
89 end
90\stopluacode
91
92\stoptext
93 |