[Python-checkins] CVS: python/nondist/peps pep2html.py,1.11,1.12

Barry Warsaw python-dev@python.org
Wed, 16 Aug 2000 21:27:06 -0700


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

Modified Files:
	pep2html.py 
Log Message:
Linkify the Author: fields with mailto urls.


Index: pep2html.py
===================================================================
RCS file: /cvsroot/python/python/nondist/peps/pep2html.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -r1.11 -r1.12
*** pep2html.py	2000/08/15 10:35:17	1.11
--- pep2html.py	2000/08/17 04:27:04	1.12
***************
*** 109,114 ****
               '<div class="header">\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</div>\n<hr />\n"
--- 109,126 ----
               '<div class="header">\n<table border="0">\n')
      for k, v in header:
+         if k.lower() == 'author':
+             mailtos = []
+             for addr in v.split():
+                 if '@' in addr:
+                     mailtos.append(
+                         '<a href="mailto:%s?subject=PEP%%20%s">%s</a>' %
+                         (addr, pep, addr))
+                 else:
+                     mailtos.append(addr)
+             v = ' '.join(mailtos)
+         else:
+             v = cgi.escape(v)
          fo.write("  <tr><th align='right'>%s:</th><td>%s</td></tr>\n"
!                  % (cgi.escape(k), v))
      title = 0
      fo.write("</table>\n</div>\n<hr />\n"