diff MoinMoin/formatter/__init__.py @ 3054:d2e9afd64276

get formatters in sync with 1.6 cs 2558:3e3a549b49f0, add attachimg icon (needed by html formatter)
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Wed, 20 Feb 2008 10:23:56 +0100
parents c9dd12befda7
children c6e39279f83b
line wrap: on
line diff
--- a/MoinMoin/formatter/__init__.py	Wed Feb 20 01:14:06 2008 +0100
+++ b/MoinMoin/formatter/__init__.py	Wed Feb 20 10:23:56 2008 +0100
@@ -8,6 +8,7 @@
     @license: GNU GPL, see COPYING for details.
 """
 import re
+import logging
 
 from MoinMoin.util import pysupport
 from MoinMoin import wikiutil
@@ -333,10 +334,16 @@
         """
         # attention: this is copied into text_python!
         parser = wikiutil.searchAndImportPlugin(self.request.cfg, "parser", parser_name)
-
-        args = self._get_bang_args(lines[0])
-        if args is not None:
+        args = None
+        if lines:
+            args = self._get_bang_args(lines[0])
+            #logging.debug("formatter.parser: parser args %r" % args)
+            if args is not None:
+                lines = lines[1:]
+        if lines and not lines[0]:
             lines = lines[1:]
+        if lines and not lines[-1].strip():
+            lines = lines[:-1]
         p = parser('\n'.join(lines), self.request, format_args=args)
         p.format(self)
         del p