[Python-checkins] r42786 - peps/trunk/pep2pyramid.py

sean.reifschneider python-checkins at python.org
Thu Mar 2 18:57:45 CET 2006


Author: sean.reifschneider
Date: Thu Mar  2 18:57:41 2006
New Revision: 42786

Modified:
   peps/trunk/pep2pyramid.py
Log:
New version of pep2pyramid, removes HTML headers from text files.



Modified: peps/trunk/pep2pyramid.py
==============================================================================
--- peps/trunk/pep2pyramid.py	(original)
+++ peps/trunk/pep2pyramid.py	Thu Mar  2 18:57:41 2006
@@ -182,73 +182,6 @@
     if title:
         print >> outfile, '  <title>%s</title>' % cgi.escape(title)
     r = random.choice(range(64))
-    print >> outfile, (
-        '  <link rel="STYLESHEET" href="style.css" type="text/css" />\n'
-        '</head>\n'
-        '<body bgcolor="white">\n'
-        '<table class="navigation" cellpadding="0" cellspacing="0"\n'
-        '       width="100%%" border="0">\n'
-        '<tr><td class="navicon" width="150" height="35">\n'
-        '<a href="../" title="Python Home Page">\n'
-        '<img src="../pics/PyBanner%03d.gif" alt="[Python]"\n'
-        ' border="0" width="150" height="35" /></a></td>\n'
-        '<td class="textlinks" align="left">\n'
-        '[<b><a href="../">Python Home</a></b>]' % r)
-    if basename <> 'pep-0000.txt':
-        print >> outfile, '[<b><a href=".">PEP Index</a></b>]'
-    if pep:
-        try:
-            print >> outfile, ('[<b><a href="pep-%04d.txt">PEP Source</a>'
-                               '</b>]' % int(pep))
-        except ValueError, error:
-            print >> sys.stderr, ('ValueError (invalid PEP number): %s'
-                                  % error)
-    print >> outfile, '</td></tr></table>'
-    print >> outfile, '<div class="header">\n<table border="0">'
-    for k, v in header:
-        if k.lower() in ('author', 'discussions-to'):
-            mailtos = []
-            for part in re.split(',\s*', v):
-                if '@' in part:
-                    realname, addr = parseaddr(part)
-                    if k.lower() == 'discussions-to':
-                        m = linkemail(addr, pep)
-                    else:
-                        m = fixemail(addr, pep)
-                    mailtos.append('%s &lt;%s&gt;' % (realname, m))
-                elif part.startswith('http:'):
-                    mailtos.append(
-                        '<a href="%s">%s</a>' % (part, part))
-                else:
-                    mailtos.append(part)
-            v = COMMASPACE.join(mailtos)
-        elif k.lower() in ('replaces', 'replaced-by', 'requires'):
-            otherpeps = ''
-            for otherpep in re.split(',?\s+', v):
-                otherpep = int(otherpep)
-                otherpeps += '<a href="/doc/peps/pep-%04d/">%i</a> ' % (
-                             otherpep, otherpep)
-            v = otherpeps
-        elif k.lower() in ('last-modified',):
-            date = v or time.strftime('%d-%b-%Y',
-                                      time.localtime(os.stat(inpath)[8]))
-            try:
-                url = PEPCVSURL % int(pep)
-                v = '<a href="%s">%s</a> ' % (url, cgi.escape(date))
-            except ValueError, error:
-                v = date
-        elif k.lower() in ('content-type',):
-            url = PEPURL % 9
-            pep_type = v or 'text/plain'
-            v = '<a href="%s">%s</a> ' % (url, cgi.escape(pep_type))
-        else:
-            v = cgi.escape(v)
-        print >> outfile, '  <tr><th>%s:&nbsp;</th><td>%s</td></tr>' \
-              % (cgi.escape(k), v)
-    print >> outfile, '</table>'
-    print >> outfile, '</div>'
-    print >> outfile, '<hr />'
-    print >> outfile, '<div class="content">'
     need_pre = 1
     for line in infile:
         if line[0] == '\f':


More information about the Python-checkins mailing list