[Python-checkins] r42353 - sandbox/trunk/pycon/parse_sched.py

andrew.kuchling python-checkins at python.org
Tue Feb 14 03:09:22 CET 2006


Author: andrew.kuchling
Date: Tue Feb 14 03:09:21 2006
New Revision: 42353

Modified:
   sandbox/trunk/pycon/parse_sched.py
Log:
Factor out the logic for turning talk numbers into links, and change
it to support a talk number surrounded by other text.  Scan the titles of 
plenary sessions for talk numbers, too.


Modified: sandbox/trunk/pycon/parse_sched.py
==============================================================================
--- sandbox/trunk/pycon/parse_sched.py	(original)
+++ sandbox/trunk/pycon/parse_sched.py	Tue Feb 14 03:09:21 2006
@@ -99,6 +99,24 @@
     return span+1
 
 
+def expand_title(title):
+    # Turn talk numbers into a link with a title
+    m = talk_pat.search(title)
+    if m is not None:
+        talk_num = int(m.group(1))
+        talk_title = talks.get_title(talk_num)
+        url = ('http://wiki.python.org/moin/PyCon2006/Talks#%s'
+               % talk_num)
+        prefix = title[:m.start()] 
+        suffix = title[m.end():]
+        title = '%s (<a href="%s">%s</a>)' % (cgi.escape(talk_title),
+                                              url, talk_num)
+        title = prefix + title + suffix
+    else:
+        title = cgi.escape(title)
+
+    return title
+
 def format_day (day, output):
     # Figure out unique rooms
     rooms = []
@@ -148,6 +166,7 @@
         if plenary:
             # Plenary session of some sort
             duration, title = room_dict.values()[0]
+            title = expand_title(title)
             colspan = len(rooms)
             print >>output,  '<td align="center" colspan=%i>%s</td>' % (colspan, title),
             print >>output,  '</tr>'
@@ -167,18 +186,7 @@
                 end_time = add_time(time, duration)
                 active[room] = end_time
                 rowspan = find_next_time(time_list, end_time)
-
-                # Turn talk numbers into a link with a title
-                m = talk_pat.match(title)
-                if m is not None:
-                    talk_num = int(m.group(1))
-                    title = talks.get_title(talk_num)
-                    url = ('http://wiki.python.org/moin/PyCon2006/Talks#%s'
-                           % talk_num)
-                    title = '%s (<a href="%s">%s</a>)' % (cgi.escape(title),
-                                                          url, talk_num)
-                else:
-                    title = cgi.escape(title)
+                title = expand_title(title)
 
                 print >>output,  '<td rowspan="%i">' % rowspan,
                 print >>output,  title,


More information about the Python-checkins mailing list