Richard Jones' Log: PyCon procrastination

Thu, 17 Mar 2005

I'm supposed to be finishing off my presentation and the accompanying "paper" for publication. Instead I've been fiddling with printing out the schedule for the conference ;)

The following marks the "printable" version of the Wiki table with some highlighting to make it a little easier to read:

import re
r = []
n = 0
spesh = re.compile('\s(break|lunch|Social Event|Member Meeting|TBA)\s', re.I)
for line in open('/tmp/Schedule.html').readlines():
 if line.startswith('<tr>'):
  if n%4 > 1: r.append('<tr class="odd">\n')
  else: r.append('<tr class="even">%s\n')
  n += 1
 else: r.append(line)
 if spesh.search(line): n += 1
open('/tmp/mod-schedule.html', 'w').writelines(r)

With the above wiki page saved as "/tmp/Schedule.html" with the following style info inserted near the top:

<style>
    td {vertical-align: top; }
    td > p { margin: 1px 2px 1px 2px; }
    tr.even td { background: #ddf; }
    tr.odd td { background: #eee; }
    td {border: none; }
    @media print {
        h1 { display: none }
        div > p {display: none}
    }
</style>

It generates "/tmp/mod-schedule.html" which I think is much clearer ;)