forked from openlp/openlp
SongBeamer import converts tags, that they'll work with OpenLP
This commit is contained in:
parent
66f230169d
commit
0dc9d433b7
@ -109,6 +109,7 @@ class SongBeamerImport(SongImport):
|
|||||||
self.parse_tags(line)
|
self.parse_tags(line)
|
||||||
elif line.startswith(u'---'):
|
elif line.startswith(u'---'):
|
||||||
if self.current_verse:
|
if self.current_verse:
|
||||||
|
self.replace_html_tags()
|
||||||
self.add_verse(self.current_verse,
|
self.add_verse(self.current_verse,
|
||||||
self.current_verse_type)
|
self.current_verse_type)
|
||||||
self.current_verse = u''
|
self.current_verse = u''
|
||||||
@ -123,12 +124,41 @@ class SongBeamerImport(SongImport):
|
|||||||
else:
|
else:
|
||||||
self.current_verse += u'%s\n' % line
|
self.current_verse += u'%s\n' % line
|
||||||
if self.current_verse:
|
if self.current_verse:
|
||||||
|
self.replace_html_tags()
|
||||||
self.add_verse(self.current_verse, self.current_verse_type)
|
self.add_verse(self.current_verse, self.current_verse_type)
|
||||||
self.finish()
|
self.finish()
|
||||||
self.import_wizard.incrementProgressBar(
|
self.import_wizard.incrementProgressBar(
|
||||||
"Importing %s" % (self.file_name))
|
"Importing %s" % (self.file_name))
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def replace_html_tags(self):
|
||||||
|
"""
|
||||||
|
This can be called to replace SongBeamer's specific (html) tags with
|
||||||
|
OpenLP's specific (html) tags.
|
||||||
|
"""
|
||||||
|
tag_pairs = [
|
||||||
|
(u'<b>', u'{st}'),
|
||||||
|
(u'</b>', u'{/st}'),
|
||||||
|
(u'<i>', u'{it}'),
|
||||||
|
(u'</i>', u'{/it}'),
|
||||||
|
(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'')
|
||||||
|
]
|
||||||
|
for pair in tag_pairs:
|
||||||
|
self.current_verse.replace(pair[0], pair[1])
|
||||||
|
# TODO: check for unsupported tags (see wiki) and remove them as well.
|
||||||
|
|
||||||
def parse_tags(self, line):
|
def parse_tags(self, line):
|
||||||
"""
|
"""
|
||||||
Parses a meta data line.
|
Parses a meta data line.
|
||||||
|
Loading…
Reference in New Issue
Block a user