From 453bd53657e0b11d600b83225911be65f3ec18a9 Mon Sep 17 00:00:00 2001 From: Tomas Groth Date: Fri, 23 Sep 2016 23:46:43 +0200 Subject: [PATCH] Fix the tidy_text method to not insert linefeeds, which is not allowed in XML. --- openlp/plugins/songs/lib/importers/songimport.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/openlp/plugins/songs/lib/importers/songimport.py b/openlp/plugins/songs/lib/importers/songimport.py index 3fea7e9c7..c8648db85 100644 --- a/openlp/plugins/songs/lib/importers/songimport.py +++ b/openlp/plugins/songs/lib/importers/songimport.py @@ -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):