[Python-checkins] CVS: python/nondist/peps pep2html.py,1.4,1.5

Fred L. Drake python-dev@python.org
Tue, 25 Jul 2000 21:14:32 -0700


Update of /cvsroot/python/python/nondist/peps
In directory slayer.i.sourceforge.net:/tmp/cvs-serv28069

Modified Files:
	pep2html.py 
Log Message:

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.


Index: pep2html.py
===================================================================
RCS file: /cvsroot/python/python/nondist/peps/pep2html.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -r1.4 -r1.5
*** pep2html.py	2000/07/25 04:12:28	1.4
--- pep2html.py	2000/07/26 04:14:30	1.5
***************
*** 60,97 ****
          title = "PEP " + pep + " -- " + title
      if title:
!         fo.write("<title>%s</title>\n" % cgi.escape(title))
      fo.write("</head>\n")
      # body
!     fo.write("<body bgcolor='white'>\n")
!     fo.write("[<a href='../'>home</a>]\n")
      if os.path.basename(infile) != "pep-0000.txt":
!         fo.write("[<a href='.'>index</a>]\n")
!     fo.write("<hr />\n<table border='0'>\n")
      for k, v in header:
          fo.write("  <tr><th align='right'>%s:</th><td>%s</td></tr>\n"
                   % (cgi.escape(k), cgi.escape(v)))
      title = 0
!     fo.write("</table>\n<pre>")
      while 1:
          line = fi.readline()
          if not line:
              break
!         if line[:1] == "\f":
!             fo.write("<hr />")
!             # 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:":
                      break
                  fo.write("</pre>\n<h3>%s</h3>\n<pre>" % line.strip())
-                 # fo.write("</pre><h3><tt>%s</tt></h3><pre>\n" % line)
                  title = 0
              else:
                  fo.write(line)
!     fo.write("</pre>\n")
!     fo.write("</body>\n")
!     fo.write("</html>\n")
      fo.close()
      os.chmod(outfile, 0664)
--- 60,92 ----
          title = "PEP " + pep + " -- " + title
      if title:
!         fo.write("  <title>%s</title>\n" % cgi.escape(title))
      fo.write("</head>\n")
      # body
!     fo.write('<body bgcolor="white">\n')
!     fo.write('[<a href="../">home</a>]\n')
      if os.path.basename(infile) != "pep-0000.txt":
!         fo.write('[<a href=".">index</a>]\n')
!     fo.write('<hr />\n<table border="0">\n')
      for k, v in header:
          fo.write("  <tr><th align='right'>%s:</th><td>%s</td></tr>\n"
                   % (cgi.escape(k), cgi.escape(v)))
      title = 0
!     fo.write("</table>\n<hr />\n<pre>")
      while 1:
          line = fi.readline()
          if not line:
              break
!         if line[0] != "\f":
!             if line[0].strip():
                  if line.strip() == "Local Variables:":
                      break
                  fo.write("</pre>\n<h3>%s</h3>\n<pre>" % line.strip())
                  title = 0
              else:
+                 line = fixpat.sub(lambda x, c=infile: fixanchor(c, x), line)
                  fo.write(line)
!     fo.write("</pre>\n"
!              "</body>\n"
!              "</html>\n")
      fo.close()
      os.chmod(outfile, 0664)