From 9ac3d436994836c39fcaf5d3fb709f691bf8ae7d Mon Sep 17 00:00:00 2001 From: Richard Darst Date: Mon, 14 Sep 2009 15:50:22 +0000 Subject: Greatly change the Text writer to me more modular - Functionality should be the same, but now has the moduler mechanism that I recently added to the HTML2 writer. darcs-hash:20090914155022-82ea9-5b8bc05ca6516661c1aef8913b863ba61fb6808e.gz --- diff --git a/writers.py b/writers.py index 56b602d..4f0ad86 100644 --- a/writers.py +++ b/writers.py @@ -738,60 +738,12 @@ class HTMLfromReST(_BaseWriter): class Text(_BaseWriter): - body = 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 - - - - Meeting summary - --------------- - %(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`_%(MeetBotVersion)s - - .. _`MeetBot`: %(MeetBotInfoURL)s - """) - - def format(self, extension=None): - """Return a ReStructured Text minutes summary.""" + def meetingItems(self): M = self.M # Agenda items MeetingItems = [ ] - #M.rst_urls = [ ] - #M.rst_refs = { } + MeetingItems.append(self.heading('Meeting summary')) haveTopic = None for m in M.minutes: item = "* "+m.text(M) @@ -805,12 +757,13 @@ class Text(_BaseWriter): 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 + 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 @@ -818,8 +771,12 @@ class Text(_BaseWriter): 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: @@ -830,6 +787,7 @@ class Text(_BaseWriter): ActionItemsPerson.append("* %s"%text(nick)) headerPrinted = True ActionItemsPerson.append(wrapList("* %s"%text(m.line), 2)) + numberAssigned += 1 m.assigned = True # unassigned items: Unassigned = [ ] @@ -846,23 +804,58 @@ class Text(_BaseWriter): 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'])), - 'MeetingItems':MeetingItems, - 'ActionItems': ActionItems, - 'ActionItemsPerson': ActionItemsPerson, - 'PeoplePresent':PeoplePresent, }) - body = self.body - body = body%repl + + + 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 + -- cgit v0.9.1