Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/writers.py
diff options
context:
space:
mode:
authorRichard Darst <rkd@zgib.net>2009-07-30 19:19:19 (GMT)
committer Richard Darst <rkd@zgib.net>2009-07-30 19:19:19 (GMT)
commit3873ed163f5bb2709e002b127437f77105784cd5 (patch)
tree464932da8c7c6789b49cb8b0e1568b3842d7f5c3 /writers.py
parentae57372fe7e8e922532934b848de123e6026ffe4 (diff)
add Text and HTML2 writers
- These combine the best features of the ReST and HTMLfromReST, without the disadvantages of having to make one source fit two formats. darcs-hash:20090730191919-82ea9-f7f88a57e8b59720f59c26bfe1961f93cda818bc.gz
Diffstat (limited to 'writers.py')
-rw-r--r--writers.py263
1 files changed, 262 insertions, 1 deletions
diff --git a/writers.py b/writers.py
index 1867936..c8eef43 100644
--- a/writers.py
+++ b/writers.py
@@ -217,7 +217,139 @@ class HTML(_BaseWriter):
for m in M.minutes:
# The hack below is needed because of pickling problems
if m.itemtype != "ACTION": continue
- ActionItems.append(" <li>%s</li>"%m.line) #already escaped
+ ActionItems.append(" <li>%s</li>"%html(m.line))
+ if len(ActionItems) == 0:
+ ActionItems.append(" <li>(none)</li>")
+ ActionItems = "\n".join(ActionItems)
+
+ # Action Items, by person (This could be made lots more efficient)
+ ActionItemsPerson = [ ]
+ for nick, items in self.iterActionItemsNick():
+ headerPrinted = False
+ for m in items:
+ if not headerPrinted:
+ ActionItemsPerson.append(" <li> %s <ol>"%html(nick))
+ headerPrinted = True
+ ActionItemsPerson.append(" <li>%s</li>"%html(m.line))
+ if headerPrinted:
+ ActionItemsPerson.append(" </ol></li>")
+ # unassigned items:
+ ActionItemsPerson.append(" <li><b>UNASSIGNED</b><ol>")
+ numberUnassigned = 0
+ for m in self.iterActionItemsUnassigned():
+ ActionItemsPerson.append(" <li>%s</li>"%html(m.line))
+ numberUnassigned += 1
+ if numberUnassigned == 0:
+ ActionItemsPerson.append(" <li>(none)</li>")
+ ActionItemsPerson.append(' </ol>\n</li>')
+ ActionItemsPerson = "\n".join(ActionItemsPerson)
+
+ # People Attending
+ PeoplePresent = [ ]
+ # sort by number of lines spoken
+ for nick, count in self.iterNickCounts():
+ PeoplePresent.append(' <li>%s (%s)</li>'%(html(nick), count))
+ PeoplePresent = "\n".join(PeoplePresent)
+
+ # Actual formatting and replacement
+ repl = self.replacements()
+ repl.update({'MeetingItems':MeetingItems,
+ 'ActionItems': ActionItems,
+ 'ActionItemsPerson': ActionItemsPerson,
+ 'PeoplePresent':PeoplePresent,
+ })
+ body = self.body
+ body = body%repl
+ body = replaceWRAP(body)
+ return body
+class HTML2(_BaseWriter):
+
+ body = textwrap.dedent('''\
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+ <html>
+ <head>
+ <meta http-equiv="Content-type" content="text/html;charset=UTF-8">
+ <title>%(pageTitle)s</title>
+ </head>
+ <body>
+ <h1>%(pageTitle)s</h1>
+ Meeting started by %(owner)s at %(starttime)s %(timeZone)s.
+ (<a href="%(fullLogs)s">full logs</a>)<br>
+
+ %(MeetingItems)s
+ Meeting ended at %(endtime)s %(timeZone)s.
+ (<a href="%(fullLogs)s">full logs</a>)
+
+ <br><br><br>
+
+ <b>Action Items</b><ol>
+ %(ActionItems)s
+ </ol>
+ <br>
+
+ <b>Action Items, by person</b>
+ <ol>
+ %(ActionItemsPerson)s
+ </ol><br>
+
+ <b>People Present (lines said):</b><ol>
+ %(PeoplePresent)s
+ </ol>
+
+ <br>
+ Generated by <a href="%(MeetBotInfoURL)s">MeetBot</a>.
+ </body></html>
+ ''')
+
+ def format(self, extension=None):
+ """Write the minutes summary."""
+ M = self.M
+
+ # Add all minute items to the table
+ MeetingItems = [ ]
+ MeetingItems.append("<ol>")
+
+
+
+ haveTopic = None
+ inSublist = False
+ for m in M.minutes:
+ item = '<li>'+m.html2(M)
+ if m.itemtype == "TOPIC":
+ if inSublist:
+ MeetingItems.append("</ol>")
+ inSublist = False
+ if haveTopic:
+ MeetingItems.append("</li>")
+ item = item
+ haveTopic = True
+ else:
+ if not inSublist:
+ MeetingItems.append('<ol type="a">')
+ inSublist = True
+ if haveTopic: item = wrapList(item, 2)+"</li>"
+ else: item = wrapList(item, 0)+"</li>"
+ MeetingItems.append(item)
+ #MeetingItems.append("</li>")
+
+ if inSublist:
+ MeetingItems.append("</ol>")
+ if haveTopic:
+ MeetingItems.append("</li>")
+
+
+
+ MeetingItems.append("</ol>")
+ MeetingItems = "\n".join(MeetingItems)
+
+ # Action Items
+ ActionItems = [ ]
+ 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:
+ ActionItems.append(" <li>(none)</li>")
ActionItems = "\n".join(ActionItems)
# Action Items, by person (This could be made lots more efficient)
@@ -399,3 +531,132 @@ class HTMLfromReST(_BaseWriter):
'raw_enabled': 0,
'output_encoding':self.M.config.output_codec})
return rstToHTML
+
+
+
+class Text(_BaseWriter):
+
+ body = textwrap.dedent("""\
+ %(titleBlock)s
+ %(pageTitle)s
+ %(titleBlock)s
+
+
+ WRAPMeeting started by %(owner)s at %(starttime)s %(timeZone)s.
+ The `full logs`_ are available.WRAP
+
+ .. _`full logs`: %(fullLogs)s
+
+
+
+ Meeting log
+ -----------
+ %(MeetingItems)s
+
+ Meeting ended at %(endtime)s %(timeZone)s.
+
+
+
+
+ Action Items
+ ------------
+ %(ActionItems)s
+
+
+
+
+ Action Items, by person
+ -----------------------
+ %(ActionItemsPerson)s
+
+
+
+
+ People Present (lines said)
+ ---------------------------
+ %(PeoplePresent)s
+
+
+
+
+ Generated by `MeetBot`_
+
+ .. _`MeetBot`: %(MeetBotInfoURL)s
+ """)
+
+ def format(self, extension=None):
+ """Return a ReStructured Text minutes summary."""
+ M = self.M
+
+ # Agenda items
+ MeetingItems = [ ]
+ #M.rst_urls = [ ]
+ #M.rst_refs = { }
+ haveTopic = None
+ for m in M.minutes:
+ item = "* "+m.text(M)
+ if m.itemtype == "TOPIC":
+ item = wrapList(item, 0)
+ haveTopic = True
+ else:
+ if haveTopic: item = wrapList(item, 2)
+ else: item = wrapList(item, 0)
+ MeetingItems.append(item)
+ MeetingItems = '\n'.join(MeetingItems)
+ #MeetingURLs = "\n".join(M.rst_urls)
+ #del M.rst_urls, M.rst_refs
+ MeetingItems = MeetingItems# + '\n\n'+MeetingURLs
+
+ # Action Items
+ ActionItems = [ ]
+ for m in M.minutes:
+ # The hack below is needed because of pickling problems
+ if m.itemtype != "ACTION": continue
+ #already escaped
+ ActionItems.append(wrapList("* %s"%text(m.line), indent=0))
+ ActionItems = "\n".join(ActionItems)
+
+ # Action Items, by person (This could be made lots more efficient)
+ ActionItemsPerson = [ ]
+ for nick in sorted(M.attendees.keys(), key=lambda x: x.lower()):
+ headerPrinted = False
+ for m in M.minutes:
+ # The hack below is needed because of pickling problems
+ if m.itemtype != "ACTION": continue
+ if m.line.find(nick) == -1: continue
+ if not headerPrinted:
+ ActionItemsPerson.append("* %s"%text(nick))
+ headerPrinted = True
+ ActionItemsPerson.append(wrapList("* %s"%text(m.line), 2))
+ m.assigned = True
+ # unassigned items:
+ ActionItemsPerson.append("* **UNASSIGNED**")
+ numberUnassigned = 0
+ for m in M.minutes:
+ if m.itemtype != "ACTION": continue
+ if getattr(m, 'assigned', False): continue
+ ActionItemsPerson.append(wrapList("* %s"%text(m.line), 2))
+ numberUnassigned += 1
+ if numberUnassigned == 0: ActionItemsPerson.append(" * (none)")
+ ActionItemsPerson = "\n".join(ActionItemsPerson)
+
+ # People Attending
+ PeoplePresent = [ ]
+ # sort by number of lines spoken
+ for nick, count in self.iterNickCounts():
+ PeoplePresent.append('* %s (%s)'%(text(nick), count))
+ PeoplePresent = "\n".join(PeoplePresent)
+
+ # Actual formatting and replacement
+ repl = self.replacements()
+ repl.update({'titleBlock':('='*len(repl['pageTitle'])),
+ 'MeetingItems':MeetingItems,
+ 'ActionItems': ActionItems,
+ 'ActionItemsPerson': ActionItemsPerson,
+ 'PeoplePresent':PeoplePresent,
+ })
+ body = self.body
+ body = replaceWRAP(body)
+ body = body%repl
+ return body
+