From 137e64286ea245e9eb9558beaf6992764d15986e Mon Sep 17 00:00:00 2001 From: Richard Darst Date: Fri, 18 Sep 2009 23:46:11 +0000 Subject: Fix up the MediaWiki writer - It should work now. darcs-hash:20090918234611-82ea9-1686b28b5cabc1d2f87874b7328b35c3504793c5.gz --- (limited to 'writers.py') diff --git a/writers.py b/writers.py index 0eaa397..4e43516 100644 --- a/writers.py +++ b/writers.py @@ -51,6 +51,10 @@ def rst(text): def text(text): """Escapes bad sequences in text (not implemented yet)""" return text +def mw(text): + """Escapes bad sequences in MediaWiki markup (not implemented yet)""" + return text + # wraping functions (for RST) class TextWrapper(textwrap.TextWrapper): @@ -870,15 +874,13 @@ class MediaWiki(_BaseWriter): MeetingItems.append(self.heading('Meeting summary')) haveTopic = None for m in M.minutes: - item = "* "+m.text(M) + item = "* "+m.mw(M) if m.itemtype == "TOPIC": if haveTopic: - MeetingItems.append("") - item = wrapList(item, 0) + MeetingItems.append("") # line break haveTopic = True else: - if haveTopic: item = wrapList(item, 2) - else: item = wrapList(item, 0) + if haveTopic: item = "*"+item MeetingItems.append(item) MeetingItems = '\n'.join(MeetingItems) return MeetingItems @@ -892,8 +894,9 @@ class MediaWiki(_BaseWriter): # 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.append("* %s"%mw(m.line)) ActionItems = "\n".join(ActionItems) + return ActionItems def actionItemsPerson(self): M = self.M @@ -908,9 +911,9 @@ class MediaWiki(_BaseWriter): if m.itemtype != "ACTION": continue if m.line.find(nick) == -1: continue if not headerPrinted: - ActionItemsPerson.append("* %s"%text(nick)) + ActionItemsPerson.append("* %s"%mw(nick)) headerPrinted = True - ActionItemsPerson.append(wrapList("* %s"%text(m.line), 2)) + ActionItemsPerson.append("** %s"%mw(m.line)) numberAssigned += 1 m.assigned = True # unassigned items: @@ -920,7 +923,7 @@ class MediaWiki(_BaseWriter): for m in M.minutes: if m.itemtype != "ACTION": continue if getattr(m, 'assigned', False): continue - Unassigned.append(wrapList("* %s"%text(m.line), 2)) + Unassigned.append("** %s"%mw(m.line)) numberUnassigned += 1 if numberUnassigned == 0: Unassigned.append(" * (none)") @@ -940,16 +943,16 @@ class MediaWiki(_BaseWriter): 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.append('* %s (%s)'%(mw(nick), count)) PeoplePresent = "\n".join(PeoplePresent) return PeoplePresent def heading(self, name): - return '%s\n%s\n'%(name, '-'*len(name)) + return '== %s ==\n'%name def format(self, extension=None): - """Return a ReStructured Text minutes summary.""" + """Return a MediaWiki formatted minutes summary.""" M = self.M # Actual formatting and replacement @@ -960,10 +963,7 @@ class MediaWiki(_BaseWriter): body = [ ] body.append(textwrap.dedent("""\ - %(titleBlock)s - %(pageTitle)s - %(titleBlock)s - + = %(pageTitle)s = sWRAPsMeeting started by %(owner)s at %(starttime)s %(timeZone)s. The full logs are available at @@ -975,7 +975,7 @@ class MediaWiki(_BaseWriter): body.append(self.actionItemsPerson()) body.append(self.peoplePresent()) body.append(textwrap.dedent("""\ - Generated by `MeetBot`_%(MeetBotVersion)s"""%repl)) + Generated by MeetBot%(MeetBotVersion)s (%(MeetBotInfoURL)s)"""%repl)) body = [ b for b in body if b is not None ] body = "\n\n\n\n".join(body) body = replaceWRAP(body) -- cgit v0.9.1