openlp-core team mailing list archive
-
openlp-core team
-
Mailing list archive
-
Message #05348
[Merge] lp:~googol-hush/openlp/songs into lp:openlp
Andreas Preikschat has proposed merging lp:~googol-hush/openlp/songs into lp:openlp.
Requested reviews:
OpenLP Core (openlp-core)
For more details, see:
https://code.launchpad.net/~googol-hush/openlp/songs/+merge/45261
Remove not supported html from songs being imported.
--
https://code.launchpad.net/~googol-hush/openlp/songs/+merge/45261
Your team OpenLP Core is requested to review the proposed merge of lp:~googol-hush/openlp/songs into lp:openlp.
=== modified file 'openlp/plugins/songs/lib/songbeamerimport.py'
--- openlp/plugins/songs/lib/songbeamerimport.py 2010-12-31 19:22:41 +0000
+++ openlp/plugins/songs/lib/songbeamerimport.py 2011-01-05 16:46:09 +0000
@@ -27,10 +27,11 @@
The :mod:`songbeamerimport` module provides the functionality for importing
SongBeamer songs into the OpenLP database.
"""
+import chardet
+import codecs
import logging
import os
-import chardet
-import codecs
+import re
from openlp.core.lib import translate
from openlp.plugins.songs.lib.songimport import SongImport
@@ -151,23 +152,25 @@
(u'</i>', u'{/it}'),
(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'<super>', u'{su}'),
(u'</super>', u'{/su}'),
(u'<sub>', u'{sb}'),
(u'</sub>', u'{/sb}'),
- (u'<wordwrap>', u''),
- (u'</wordwrap>', u''),
- (u'<strike>', u''),
- (u'</strike>', u'')
+ (u'<[/]?br.*?>', u'{st}'),
+ (u'<[/]?wordwrap>', 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:
- self.current_verse = self.current_verse.replace(pair[0], pair[1])
- # TODO: check for unsupported tags (see wiki) and remove them as well.
+ self.current_verse = re.compile(pair[0]).sub(pair[1],
+ self.current_verse)
def parse_tags(self, line):
"""
Follow ups