Fix the tidy_text method to not insert linefeeds, which is not allowed in XML.

This commit is contained in:
Tomas Groth 2016-09-23 23:46:43 +02:00
parent 32cfacff7e
commit 453bd53657
1 changed files with 5 additions and 3 deletions

View File

@ -140,11 +140,13 @@ class SongImport(QtCore.QObject):
text = text.replace('\u2026', '...')
text = text.replace('\u2013', '-')
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
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):