We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c194220 commit 032a4a5Copy full SHA for 032a4a5
build_index.py
@@ -0,0 +1,30 @@
1
+#!/usr/bin/env python
2
+
3
+import glob
4
+import os
5
+import sys
6
7
+sys.path.insert(0, 'publisher')
8
9
+import options
10
11
+output_dir = 'output'
12
+dirs = [d for d in glob.glob('%s/*' % output_dir) if os.path.isdir(d)]
13
14
+pages = []
15
+cum_pages = [1]
16
17
+for d in sorted(dirs):
18
+ try:
19
+ stats = options.cfg2dict(os.path.join(d, 'paper_stats.cfg'))
20
+ pages.append(int(stats['pages']))
21
+ cum_pages.append(cum_pages[-1] + pages[-1])
22
23
+ print '"%s" from p. %s to %s' % (os.path.basename(d), cum_pages[-2],
24
+ cum_pages[-1] - 1)
25
26
+ f = open(os.path.join(d, 'page_numbers.tex'), 'w')
27
+ f.write('\setcounter{page}{%s}' % cum_pages[-2])
28
+ f.close()
29
+ except IOError, e:
30
+ continue
0 commit comments