42 |
|
|
43 |
print 'Process PEG %s' % (pegdir) |
print 'Process PEG %s' % (pegdir) |
44 |
for rstfile in rstfiles: |
for rstfile in rstfiles: |
45 |
file = pegroot+'/'+pegdir+'/'+rstfile.rstrip('.rst') |
file = pegroot+'/'+pegdir+'/'+rstfile[0:len(rstfile)-4]#.rstrip('.rst') |
46 |
|
|
47 |
# Sets docutils' "command line arguments" |
# Sets docutils' "command line arguments" |
48 |
args = '-stg --stylesheet ../'+css+' %s.rst %s.html' % (file,file) |
args = '-stg --stylesheet ../'+css+' %s.rst %s.html' % (file,file) |
49 |
|
|
50 |
# Generate the HTML |
# Generate the HTML |
51 |
try: |
try: |
52 |
docutils.core.publish(writer_name='html', argv=args.split()) |
docutils.core.publish_cmdline(writer_name='html', argv=args.split()) |
53 |
except: |
except: |
54 |
fails += 'PEG %s: Docutil raised an exception while converting %s. ' % (pegdir, f) |
fails += 'PEG %s: Docutil raised an exception while converting %s. ' % (pegdir, f) |
55 |
fails += 'Conversion failed and HTML not created.\n' |
fails += 'Conversion failed and HTML not created.\n' |
57 |
#loop two: creating index |
#loop two: creating index |
58 |
print 'Generating pegboard2.html...\n' |
print 'Generating pegboard2.html...\n' |
59 |
args = '-stg --stylesheet '+css+' '+pegroot+'/pegboard.rst '+pegroot+'/pegboard2.html' |
args = '-stg --stylesheet '+css+' '+pegroot+'/pegboard.rst '+pegroot+'/pegboard2.html' |
60 |
docutils.core.publish(writer_name='html', argv=args.split()) |
docutils.core.publish_cmdline(writer_name='html', argv=args.split()) |
61 |
|
|
62 |
pegboard = open (pegroot+'/pegboard2.html', 'r') |
pegboard = open (pegroot+'/pegboard2.html', 'r') |
63 |
pegboard_lines = pegboard.readlines() |
pegboard_lines = pegboard.readlines() |
98 |
if peg['topic'] == '': |
if peg['topic'] == '': |
99 |
peg['topic'] = peg['dir'] |
peg['topic'] = peg['dir'] |
100 |
if peg['pegfile'] == '': |
if peg['pegfile'] == '': |
101 |
peg['pegfile'] = peg['files'][0] |
if peg['files']: |
102 |
|
peg['pegfile'] = peg['files'][0] |
103 |
pegtable.append(peg) |
pegtable.append(peg) |
104 |
|
|
105 |
pegtable.sort(pegcmp) |
pegtable.sort(pegcmp) |