changeset 2866:2ac0fae11d15

Creole parser: got rid of the setParser() helper
author Radomir Dopieralski <moindev@sheep.art.pl>
date Mon, 24 Sep 2007 00:37:56 +0200
parents ae24fa8ff4b2
children 69234509b7cf
files MoinMoin/parser/text_creole.py
diffstat 1 files changed, 10 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/parser/text_creole.py	Mon Sep 24 00:07:43 2007 +0200
+++ b/MoinMoin/parser/text_creole.py	Mon Sep 24 00:37:56 2007 +0200
@@ -760,22 +760,18 @@
 #        ])
 
     def preformatted_emit(self, node):
-        content = node.content
-        self.parser = None
         parser_name = getattr(node, 'sect', '')
         if parser_name:
-            self.setParser(parser_name)
-        if self.parser is None:
-            self.parser_name = None
-            return ''.join([
-                self.formatter.preformatted(1),
-                self.formatter.text(content),
-                self.formatter.preformatted(0),
-            ])
-        else:
-            self.parser_name = parser_name
-            return self.request.redirectedOutput(
-                self.formatter.parser, self.parser_name, content.split('\n'))
+            try:
+                return self.request.redirectedOutput(
+                    self.formatter.parser, parser_name, node.content.split('\n'))
+            except wikiutil.PluginMissingError:
+                pass
+        return ''.join([
+            self.formatter.preformatted(1),
+            self.formatter.text(node.content),
+            self.formatter.preformatted(0),
+        ])
 
     def default_emit(self, node):
         return ''.join([