If form-feeds are not going to be used to indicate what can be marked as
a header, use a non-white character in the first column. This looks a little cleaner.
This commit is contained in:
parent
6dada5abfb
commit
f30b9ed129
29
pep2html.py
29
pep2html.py
|
@ -59,40 +59,35 @@ def fixfile(infile, outfile):
|
||||||
if pep:
|
if pep:
|
||||||
title = "PEP " + pep + " -- " + title
|
title = "PEP " + pep + " -- " + title
|
||||||
if title:
|
if title:
|
||||||
fo.write("<title>%s</title>\n" % cgi.escape(title))
|
fo.write(" <title>%s</title>\n" % cgi.escape(title))
|
||||||
fo.write("</head>\n")
|
fo.write("</head>\n")
|
||||||
# body
|
# body
|
||||||
fo.write("<body bgcolor='white'>\n")
|
fo.write('<body bgcolor="white">\n')
|
||||||
fo.write("[<a href='../'>home</a>]\n")
|
fo.write('[<a href="../">home</a>]\n')
|
||||||
if os.path.basename(infile) != "pep-0000.txt":
|
if os.path.basename(infile) != "pep-0000.txt":
|
||||||
fo.write("[<a href='.'>index</a>]\n")
|
fo.write('[<a href=".">index</a>]\n')
|
||||||
fo.write("<hr />\n<table border='0'>\n")
|
fo.write('<hr />\n<table border="0">\n')
|
||||||
for k, v in header:
|
for k, v in header:
|
||||||
fo.write(" <tr><th align='right'>%s:</th><td>%s</td></tr>\n"
|
fo.write(" <tr><th align='right'>%s:</th><td>%s</td></tr>\n"
|
||||||
% (cgi.escape(k), cgi.escape(v)))
|
% (cgi.escape(k), cgi.escape(v)))
|
||||||
title = 0
|
title = 0
|
||||||
fo.write("</table>\n<pre>")
|
fo.write("</table>\n<hr />\n<pre>")
|
||||||
while 1:
|
while 1:
|
||||||
line = fi.readline()
|
line = fi.readline()
|
||||||
if not line:
|
if not line:
|
||||||
break
|
break
|
||||||
if line[:1] == "\f":
|
if line[0] != "\f":
|
||||||
fo.write("<hr />")
|
if line[0].strip():
|
||||||
# fo.write("\n</pre><hr /><pre>\n")
|
|
||||||
title = 1
|
|
||||||
else:
|
|
||||||
line = fixpat.sub(lambda x, c=infile: fixanchor(c, x), line)
|
|
||||||
if title:
|
|
||||||
if line.strip() == "Local Variables:":
|
if line.strip() == "Local Variables:":
|
||||||
break
|
break
|
||||||
fo.write("</pre>\n<h3>%s</h3>\n<pre>" % line.strip())
|
fo.write("</pre>\n<h3>%s</h3>\n<pre>" % line.strip())
|
||||||
# fo.write("</pre><h3><tt>%s</tt></h3><pre>\n" % line)
|
|
||||||
title = 0
|
title = 0
|
||||||
else:
|
else:
|
||||||
|
line = fixpat.sub(lambda x, c=infile: fixanchor(c, x), line)
|
||||||
fo.write(line)
|
fo.write(line)
|
||||||
fo.write("</pre>\n")
|
fo.write("</pre>\n"
|
||||||
fo.write("</body>\n")
|
"</body>\n"
|
||||||
fo.write("</html>\n")
|
"</html>\n")
|
||||||
fo.close()
|
fo.close()
|
||||||
os.chmod(outfile, 0664)
|
os.chmod(outfile, 0664)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue