annotate MoinMoin/filter/text_xml.py @ 1918:bb2e053067fb

fixing copyright headers: remove umlauts (encoding troubles), make epydoc compatible, reformat
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Tue, 27 Mar 2007 21:07:33 +0200
parents 957d482215ac
children 0b220c040be4
rev   line source
470
957d482215ac lupy: some filters, update mode
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
1 # -*- coding: iso-8859-1 -*-
957d482215ac lupy: some filters, update mode
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
2 """
957d482215ac lupy: some filters, update mode
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
3 MoinMoin - text/xml file Filter
957d482215ac lupy: some filters, update mode
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
4
1918
bb2e053067fb fixing copyright headers: remove umlauts (encoding troubles), make epydoc compatible, reformat
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 470
diff changeset
5 @copyright: 2006 MoinMoin:ThomasWaldmann
470
957d482215ac lupy: some filters, update mode
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
6 @license: GNU GPL, see COPYING for details.
957d482215ac lupy: some filters, update mode
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
7 """
957d482215ac lupy: some filters, update mode
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
8
957d482215ac lupy: some filters, update mode
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
9 import re
957d482215ac lupy: some filters, update mode
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
10 from MoinMoin.filter.text import execute as textfilter
957d482215ac lupy: some filters, update mode
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
11
957d482215ac lupy: some filters, update mode
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
12 rx_stripxml = re.compile("<[^>]*?>", re.DOTALL|re.MULTILINE)
957d482215ac lupy: some filters, update mode
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
13
957d482215ac lupy: some filters, update mode
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
14 def execute(indexobj, filename):
957d482215ac lupy: some filters, update mode
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
15 data = textfilter(indexobj, filename)
957d482215ac lupy: some filters, update mode
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
16 try:
957d482215ac lupy: some filters, update mode
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
17 data = " ".join(rx_stripxml.sub(" ", data).split())
957d482215ac lupy: some filters, update mode
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
18 except RuntimeError, err:
957d482215ac lupy: some filters, update mode
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
19 indexobj.request.log(str(err))
957d482215ac lupy: some filters, update mode
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
20 data = ""
957d482215ac lupy: some filters, update mode
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
21 return data
957d482215ac lupy: some filters, update mode
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
22