forked from openlp/openlp
Fix handling special chars in MediaShout import. Fixes bug 1618489.
Fixes: https://launchpad.net/bugs/1618489
This commit is contained in:
parent
6fcfe1aecd
commit
1e3bc35390
@ -93,7 +93,7 @@ class MediaShoutImport(SongImport):
|
||||
self.song_book_name = song.SongID
|
||||
for verse in verses:
|
||||
tag = VERSE_TAGS[verse.Type] + str(verse.Number) if verse.Type < len(VERSE_TAGS) else 'O'
|
||||
self.add_verse(verse.Text, tag)
|
||||
self.add_verse(self.tidy_text(verse.Text), tag)
|
||||
for order in verse_order:
|
||||
if order.Type < len(VERSE_TAGS):
|
||||
self.verse_order_list.append(VERSE_TAGS[order.Type] + str(order.Number))
|
||||
|
@ -140,10 +140,13 @@ class SongImport(QtCore.QObject):
|
||||
text = text.replace('\u2026', '...')
|
||||
text = text.replace('\u2013', '-')
|
||||
text = text.replace('\u2014', '-')
|
||||
# Replace vertical tab with 2 linebreaks
|
||||
text = text.replace('\v', '\n\n')
|
||||
# Replace form feed (page break) with 2 linebreaks
|
||||
text = text.replace('\f', '\n\n')
|
||||
# Remove surplus blank lines, spaces, trailing/leading spaces
|
||||
text = re.sub(r'[ \t\v]+', ' ', text)
|
||||
text = re.sub(r'[ \t]+', ' ', text)
|
||||
text = re.sub(r' ?(\r\n?|\n) ?', '\n', text)
|
||||
text = re.sub(r' ?(\n{5}|\f)+ ?', '\f', text)
|
||||
return text
|
||||
|
||||
def process_song_text(self, text):
|
||||
|
Loading…
Reference in New Issue
Block a user