[Python-checkins] r50752 - sandbox/trunk/seealso/convert-python-faqs.py

andrew.kuchling python-checkins at python.org
Fri Jul 21 15:49:57 CEST 2006


Author: andrew.kuchling
Date: Fri Jul 21 15:49:56 2006
New Revision: 50752

Modified:
   sandbox/trunk/seealso/convert-python-faqs.py
Log:
Write master index of categories

Modified: sandbox/trunk/seealso/convert-python-faqs.py
==============================================================================
--- sandbox/trunk/seealso/convert-python-faqs.py	(original)
+++ sandbox/trunk/seealso/convert-python-faqs.py	Fri Jul 21 15:49:56 2006
@@ -13,6 +13,9 @@
 
 DESTDIR = 'pyramid-faq'
 
+# Master collection of categories
+categories = {}
+
 def yaml_escape (S):
     "Escape S as a YAML string"
     S = normalize_whitespace(S)
@@ -55,7 +58,9 @@
         return
     if category in ('test',):
         return
-    
+    if category not in categories:
+	categories[category] = None    
+
     name = get_setting(root, 'name', base)
 
     qdir = os.path.join(DESTDIR, category, name)
@@ -63,7 +68,7 @@
 
     # Write body of question
     f = open(os.path.join(qdir, 'question.ht'), 'w')
-    f.write('Title: XXX\n')
+    f.write('Title: Unused title\n')
     f.write('\n')
     body = root.find('body')
     for child in body.getchildren():
@@ -166,9 +171,12 @@
     f.close()
 
     f = open(os.path.join(DESTDIR, 'listing.ht'), 'w')
-    f.write('Title: XXX\n')
+    f.write('Title: Unused title\n')
     f.write('\n')
-    f.write('<p>XXX put content here later</p>\n')
+    f.write('<ul>\n')
+    for cat in sorted(categories.keys()):
+        f.write('  <li><a href="%s">%s</a>' % (cat, cat.capitalize()))
+    f.write('</ul>\n')
     f.close()
 
     f = open(os.path.join(DESTDIR, 'nav.yml'), 'w')


More information about the Python-checkins mailing list