Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbochecha <bochecha@fedoraproject.org>2009-09-23 23:52:57 (GMT)
committer bochecha <bochecha@fedoraproject.org>2009-09-23 23:52:57 (GMT)
commit3266058585f1c44b27d7b8bb177be2e4084f6e09 (patch)
treefdbb5b18f2e4bea48873f08efd5c6f886d920bab
parent3a083970811ef7c2f3d164f0def202abfcc30843 (diff)
Genshi text template
Ignore-this: fd659a7ae6fdf33393d5cbda81b614b3 This commit adds the possibility to control the text output with a Genshi text template. darcs-hash:20090923235257-fa9d6-2b1c550f26384e5a2418e251d9149c48eaa1a5c9.gz
-rw-r--r--meeting-minutes-template.txt53
-rw-r--r--writers.py43
2 files changed, 95 insertions, 1 deletions
diff --git a/meeting-minutes-template.txt b/meeting-minutes-template.txt
new file mode 100644
index 0000000..bf58057
--- /dev/null
+++ b/meeting-minutes-template.txt
@@ -0,0 +1,53 @@
+{% python
+ heading = "="*len(meeting['title'])
+
+ from textwrap import TextWrapper
+ def wrap(text, level):
+ return TextWrapper(width=72, initial_indent=' '*(level-1)*2, subsequent_indent=' '*level*2, break_long_words=False).fill(text)
+%}
+${heading}
+${meeting.title}
+${heading}
+
+
+Meeting started by ${meeting.owner} at ${time.start} ${time.timezone}. The full logs are
+available at ${meeting.logs} .
+
+
+
+Meeting summary
+---------------
+
+{% for item in agenda %}\
+{% choose %}\
+{% when item.topic.nick %}${wrap("* %s (%s, %s)"%(item.topic.topic, item.topic.nick, item.topic.time), 1)}{% end %}\
+{% otherwise %}${wrap("* %s"%(item.topic.topic), 1)}{% end %}
+{% end %}\
+{% for note in item.notes %}\
+${wrap("* %s: %s (%s, %s)"%(note.itemtype, note.line, note.nick, note.time), 2)}
+{% end %}
+{%end%}
+
+Meeting ended at ${time.end} ${time.timezone}.
+
+
+
+Action items, by person
+-----------------------
+
+{% for attendee in actions_person %}\
+* ${attendee.nick}
+{% for action in attendee.actions %}\
+${wrap("* %s"%action, 2)}
+{% end %}
+{% end %}
+
+People present (lines said)
+---------------------------
+
+{% for attendee in attendees %}\
+* ${attendee.nick} (${attendee.count})
+{% end %}
+
+
+Generated by `MeetBot`_ ${meetbot.version}
diff --git a/writers.py b/writers.py
index 43768fa..35ac061 100644
--- a/writers.py
+++ b/writers.py
@@ -239,7 +239,7 @@ class _BaseWriter(object):
-class Template(_BaseWriter):
+class HTMLTemplate(_BaseWriter):
def format(self, extension=None):
repl = self.get_template()
@@ -280,6 +280,47 @@ class Template(_BaseWriter):
return stream.render()
+class TextTemplate(_BaseWriter):
+
+ def format(self, extension=None):
+ repl = self.get_template()
+
+ # Uncomment this line to interactively play with the "repl"
+ # replacements object, for debugging purposes
+ #from code import interact ; interact(local=locals())
+
+ # let's make the data structure easier to use in the template
+ time = { 'start': repl['starttime'], 'end': repl['endtime'], 'timezone': repl['timeZone'] }
+ meeting = { 'title': repl['pageTitle'], 'owner': repl['owner'], 'logs': repl['fullLogsFullURL'] }
+ attendees = [ person for person in repl['PeoplePresent'] ]
+ agenda = [ { 'topic': item['topic'], 'notes': item['items'] } for item in repl['MeetingItems'] ]
+ actions = [ action for action in repl['ActionItems'] ]
+ actions_person = [ { 'nick': attendee['nick'], 'actions': attendee['items'] } for attendee in repl['ActionItemsPerson'] ]
+ meetbot = { 'version': repl['MeetBotVersion'], 'url': repl['MeetBotInfoURL'] }
+
+ from genshi.template import NewTextTemplate
+
+ # hardcoded path to the template file might not be the best thing to do :]
+ minutes_template = 'meeting-minutes-template.txt'
+
+ try:
+ f = open(minutes_template, 'r')
+
+ tmpl = NewTextTemplate(f.read())
+ stream = tmpl.generate(time=time,
+ meeting=meeting,
+ attendees=attendees,
+ agenda=agenda,
+ actions=actions,
+ actions_person=actions_person,
+ meetbot=meetbot)
+
+ finally:
+ f.close()
+
+ return stream.render()
+
+
class _CSSmanager(object):