1.1 --- a/TO_DO.txt Wed May 29 15:30:10 2013 +0200
1.2 +++ b/TO_DO.txt Wed May 29 17:02:17 2013 +0200
1.3 @@ -1,17 +1,12 @@
1.4 -DEV/Google Summer of Code 2013 (15564903)
1.5 -
1.6 - <br /> in preformatted regions should be converted to newlines
1.7 -
1.8 DEV/A 5 Minute Guide to Get the Mailman Web UI Running (only for development) (13303877)
1.9
1.10 Preformatted regions on their own line might be converted into proper sections
1.11 This affects both markup types
1.12
1.13 -DEV/MailmanOnLaunchpad (589838)
1.14 +DEV/MailmanOnLaunchpad (14352425)
1.15
1.16 - (Preformatted regions are not being formatted
1.17 - The previous version (15958128) had a newline at the start of the CDATA section and thus avoided this problem
1.18 - The problem is that preformatted regions containing newlines require a newline immediately after {{{ to be recognised)
1.19 + Confluence parsing output does not nest Moin regions and thus handle
1.20 + preformatted text inside regions
1.21
1.22 DEV/GSoC 2011 - Conversion from Confluence wiki to Moin (11960378)
1.23
2.1 --- a/wikiparser.py Wed May 29 15:30:10 2013 +0200
2.2 +++ b/wikiparser.py Wed May 29 17:02:17 2013 +0200
2.3 @@ -218,6 +218,14 @@
2.4 (r"\~", "~"),
2.5 ]
2.6
2.7 +preformatted_notation_mapping = [
2.8 + (r"\!", "!"),
2.9 + (r"\-", "-"),
2.10 + (r"\\""\n", "\n"),
2.11 + (r"\\ ", "\n"),
2.12 + (r"\~", "~"),
2.13 + ]
2.14 +
2.15 # Translation helpers.
2.16
2.17 markers = {
2.18 @@ -345,11 +353,11 @@
2.19 else:
2.20 return translate_text(match.group())
2.21
2.22 -def translate_text(s):
2.23 +def translate_text(s, preformatted=False):
2.24
2.25 "Translate the plain text string 's', converting notation."
2.26
2.27 - for before, after in notation_mapping:
2.28 + for before, after in preformatted and preformatted_notation_mapping or notation_mapping:
2.29 s = s.replace(before, after)
2.30 return s
2.31
2.32 @@ -362,11 +370,12 @@
2.33 """
2.34
2.35 parts = []
2.36 + preformatted = sectiontype in preformatted_sectiontypes
2.37
2.38 last = 0
2.39 for match in content_regexp.finditer(text):
2.40 start, end = match.span()
2.41 - parts.append(translate_text(text[last:start]))
2.42 + parts.append(translate_text(text[last:start], preformatted))
2.43
2.44 # Handle unformatted sections.
2.45
2.46 @@ -377,7 +386,7 @@
2.47
2.48 last = end
2.49
2.50 - parts.append(translate_text(text[last:]))
2.51 + parts.append(translate_text(text[last:], preformatted))
2.52 return "".join(parts)
2.53
2.54 def translate_block(blocktype, blocktext):
2.55 @@ -462,6 +471,8 @@
2.56 "warning" : "#!wiki warning\n",
2.57 }
2.58
2.59 +preformatted_sectiontypes = (None, "noformat")
2.60 +
2.61 macrotypes = {
2.62 "anchor" : "<<Anchor(%s)>>",
2.63 "color" : "<<Color(%s)>>",
3.1 --- a/xmlparser.py Wed May 29 15:30:10 2013 +0200
3.2 +++ b/xmlparser.py Wed May 29 17:02:17 2013 +0200
3.3 @@ -69,6 +69,11 @@
3.4 "br" : "<<BR>>",
3.5 }
3.6
3.7 +simple_preformatted_tags = {
3.8 + # XHTML tag MoinMoin syntax
3.9 + "br" : "\n",
3.10 + }
3.11 +
3.12 list_tags = {
3.13 # XHTML list tag MoinMoin list item syntax
3.14 "ol" : "1. %s",
3.15 @@ -369,8 +374,10 @@
3.16
3.17 elif text and conversion:
3.18 text = conversion % text
3.19 - elif simple_tags.has_key(name):
3.20 + elif simple_tags.has_key(name) and not self.is_preformatted():
3.21 text = simple_tags[name]
3.22 + elif simple_preformatted_tags.has_key(name) and self.is_preformatted():
3.23 + text = simple_preformatted_tags[name]
3.24
3.25
3.26