forked from openlp/openlp
Add BlankLine hint and deal with a leading asterisk on a verse number
This commit is contained in:
parent
72747c3936
commit
bd61ad1f6d
@ -163,6 +163,9 @@ class SingingTheFaithImport(SongImport):
|
|||||||
elif hint == 'AddSpaceAfterColon':
|
elif hint == 'AddSpaceAfterColon':
|
||||||
line = line.replace(':', ': ')
|
line = line.replace(':', ': ')
|
||||||
line_replaced = False
|
line_replaced = False
|
||||||
|
elif hint == 'BlankLine':
|
||||||
|
line = ' *Blank*'
|
||||||
|
line_replaced = False
|
||||||
else:
|
else:
|
||||||
self.log_error(translate('SongsPlugin.SingingTheFaithImport',
|
self.log_error(translate('SongsPlugin.SingingTheFaithImport',
|
||||||
'File {file})'.format(file=file.name)),
|
'File {file})'.format(file=file.name)),
|
||||||
@ -175,6 +178,10 @@ class SingingTheFaithImport(SongImport):
|
|||||||
# so will deal with that before stripping all leading spaces.
|
# so will deal with that before stripping all leading spaces.
|
||||||
indent = 0
|
indent = 0
|
||||||
if line.strip():
|
if line.strip():
|
||||||
|
# One hymn has one line which starts '* 6' at the start of a verse
|
||||||
|
# Strip this out
|
||||||
|
if line.startswith('* 6'):
|
||||||
|
line = line.lstrip('* ')
|
||||||
verse_num_match = re.search(r'^\d+', line)
|
verse_num_match = re.search(r'^\d+', line)
|
||||||
if verse_num_match:
|
if verse_num_match:
|
||||||
# Could extract the verse number and check it against the calculated
|
# Could extract the verse number and check it against the calculated
|
||||||
@ -216,6 +223,10 @@ class SingingTheFaithImport(SongImport):
|
|||||||
for a in authors:
|
for a in authors:
|
||||||
self.parse_author(a)
|
self.parse_author(a)
|
||||||
continue
|
continue
|
||||||
|
# If a blank line has bee replaced by *Blank* then put it back to being
|
||||||
|
# a simple space since this is past stripping blanks
|
||||||
|
if '*Blank*' in line:
|
||||||
|
line = ' '
|
||||||
if line == '':
|
if line == '':
|
||||||
if current_verse != '':
|
if current_verse != '':
|
||||||
self.add_verse(current_verse, current_verse_type)
|
self.add_verse(current_verse, current_verse_type)
|
||||||
@ -359,6 +370,10 @@ class SingingTheFaithImport(SongImport):
|
|||||||
vals = val.split(',')
|
vals = val.split(',')
|
||||||
for v in vals:
|
for v in vals:
|
||||||
self.hint_line[v] = 'AddSpaceAfterColon'
|
self.hint_line[v] = 'AddSpaceAfterColon'
|
||||||
|
elif tag == 'BlankLine':
|
||||||
|
vals = val.split(',')
|
||||||
|
for v in vals:
|
||||||
|
self.hint_line[v] = 'BlankLine'
|
||||||
elif tag == 'VerseOrder':
|
elif tag == 'VerseOrder':
|
||||||
self.hint_verse_order = val
|
self.hint_verse_order = val
|
||||||
elif tag == 'ManualCheck':
|
elif tag == 'ManualCheck':
|
||||||
|
Loading…
Reference in New Issue
Block a user