~gtalent/openlp/openlp

« back to all changes in this revision

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

  • Committer: Gary Talent
  • Date: 2017-03-29 21:40:54 UTC
  • mfrom: (2695.1.35 openlp)
  • Revision ID: gtalent2@gmail.com-20170329214054-62r3rqvv3c0raagb
Update to trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
###############################################################################
5
5
# OpenLP - Open Source Lyrics Projection                                      #
6
6
# --------------------------------------------------------------------------- #
7
 
# Copyright (c) 2008-2016 OpenLP Developers                                   #
 
7
# Copyright (c) 2008-2017 OpenLP Developers                                   #
8
8
# --------------------------------------------------------------------------- #
9
9
# This program is free software; you can redistribute it and/or modify it     #
10
10
# under the terms of the GNU General Public License as published by the Free  #
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):