annotate MoinMoin/filter/text_xml.py @ 5250:00ca621ffbc2 1.9.0rc1

updated underlay
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Tue, 03 Nov 2009 00:40:45 +0100
parents 0b220c040be4
children
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
3611
0b220c040be4 replace request.log by direct logging calls
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1918
diff changeset
10
0b220c040be4 replace request.log by direct logging calls
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1918
diff changeset
11 from MoinMoin import log
0b220c040be4 replace request.log by direct logging calls
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1918
diff changeset
12 logging = log.getLogger(__name__)
0b220c040be4 replace request.log by direct logging calls
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1918
diff changeset
13
470
957d482215ac lupy: some filters, update mode
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
14 from MoinMoin.filter.text import execute as textfilter
957d482215ac lupy: some filters, update mode
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
15
957d482215ac lupy: some filters, update mode
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
16 rx_stripxml = re.compile("<[^>]*?>", re.DOTALL|re.MULTILINE)
957d482215ac lupy: some filters, update mode
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
17
957d482215ac lupy: some filters, update mode
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
18 def execute(indexobj, filename):
957d482215ac lupy: some filters, update mode
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
19 data = textfilter(indexobj, filename)
957d482215ac lupy: some filters, update mode
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
20 try:
957d482215ac lupy: some filters, update mode
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
21 data = " ".join(rx_stripxml.sub(" ", data).split())
957d482215ac lupy: some filters, update mode
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
22 except RuntimeError, err:
3611
0b220c040be4 replace request.log by direct logging calls
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 1918
diff changeset
23 logging.error(str(err))
470
957d482215ac lupy: some filters, update mode
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
24 data = ""
957d482215ac lupy: some filters, update mode
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
25 return data
957d482215ac lupy: some filters, update mode
Thomas Waldmann <tw@waldmann-edv.de>
parents:
diff changeset
26