Back to index

moin  1.9.0~rc2
text_xml.py
Go to the documentation of this file.
00001 # -*- coding: iso-8859-1 -*-
00002 """
00003     MoinMoin - text/xml file Filter
00004 
00005     @copyright: 2006 MoinMoin:ThomasWaldmann
00006     @license: GNU GPL, see COPYING for details.
00007 """
00008 
00009 import re
00010 
00011 from MoinMoin import log
00012 logging = log.getLogger(__name__)
00013 
00014 from MoinMoin.filter.text import execute as textfilter
00015 
00016 rx_stripxml = re.compile("<[^>]*?>", re.DOTALL|re.MULTILINE)
00017 
00018 def execute(indexobj, filename):
00019     data = textfilter(indexobj, filename)
00020     try:
00021         data = " ".join(rx_stripxml.sub(" ", data).split())
00022     except RuntimeError, err:
00023         logging.error(str(err))
00024         data = ""
00025     return data
00026