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\input mtxcontextcommon.tex
32
33\doifdocumentargumentelse {paperoffset} {
34
35 \setuplayout
36 [topspace=\getdocumentargument{paperoffset},
37 backspace=\getdocumentargument{paperoffset}]
38
39} {
40
41 \setuplayout
42 [topspace=0pt,
43 backspace=0pt]
44
45}
46
47\setuppapersize
48 [\getdocumentargument{paperformatpaper}]
49 [\getdocumentargument{paperformatprint}]
50
51\setuplayout
52 [header=0pt,
53 footer=0pt,
54 width=middle,
55 height=middle]
56
57\doifnotdocumentargument {bannerheight} {
58 \setuplayout
59 [footer=1cm]
60}
61
62\doifelse {\getdocumentargument{nobanner}} {yes} {
63 \setuplayout
64 [footer=0cm]
65 \setupbackgrounds
66 [page]
67 [background=]
68} {
69 \definelayer
70 [page]
71 [width=\paperwidth,
72 height=\paperheight]
73
74 \setupbackgrounds
75 [page]
76 [background=page]
77}
78
79\setupexternalfigures
80 [directory=]
81
82\starttext
83
84\startluacode
85 local format = string.format
86
87 if #document.files > 0 then
88 if document.arguments["sort"] then
89 table.sort(document.files)
90 end
91 local dobanner = not document.arguments["nobanner"]
92 local bannerheight = document.arguments["bannerheight"]
93 local nx = document.arguments.combination_nx or 2
94 local ny = document.arguments.combination_ny or 2
95 for _, filename in ipairs(document.files) do
96 if not string.find(filename,"^mtx%-context%-") then
97
98 local bannerstring = format("\\tttf\\detokenize{%s}\\quad\\quad\\currentdate\\quad\\quad\\pagenumber",file.basename(filename))
99 if dobanner then
100 if bannerheight then
101 context("\\setuptexttexts[{\\setlayerframed[page][preset=middlebottom][frame=off,height=%s]{%s}}]",bannerheight,bannerstring)
102 else
103 context("\\setupfootertexts[{%s}]",bannerstring)
104 end
105 end
106 context("\\combinepages[%s][nx=%s,ny=%s]",filename,nx,ny)
107 context("\\page")
108 end
109 end
110 else
111 context("no files given")
112 end
113\stopluacode
114
115\stoptext
116
117 |