diff --git a/pep2pyramid.py b/pep2pyramid.py index c56b0a34a..56e38c5ff 100755 --- a/pep2pyramid.py +++ b/pep2pyramid.py @@ -177,6 +177,48 @@ def fixfile(inpath, input_lines, outfile): if title: print >> outfile, ' %s' % cgi.escape(title) r = random.choice(range(64)) + print >> outfile, '
\n' + 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 <%s>' % (realname, m)) + elif part.startswith('http:'): + mailtos.append( + '%s' % (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 += '%i ' % (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 = '%s ' % (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 = '%s ' % (url, cgi.escape(pep_type)) + else: + v = cgi.escape(v) + print >> outfile, ' ' \ + % (cgi.escape(k), v) + print >> outfile, '
%s: %s
' need_pre = 1 for line in infile: if line[0] == '\f':