forked from openlp/openlp
Fix the tidy_text method to not insert linefeeds, which is not allowed in XML.
This commit is contained in:
parent
32cfacff7e
commit
453bd53657
@ -140,11 +140,13 @@ class SongImport(QtCore.QObject):
|
|||||||
text = text.replace('\u2026', '...')
|
text = text.replace('\u2026', '...')
|
||||||
text = text.replace('\u2013', '-')
|
text = text.replace('\u2013', '-')
|
||||||
text = text.replace('\u2014', '-')
|
text = text.replace('\u2014', '-')
|
||||||
text = text.replace('\x0b', '\n\n')
|
# 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
|
# 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' ?(\r\n?|\n) ?', '\n', text)
|
||||||
text = re.sub(r' ?(\n{5}|\f)+ ?', '\f', text)
|
|
||||||
return text
|
return text
|
||||||
|
|
||||||
def process_song_text(self, text):
|
def process_song_text(self, text):
|
||||||
|
Loading…
Reference in New Issue
Block a user