diff MoinMoin/wikiutil.py @ 1748:dc0db3897437

StringIO operation moved from FootNote to wikiutil.executeText
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Sat, 20 Jan 2007 22:29:31 +0100
parents fdf01f9f3143
children 3567062fc66f
line wrap: on
line diff
--- a/MoinMoin/wikiutil.py	Thu Jan 18 10:10:02 2007 +0100
+++ b/MoinMoin/wikiutil.py	Sat Jan 20 22:29:31 2007 +0100
@@ -3,6 +3,7 @@
     MoinMoin - Wiki Utility Functions
 
     @copyright: 2000 - 2004 by Jürgen Hermann <jh@web.de>
+    @copyright: 2007 Reimar Bauer
     @license: GNU GPL, see COPYING for details.
 """
 
@@ -1643,3 +1644,15 @@
     ourticket = createTicket(request, timestamp_str)
     return ticket == ourticket
 
+def executeText(request, Parser, text, line_anchors=False):
+    '''render text with Parser execute each page element'''
+    import StringIO
+    out = StringIO.StringIO()
+    request.redirect(out)
+    wikiizer = Parser(text, request, line_anchors=line_anchors)
+    wikiizer.format(request.formatter)
+    result = out.getvalue()
+    request.redirect()
+    del out
+    return result
+