changeset 5636:61d77b5506a5

Fix docbook formatter crashing, see MoinMoinPatch/IncludeMacroWithDocBookFormatter If a page has a Include macro call with editlink argument, the formatter crashes. This patch removes the editlink arg before processing it.
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sat, 13 Mar 2010 22:45:07 +0100
parents 244737a44ec8
children 788131dd21c3
files MoinMoin/formatter/text_docbook.py
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/formatter/text_docbook.py	Mon Mar 08 14:20:37 2010 +0100
+++ b/MoinMoin/formatter/text_docbook.py	Sat Mar 13 22:45:07 2010 +0100
@@ -9,7 +9,7 @@
     @license: GNU GPL, see COPYING for details.
 """
 
-import os
+import os,re
 
 from xml.dom import getDOMImplementation
 from xml.dom.ext.reader import Sax
@@ -612,7 +612,12 @@
             was_in_para = self.cur.nodeName == "para"
             if was_in_para:
                 self.paragraph(0)
-            text = FormatterBase.macro(self, macro_obj, name, args)
+            
+            # Regular Expression to match editlink arg, remove it because it causes trouble.
+            _arg_editlink = r'(,\s*(?P<editlink>editlink))?'
+            macro_args = re.sub(_arg_editlink, '', args)
+        
+            text = FormatterBase.macro(self, macro_obj, name, macro_args)
             if text.strip():
                 self._copyExternalNodes(Sax.FromXml(text).documentElement.childNodes, exclude=excludes)
             if was_in_para: