-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgen_usb.awk
265 lines (189 loc) · 10.6 KB
/
gen_usb.awk
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
function arabic2roman(x, y, z) {
if (!x) {return "nulla"}
if (x > 3999) {return "max input: 3999"}
for (y=1; ar[y]; y++) {
while (x >= ar[y]) {
x -= ar[y];
z = z ro[y]
}
}
return z
}
BEGIN {
proceedingspdf="Conf_Proceedings.pdf"
#arabic2roman init
split("1000 900 500 400 100 90 50 40 10 9 5 4 1", ar)
split("m cm d cd c xc l xl x ix v iv i", ro)
FS=";"
#system("cp CONF_*.png CONF_Online/images");
system("cp " proceedingspdf " CONF_Online/files");
system(". ./config.txt; sed s/\\${conferencename}/\"${conferencename}\"/ usb_header.html | sed s/\\${acronym}/\"${acronym}\"/ | sed s/\\${city}/\"${city}\"/ | sed s/\\${monthday}/\"${monthday}\"/ | sed s/\\${country}/\"${country}\"/ | sed s/\\${isbn}/\"${isbn}\"/ | sed s/\\${catalognumber}/\"${catalognumber}\"/ | sed s/\\${year}/\"${year}\"/");
cur_pag=1
print "<a id=\"frontmatter\"></a>"
print "<div class=\"chapternumber\">Front Matter</div>"
#cover
npages = 1
pagi = cur_pag
pagf = cur_pag + npages -1
if( cur_pag < 10 ) outfile = "00" cur_pag ".pdf"
else if(cur_pag < 100) outfile = "0" cur_pag ".pdf"
else outfile = "" cur_pag ".pdf"
pdftk_comm = "pdftk " proceedingspdf " cat " pagi "-" pagf " output CONF_Online/files/" outfile
#print pdftk_comm
system(pdftk_comm);
print "<span class=\"title\">Cover</span>"
print "<span class=\"pages\">pages " arabic2roman(pagi) "-" arabic2roman(pagf) "</span> <span class=\"pdflink\">Full text: <a href=\"files/" outfile "\">pdf</a></span>"
cur_pag=cur_pag+npages
#title page
npages = 1
pagi = cur_pag
pagf = cur_pag + npages -1
if( cur_pag < 10 ) outfile = "00" cur_pag ".pdf"
else if(cur_pag < 100) outfile = "0" cur_pag ".pdf"
else outfile = "" cur_pag ".pdf"
pdftk_comm = "pdftk " proceedingspdf " cat " pagi "-" pagf " output CONF_Online/files/" outfile
#print pdftk_comm
system(pdftk_comm);
print "<span class=\"title\">Title page</span>"
print "<span class=\"pages\">pages " arabic2roman(pagi) "-" arabic2roman(pagf) "</span> <span class=\"pdflink\">Full text: <a href=\"files/" outfile "\">pdf</a></span>"
cur_pag=cur_pag+npages
#copyright page
npages = 1
pagi = cur_pag
pagf = cur_pag + npages -1
if( cur_pag < 10 ) outfile = "00" cur_pag ".pdf"
else if(cur_pag < 100) outfile = "0" cur_pag ".pdf"
else outfile = "" cur_pag ".pdf"
pdftk_comm = "pdftk " proceedingspdf " cat " pagi "-" pagf " output CONF_Online/files/" outfile
#print pdftk_comm
system(pdftk_comm);
print "<span class=\"title\">Copyright page</span>"
print "<span class=\"pages\">pages " arabic2roman(pagi) "-" arabic2roman(pagf) "</span> <span class=\"pdflink\">Full text: <a href=\"files/" outfile "\">pdf</a></span>"
cur_pag=cur_pag+npages
#welcome message
npages = 1
pagi = cur_pag
pagf = cur_pag + npages -1
if( cur_pag < 10 ) outfile = "00" cur_pag ".pdf"
else if(cur_pag < 100) outfile = "0" cur_pag ".pdf"
else outfile = "" cur_pag ".pdf"
pdftk_comm = "pdftk " proceedingspdf " cat " pagi "-" pagf " output CONF_Online/files/" outfile
#print pdftk_comm
system(pdftk_comm);
print "<span class=\"title\">Welcome Message</span>"
print "<span class=\"pages\">pages " arabic2roman(pagi) "-" arabic2roman(pagf) "</span> <span class=\"pdflink\">Full text: <a href=\"files/" outfile "\">pdf</a></span>"
cur_pag=cur_pag+npages
#committees
npages = 1
pagi = cur_pag
pagf = cur_pag + npages -1
if( cur_pag < 10 ) outfile = "00" cur_pag ".pdf"
else if(cur_pag < 100) outfile = "0" cur_pag ".pdf"
else outfile = "" cur_pag ".pdf"
pdftk_comm = "pdftk " proceedingspdf " cat " pagi "-" pagf " output CONF_Online/files/" outfile
#print pdftk_comm
system(pdftk_comm);
print "<span class=\"title\">CONF'YYYY Committees</span>"
print "<span class=\"pages\">pages " arabic2roman(pagi) "-" arabic2roman(pagf) "</span> <span class=\"pdflink\">Full text: <a href=\"files/" outfile "\">pdf</a></span>"
cur_pag=cur_pag+npages
#conference program
npages = 3
pagi = cur_pag
pagf = cur_pag + npages -1
if( cur_pag < 10 ) outfile = "00" cur_pag ".pdf"
else if(cur_pag < 100) outfile = "0" cur_pag ".pdf"
else outfile = "" cur_pag ".pdf"
pdftk_comm = "pdftk " proceedingspdf " cat " pagi "-" pagf " output CONF_Online/files/" outfile
#print pdftk_comm
system(pdftk_comm);
print "<span class=\"title\">Conference Program</span>"
print "<span class=\"pages\">pages " arabic2roman(pagi) "-" arabic2roman(pagf) "</span> <span class=\"pdflink\">Full text: <a href=\"files/" outfile "\">pdf</a></span>"
cur_pag=cur_pag+npages
#table of contents
npages = 1
pagi = cur_pag
pagf = cur_pag + npages -1
if( cur_pag < 10 ) outfile = "00" cur_pag ".pdf"
else if(cur_pag < 100) outfile = "0" cur_pag ".pdf"
else outfile = "" cur_pag ".pdf"
pdftk_comm = "pdftk " proceedingspdf " cat " pagi "-" pagf " output CONF_Online/files/" outfile
#print pdftk_comm
system(pdftk_comm);
cur_pag=cur_pag+npages
pagesfront = cur_pag-1
print "<span class=\"title\">Table of Contents</span>"
print "<span class=\"pages\">pages " arabic2roman(pagi) "-" arabic2roman(pagf) "</span> <span class=\"pdflink\">Full text: <a href=\"files/" outfile "\">pdf</a></span>"
print "<a id=\"mainmatter\"></a>"
print "<div class=\"chapternumber\">Main Matter</div>"
#invited paper 1
#npages = 1
#pagi = cur_pag
#pagf = cur_pag + npages -1
#if( cur_pag < 10 ) outfile = "00" cur_pag ".pdf"
#else if(cur_pag < 100) outfile = "0" cur_pag ".pdf"
#else outfile = "" cur_pag ".pdf"
#pdftk_comm = "pdftk " proceedingspdf " cat " pagi "-" pagf " output CONF_Online/files/" outfile
#print pdftk_comm
#system(pdftk_comm);
#print "<span class=\"title\">TITLE</span>"
#print "<span class=\"author\">KEYNOTE</span>"
#print "<span class=\"pages\">pages " (pagi-pagesfront) "-" (pagf-pagesfront) "</span> <span class=\"pdflink\">Full text: <a href=\"files/" outfile "\">pdf</a></span>"
#cur_pag=cur_pag+npages
#invited paper 2
#npages = 1
#pagi = cur_pag
#pagf = cur_pag + npages -1
#if( cur_pag < 10 ) outfile = "00" cur_pag ".pdf"
#else if(cur_pag < 100) outfile = "0" cur_pag ".pdf"
#else outfile = "" cur_pag ".pdf"
#pdftk_comm = "pdftk " proceedingspdf " cat " pagi "-" pagf " output CONF_Online/files/" outfile
#print pdftk_comm
#system(pdftk_comm);
#print "<span class=\"title\">TITLE</span>"
#print "<span class=\"author\">KEYNOTE</span>"
#print "<span class=\"pages\">pages " (pagi-pagesfront) "-" (pagf-pagesfront) "</span> <span class=\"pdflink\">Full text: <a href=\"files/" outfile "\">pdf</a></span>"
cur_pag=cur_pag+npages
}
/./ {
if(NR>1) {
subid = $1
title = $3
authors = $2
npages = $8
offsetx = $9
offsety = $10
pagi = cur_pag
pagf = cur_pag + npages -1
if( cur_pag < 10 ) outfile = "00" cur_pag ".pdf"
else if(cur_pag < 100) outfile = "0" cur_pag ".pdf"
else outfile = "" cur_pag ".pdf"
if(subid < 10) filename = "0" subid "/paper0" subid ".pdf"
else filename = subid "/paper" subid ".pdf"
pdftk_comm = "pdftk " proceedingspdf " cat " pagi "-" pagf " output CONF_Online/files/" outfile
#pdftk_comm = "pdftk " filename " cat 1 output CONF_Online/" outfile
#print pdftk_comm
system(pdftk_comm);
print "<span class=\"title\">" title "</span>"
print "<span class=\"author\">" authors "</span>"
print "<span class=\"pages\">pages " (pagi-pagesfront) "-" (pagf-pagesfront) "</span> <span class=\"pdflink\">Full text: <a href=\"files/" outfile "\">pdf</a></span>"
cur_pag = cur_pag + npages
}
}
END {
print "<a id=\"backmatter\"></a>"
print "<div class=\"chapternumber\">Back Matter</div>"
#author index
npages = 1
pagi = cur_pag
pagf = cur_pag + npages -1
if( cur_pag < 10 ) outfile = "00" cur_pag ".pdf"
else if(cur_pag < 100) outfile = "0" cur_pag ".pdf"
else outfile = "" cur_pag ".pdf"
pdftk_comm = "pdftk " proceedingspdf " cat " pagi "-" pagf " output CONF_Online/files/" outfile
#print pdftk_comm
system(pdftk_comm);
print "<span class=\"title\">Author Index</span>"
print "<span class=\"pages\">pages " (pagi-pagesfront) "-" (pagf-pagesfront) "</span> <span class=\"pdflink\">Full text: <a href=\"files/" outfile "\">pdf</a></span>"
cur_pag=cur_pag+npages
system(". ./config.txt; sed s/\\${conferencename}/\"${conferencename}\"/ usb_footer.html | sed s/\\${acronym}/\"${acronym}\"/ | sed s/\\${city}/\"${city}\"/ | sed s/\\${monthday}/\"${monthday}\"/ | sed s/\\${country}/\"${country}\"/ | sed s/\\${isbn}/\"${isbn}\"/ | sed s/\\${catalognumber}/\"${catalognumber}\"/ | sed s/\\${year}/\"${year}\"/");
}