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

david.goodger python-checkins at python.org
Fri Mar 24 04:14:55 CET 2006


Author: david.goodger
Date: Fri Mar 24 04:14:52 2006
New Revision: 43267

Modified:
   peps/trunk/pep2pyramid.py
Log:
changes from Martin Thomas: Added PEPANCHOR expression, removed trailing .html; shuffled around PEPURL etc.; removed http://www.python.org/ from URL (for mirrors)

Modified: peps/trunk/pep2pyramid.py
==============================================================================
--- peps/trunk/pep2pyramid.py	(original)
+++ peps/trunk/pep2pyramid.py	Fri Mar 24 04:14:52 2006
@@ -37,9 +37,10 @@
             'docutils': '0.5'}
 PROGRAM = sys.argv[0]
 RFCURL = 'http://www.faqs.org/rfcs/rfc%d.html'
-PEPURL = '/dev/peps/pep-%04d'
 PEPCVSURL = 'http://svn.python.org/view/*checkout*/peps/trunk/pep-%04d.txt'
-PEPDIRURL = 'http://www.python.org/dev/peps/'
+PEPDIRURL = '/dev/peps/'
+PEPURL = PEPDIRURL + 'pep-%04d'
+PEPANCHOR = '<a href="' + PEPURL + '">%i</a>'
 
 
 LOCALVARS = "Local Variables:"
@@ -118,6 +119,8 @@
                 ltext.append(c)
                 break
         link = EMPTYSTRING.join(ltext)
+    elif text.endswith('.txt') and text <> current:
+        link = PEPDIRURL + os.path.splitext(text)[0] + '/' + text 
     elif text.startswith('pep-') and text <> current:
         link = os.path.splitext(text)[0] + ".html"
     elif text.startswith('PEP'):
@@ -208,8 +211,7 @@
             otherpeps = ''
             for otherpep in re.split(',?\s+', v):
                 otherpep = int(otherpep)
-                otherpeps += '<a href="pep-%04d.html">%i</a> ' % (otherpep,
-                                                                  otherpep)
+                otherpeps += PEPANCHOR % (otherpep, otherpep)
             v = otherpeps
         elif k.lower() in ('last-modified',):
             date = v or time.strftime('%Y-%m-%d',


More information about the Python-checkins mailing list