Remove not supported html from songs being imported.

bzr-revno: 1191
This commit is contained in:
Andreas Preikschat 2011-01-05 19:32:06 +00:00 committed by Tim Bentley
commit 787b4e2a58

View File

@ -27,10 +27,11 @@
The :mod:`songbeamerimport` module provides the functionality for importing The :mod:`songbeamerimport` module provides the functionality for importing
SongBeamer songs into the OpenLP database. SongBeamer songs into the OpenLP database.
""" """
import logging
import os
import chardet import chardet
import codecs import codecs
import logging
import os
import re
from openlp.core.lib import translate from openlp.core.lib import translate
from openlp.plugins.songs.lib.songimport import SongImport from openlp.plugins.songs.lib.songimport import SongImport
@ -151,23 +152,25 @@ class SongBeamerImport(SongImport):
(u'</i>', u'{/it}'), (u'</i>', u'{/it}'),
(u'<u>', u'{u}'), (u'<u>', u'{u}'),
(u'</u>', u'{/u}'), (u'</u>', u'{/u}'),
(u'<br>', u'{st}'),
(u'</br>', u'{st}'),
(u'</ br>', u'{st}'),
(u'<p>', u'{p}'), (u'<p>', u'{p}'),
(u'</p>', u'{/p}'), (u'</p>', u'{/p}'),
(u'<super>', u'{su}'), (u'<super>', u'{su}'),
(u'</super>', u'{/su}'), (u'</super>', u'{/su}'),
(u'<sub>', u'{sb}'), (u'<sub>', u'{sb}'),
(u'</sub>', u'{/sb}'), (u'</sub>', u'{/sb}'),
(u'<wordwrap>', u''), (u'<[/]?br.*?>', u'{st}'),
(u'</wordwrap>', u''), (u'<[/]?wordwrap>', u''),
(u'<strike>', u''), (u'<[/]?strike>', u''),
(u'</strike>', u'') (u'<[/]?h.*?>', u''),
(u'<[/]?s.*?>', u''),
(u'<[/]?linespacing.*?>', u''),
(u'<[/]?c.*?>', u''),
(u'<align.*?>', u''),
(u'<valign.*?>', u'')
] ]
for pair in tag_pairs: for pair in tag_pairs:
self.current_verse = self.current_verse.replace(pair[0], pair[1]) self.current_verse = re.compile(pair[0]).sub(pair[1],
# TODO: check for unsupported tags (see wiki) and remove them as well. self.current_verse)
def parse_tags(self, line): def parse_tags(self, line):
""" """