diff MoinMoin/filter/text_xml.py @ 470:957d482215ac

lupy: some filters, update mode imported from: moin--main--1.5--patch-474
author Thomas Waldmann <tw@waldmann-edv.de>
date Mon, 13 Mar 2006 19:31:36 +0000
parents
children bb2e053067fb
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MoinMoin/filter/text_xml.py	Mon Mar 13 19:31:36 2006 +0000
@@ -0,0 +1,22 @@
+# -*- coding: iso-8859-1 -*-
+"""
+    MoinMoin - text/xml file Filter
+
+    @copyright: 2006 by ThomasWaldmann MoinMoin:ThomasWaldmann
+    @license: GNU GPL, see COPYING for details.
+"""
+
+import re
+from MoinMoin.filter.text import execute as textfilter
+
+rx_stripxml = re.compile("<[^>]*?>", re.DOTALL|re.MULTILINE)
+
+def execute(indexobj, filename):
+    data = textfilter(indexobj, filename)
+    try:
+        data = " ".join(rx_stripxml.sub(" ", data).split())
+    except RuntimeError, err:
+        indexobj.request.log(str(err))
+        data = ""
+    return data
+