diff options
author | Richard Darst <rkd@zgib.net> | 2009-09-02 15:41:37 (GMT) |
---|---|---|
committer | Richard Darst <rkd@zgib.net> | 2009-09-02 15:41:37 (GMT) |
commit | 6b89d81b99457dfe87bc830184ece5214be7c3ad (patch) | |
tree | 47490fc5fde48cd39a0919e026471f6fb6c5cf6e /writers.py | |
parent | 27ce4735fbcf66a7db9735019f64634f122c3cb9 (diff) |
Make HTML2 formater use CSS formatting from Francis Giannaros
- Francis provided a sample minutes file with nice CSS. This is the
first merging into MeetBot main. It will still need work before it
is releasable.
- Not all of this will necessarily make it in to MeetBot mainline, but
at least the ability to configure it will.
- CSS will be user-customizable easily.
darcs-hash:20090902154137-82ea9-2c9dcd91ee80cf77f0a4972ec55eda47a400f3d6.gz
Diffstat (limited to 'writers.py')
-rw-r--r-- | writers.py | 81 |
1 files changed, 76 insertions, 5 deletions
@@ -457,11 +457,13 @@ class HTML2(_BaseWriter): ActionItems = [ ] ActionItems.append(self.heading('Action items')) ActionItems.append('<ol>') + numActionItems = 0 for m in M.minutes: # The hack below is needed because of pickling problems if m.itemtype != "ACTION": continue ActionItems.append(" <li>%s</li>"%html(m.line)) - if len(ActionItems) == 0: + numActionItems += 1 + if numActionItems == 0: ActionItems.append(" <li>(none)</li>") ActionItems.append('</ol>') ActionItems = "\n".join(ActionItems) @@ -475,9 +477,9 @@ class HTML2(_BaseWriter): ActionItemsPerson.append('<ol>') numberAssigned = 0 for nick, items in self.iterActionItemsNick(): - numberAssigned += 1 headerPrinted = False for m in items: + numberAssigned += 1 if not headerPrinted: ActionItemsPerson.append(" <li> %s <ol>"%html(nick)) headerPrinted = True @@ -519,6 +521,70 @@ class HTML2(_BaseWriter): return PeoplePresent def heading(self, name): return '<h3>%s</h3>'%name + def css(self): + cssfile = getattr(self.M.config, 'cssfile', '') + css_head = textwrap.dedent('''\ + <style type="text/css"> + %s + </style> + ''') + if cssfile == 'None': + # special string 'None' means no style at all + return '' + elif cssfile in ('', 'default'): + # default stylesheet + css = self.css_template + return css_head%css + else: + # external stylesheet + if getattr(self.M.config, 'embedStylesheet', True): + css = file(self.M.config.cssfile).read() + return css_head%css + else: + # linked stylesheet + css_head = ('''<link rel="stylesheet" type="text/css" ''' + '''href="%s">'''%cssfile) + return css_head + + css_template = textwrap.dedent("""\ + body { + font-family: Helvetica, sans-serif; + font-size:14px; + } + h1 { + text-align: center; + } + a { + color:navy; + text-decoration: none; + border-bottom:1px dotted navy; + } + a:hover { + text-decoration:none; + border-bottom: 0; + color:#0000B9; + } + hr { + border: 1px solid #ccc; + } + /* The (nick, time) item pairs, and other body text things. */ + .details { + font-size: 12px; + font-weight:bold; + } + /* The 'AGREED:', 'IDEA', etc, prefix to lines. */ + .itemtype { + font-style: normal; /* un-italics it */ + font-weight: bold; + } + /* Example: change single item types. Capitalized command name. + /*.TOPIC { + color:navy; + }*/ + /*.AGREED { + color:lime; + }*/ + """) def format(self, extension=None): """Write the minutes summary.""" @@ -529,24 +595,29 @@ class HTML2(_BaseWriter): body = [ ] body.append(textwrap.dedent("""\ <h1>%(pageTitle)s</h1> + <span class="details"> Meeting started by %(owner)s at %(starttime)s %(timeZone)s - (<a href="%(fullLogs)s">full logs</a>). + (<a href="%(fullLogs)s">full logs</a>).</span> """%repl)) body.append(self.meetingItems()) body.append(textwrap.dedent("""\ + <span class="details"> Meeting ended at %(endtime)s %(timeZone)s - (<a href="%(fullLogs)s">full logs</a>). + (<a href="%(fullLogs)s">full logs</a>).</span> """%repl)) body.append(self.actionItems()) body.append(self.actionItemsPerson()) body.append(self.peoplePresent()) + body.append("""<span class="details">""" + """Generated by <a href="%(MeetBotInfoURL)s">MeetBot</a>""" + """%(MeetBotVersion)s.</span>"""%repl) body = [ b for b in body if b is not None ] body = "\n<br><br>\n\n\n\n".join(body) body = replaceWRAP(body) repl.update({'body': body, - 'headExtra': '', + 'headExtra': self.css(), }) html = html_template % repl |