# HG changeset patch # User Paul Boddie # Date 1369840757 -7200 # Node ID 3079bf27946b102e3d7174bb2700f3280ee1c9a0 # Parent 315f4e93682db06e621197b729d3604ecae8da16 Changed the handling of sections so that they are always treated as blocks. diff -r 315f4e93682d -r 3079bf27946b TO_DO.txt --- a/TO_DO.txt Wed May 29 17:16:31 2013 +0200 +++ b/TO_DO.txt Wed May 29 17:19:17 2013 +0200 @@ -1,6 +1,9 @@ DEV/A 5 Minute Guide to Get the Mailman Web UI Running (only for development) (13303877) - Preformatted regions on their own line might be converted into proper sections + (Preformatted regions on their own line might be converted into proper sections) + This was hopefully fixed by recognising that such regions are not inline + formatting directives + This may affect both markup types but this page seems not to be available in the XHTML format diff -r 315f4e93682d -r 3079bf27946b wikiparser.py --- a/wikiparser.py Wed May 29 17:16:31 2013 +0200 +++ b/wikiparser.py Wed May 29 17:19:17 2013 +0200 @@ -465,10 +465,10 @@ "code" : "", "noformat" : "", "quote" : "", - "info" : "#!wiki important\n", - "note" : "#!wiki caution\n", - "tip" : "#!wiki tip\n", - "warning" : "#!wiki warning\n", + "info" : "#!wiki important", + "note" : "#!wiki caution", + "tip" : "#!wiki tip", + "warning" : "#!wiki warning", } preformatted_sectiontypes = (None, "noformat") @@ -521,18 +521,11 @@ parts.append("\n") mointype = sectiontypes[sectiontype] - parts.append("{{{%s" % (mointype or "")) - text = text.strip() - - # Sections containing newlines must have a separate header line. - - if options or text.find("\n") != -1: - parts.append("\n") - + parts.append("{{{%s\n" % (mointype or "")) if options: parts.append("## %s\n" % options) - parts.append(translate_content(text, sectiontype)) - parts.append("%s}}}\n" % (mointype and "\n" or "")) + parts.append(translate_content(text.strip(), sectiontype)) + parts.append("\n}}}\n") preceded_by_block = True @@ -545,15 +538,9 @@ # Unrecognised sections. else: - parts.append("{{{") - - # Sections containing newlines must have a separate header line. - - if text.find("\n") != -1 and not text.startswith("\n"): - parts.append("\n") - - parts.append(translate_content(text, sectiontype)) - parts.append("}}}") + parts.append("{{{\n") + parts.append(translate_content(text.strip(), sectiontype)) + parts.append("\n}}}\n") preceded_by_block = False return "".join(parts)