Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Darst <rkd@zgib.net>2009-09-14 15:53:37 (GMT)
committer Richard Darst <rkd@zgib.net>2009-09-14 15:53:37 (GMT)
commitc2cfd4abd2c930b0166685f032cdb9ad8166a354 (patch)
tree2421200a30beaa59761c1c4cd87235619ef94a4d
parent9ac3d436994836c39fcaf5d3fb709f691bf8ae7d (diff)
Add MediaWiki writer prototype
- This is just a copy of the Text writer for now, no changes have been made for the MediaWiki syntax yet. - This will allow a nice diff of how Text has to be changed to become MediaWiki once I make the next commit. darcs-hash:20090914155337-82ea9-1e1fe08d58d85f8da6189a75b105f20cf3d41f8b.gz
-rw-r--r--writers.py123
1 files changed, 123 insertions, 0 deletions
diff --git a/writers.py b/writers.py
index 4f0ad86..0eaa397 100644
--- a/writers.py
+++ b/writers.py
@@ -859,3 +859,126 @@ class Text(_BaseWriter):
return body
+class MediaWiki(_BaseWriter):
+ """Outputs MediaWiki formats.
+ """
+ def meetingItems(self):
+ M = self.M
+
+ # Agenda items
+ MeetingItems = [ ]
+ MeetingItems.append(self.heading('Meeting summary'))
+ haveTopic = None
+ for m in M.minutes:
+ item = "* "+m.text(M)
+ if m.itemtype == "TOPIC":
+ if haveTopic:
+ MeetingItems.append("")
+ 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)
+ return MeetingItems
+
+ def actionItems(self):
+ M = self.M
+ # Action Items
+ ActionItems = [ ]
+ ActionItems.append(self.heading('Action items'))
+ 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)
+
+ def actionItemsPerson(self):
+ M = self.M
+ # Action Items, by person (This could be made lots more efficient)
+ ActionItemsPerson = [ ]
+ ActionItemsPerson.append(self.heading('Action items, by person'))
+ numberAssigned = 0
+ 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))
+ numberAssigned += 1
+ m.assigned = True
+ # unassigned items:
+ Unassigned = [ ]
+ Unassigned.append("* **UNASSIGNED**")
+ numberUnassigned = 0
+ for m in M.minutes:
+ if m.itemtype != "ACTION": continue
+ if getattr(m, 'assigned', False): continue
+ Unassigned.append(wrapList("* %s"%text(m.line), 2))
+ numberUnassigned += 1
+ if numberUnassigned == 0:
+ Unassigned.append(" * (none)")
+ if numberUnassigned > 1:
+ ActionItemsPerson.extend(Unassigned)
+ ActionItemsPerson = "\n".join(ActionItemsPerson)
+
+ if numberAssigned == 0:
+ return None
+ else:
+ return ActionItemsPerson
+
+ def peoplePresent(self):
+ M = self.M
+ # People Attending
+ PeoplePresent = [ ]
+ PeoplePresent.append(self.heading('People present (lines said)'))
+ # sort by number of lines spoken
+ for nick, count in self.iterNickCounts():
+ PeoplePresent.append('* %s (%s)'%(text(nick), count))
+ PeoplePresent = "\n".join(PeoplePresent)
+ return PeoplePresent
+
+ def heading(self, name):
+ return '%s\n%s\n'%(name, '-'*len(name))
+
+
+ def format(self, extension=None):
+ """Return a ReStructured Text minutes summary."""
+ M = self.M
+
+ # Actual formatting and replacement
+ repl = self.replacements()
+ repl.update({'titleBlock':('='*len(repl['pageTitle'])),
+ })
+
+
+ body = [ ]
+ body.append(textwrap.dedent("""\
+ %(titleBlock)s
+ %(pageTitle)s
+ %(titleBlock)s
+
+
+ sWRAPsMeeting started by %(owner)s at %(starttime)s
+ %(timeZone)s. The full logs are available at
+ %(fullLogsFullURL)s .eWRAPe"""%repl))
+ body.append(self.meetingItems())
+ body.append(textwrap.dedent("""\
+ Meeting ended at %(endtime)s %(timeZone)s."""%repl))
+ body.append(self.actionItems())
+ body.append(self.actionItemsPerson())
+ body.append(self.peoplePresent())
+ body.append(textwrap.dedent("""\
+ Generated by `MeetBot`_%(MeetBotVersion)s"""%repl))
+ body = [ b for b in body if b is not None ]
+ body = "\n\n\n\n".join(body)
+ body = replaceWRAP(body)
+
+ return body
+