~raoul-snyman/openlp/fix-songusage-2.4

« back to all changes in this revision

Viewing changes to openlp/plugins/songs/lib/importers/songimport.py

  • Committer: Raoul Snyman
  • Author(s): tomasgroth at yahoo
  • Date: 2016-09-24 10:15:07 UTC
  • mfrom: (2652.1.2 24bugfix-backport5)
  • Revision ID: raoul@snyman.info-20160924101507-50brv2yh6rw5sao5
Fixes getting bible texts from CrossWalk
Fix to handling of form feed char and vertical tab char.

Show diffs side-by-side

added added

removed removed

Lines of Context:
140
140
        text = text.replace('\u2026', '...')
141
141
        text = text.replace('\u2013', '-')
142
142
        text = text.replace('\u2014', '-')
 
143
        # Replace vertical tab with 2 linebreaks
 
144
        text = text.replace('\v', '\n\n')
 
145
        # Replace form feed (page break) with 2 linebreaks
 
146
        text = text.replace('\f', '\n\n')
143
147
        # Remove surplus blank lines, spaces, trailing/leading spaces
144
 
        text = re.sub(r'[ \t\v]+', ' ', text)
 
148
        text = re.sub(r'[ \t]+', ' ', text)
145
149
        text = re.sub(r' ?(\r\n?|\n) ?', '\n', text)
146
 
        text = re.sub(r' ?(\n{5}|\f)+ ?', '\f', text)
147
150
        return text
148
151
 
149
152
    def process_song_text(self, text):