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-18 23:46:11 (GMT)
committer Richard Darst <rkd@zgib.net>2009-09-18 23:46:11 (GMT)
commit137e64286ea245e9eb9558beaf6992764d15986e (patch)
tree0bf2619fa3a6b0b07d156429474ea9a085d516ed
parentc2cfd4abd2c930b0166685f032cdb9ad8166a354 (diff)
Fix up the MediaWiki writer
- It should work now. darcs-hash:20090918234611-82ea9-1686b28b5cabc1d2f87874b7328b35c3504793c5.gz
-rw-r--r--items.py17
-rw-r--r--writers.py34
2 files changed, 34 insertions, 17 deletions
diff --git a/items.py b/items.py
index 7bc1869..187ab58 100644
--- a/items.py
+++ b/items.py
@@ -64,6 +64,8 @@ class _BaseItem(object):
endrst = ''
starttext = ''
endtext = ''
+ startmw = ''
+ endmw = ''
def get_replacements(self, escapewith):
replacements = { }
for name in dir(self):
@@ -108,8 +110,11 @@ class Topic(_BaseItem):
"""</span>""")
rst_template = """%(startrst)s%(topic)s%(endrst)s (%(rstref)s_)"""
text_template = """%(starttext)s%(topic)s%(endtext)s (%(nick)s, %(time)s)"""
+ mw_template = """%(startmw)s%(topic)s%(endmw)s (%(nick)s, %(time)s)"""
startrst = '**'
endrst = '**'
+ startmw = "'''"
+ endmw = "'''"
starthtml = '<b class="TOPIC">'
endhtml = '</b>'
def __init__(self, nick, line, linenum, time_):
@@ -133,6 +138,9 @@ class Topic(_BaseItem):
repl = self.get_replacements(escapewith=writers.text)
repl['link'] = self.logURL(M)
return self.text_template%repl
+ def mw(self, M):
+ repl = self.get_replacements(escapewith=writers.mw)
+ return self.mw_template%repl
class GenericItem(_BaseItem):
itemtype = ''
@@ -150,6 +158,7 @@ class GenericItem(_BaseItem):
"""</span>""")
rst_template = """*%(itemtype)s*: %(startrst)s%(line)s%(endrst)s (%(rstref)s_)"""
text_template = """%(itemtype)s: %(starttext)s%(line)s%(endtext)s (%(nick)s, %(time)s)"""
+ mw_template = """''%(itemtype)s:'' %(startmw)s%(line)s%(endmw)s (%(nick)s, %(time)s)"""
def __init__(self, nick, line, linenum, time_):
self.nick = nick ; self.line = line ; self.linenum = linenum
self.time = time.strftime("%H:%M:%S", time_)
@@ -170,6 +179,9 @@ class GenericItem(_BaseItem):
repl = self.get_replacements(escapewith=writers.text)
repl['link'] = self.logURL(M)
return self.text_template%repl
+ def mw(self, M):
+ repl = self.get_replacements(escapewith=writers.mw)
+ return self.mw_template%repl
class Info(GenericItem):
@@ -182,6 +194,7 @@ class Info(GenericItem):
"""</span>""")
rst_template = """%(startrst)s%(line)s%(endrst)s (%(rstref)s_)"""
text_template = """%(starttext)s%(line)s%(endtext)s (%(nick)s, %(time)s)"""
+ mw_template = """%(startmw)s%(line)s%(endmw)s (%(nick)s, %(time)s)"""
class Idea(GenericItem):
itemtype = 'IDEA'
class Agreed(GenericItem):
@@ -214,6 +227,7 @@ class Link(_BaseItem):
"""</span>""")
rst_template = """*%(itemtype)s*: %(startrst)s%(url)s %(line)s%(endrst)s (%(rstref)s_)"""
text_template = """%(itemtype)s: %(starttext)s%(url)s %(line)s%(endtext)s (%(nick)s, %(time)s)"""
+ mw_template = """''%(itemtype)s:'' %(startmw)s%(url)s %(line)s%(endmw)s (%(nick)s, %(time)s)"""
def __init__(self, nick, line, linenum, time_):
self.nick = nick ; self.linenum = linenum
self.time = time.strftime("%H:%M:%S", time_)
@@ -243,3 +257,6 @@ class Link(_BaseItem):
repl = self.get_replacements(escapewith=writers.text)
repl['link'] = self.logURL(M)
return self.text_template%repl
+ def mw(self, M):
+ repl = self.get_replacements(escapewith=writers.mw)
+ return self.mw_template%repl
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)