Merge lp:~tomasgroth/openlp/24bugfix-backport5 into lp:openlp/2.4

Proposed by Tomas Groth
Status: Merged
Approved by: Raoul Snyman
Approved revision: 2654
Merged at revision: 2653
Proposed branch: lp:~tomasgroth/openlp/24bugfix-backport5
Merge into: lp:openlp/2.4
Diff against target: 45 lines (+7/-4)
3 files modified
openlp/plugins/bibles/lib/http.py (+1/-1)
openlp/plugins/songs/lib/importers/mediashout.py (+1/-1)
openlp/plugins/songs/lib/importers/songimport.py (+5/-2)
To merge this branch: bzr merge lp:~tomasgroth/openlp/24bugfix-backport5
Reviewer Review Type Date Requested Status
Raoul Snyman Approve
Review via email: mp+306677@code.launchpad.net

Description of the change

Fixes getting bible texts from CrossWalk
Fix to handling of form feed char and vertical tab char.

To post a comment you must log in.
Revision history for this message
Tomas Groth (tomasgroth) wrote :
Revision history for this message
Raoul Snyman (raoul-snyman) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openlp/plugins/bibles/lib/http.py'
2--- openlp/plugins/bibles/lib/http.py 2016-07-27 19:27:14 +0000
3+++ openlp/plugins/bibles/lib/http.py 2016-09-23 22:26:31 +0000
4@@ -480,7 +480,7 @@
5 for verse in verses_div:
6 self.application.process_events()
7 verse_number = int(verse.find('strong').contents[0])
8- verse_span = verse.find('span')
9+ verse_span = verse.find('span', class_='verse-%d' % verse_number)
10 tags_to_remove = verse_span.find_all(['a', 'sup'])
11 for tag in tags_to_remove:
12 tag.decompose()
13
14=== modified file 'openlp/plugins/songs/lib/importers/mediashout.py'
15--- openlp/plugins/songs/lib/importers/mediashout.py 2016-06-16 20:58:11 +0000
16+++ openlp/plugins/songs/lib/importers/mediashout.py 2016-09-23 22:26:31 +0000
17@@ -93,7 +93,7 @@
18 self.song_book_name = song.SongID
19 for verse in verses:
20 tag = VERSE_TAGS[verse.Type] + str(verse.Number) if verse.Type < len(VERSE_TAGS) else 'O'
21- self.add_verse(verse.Text, tag)
22+ self.add_verse(self.tidy_text(verse.Text), tag)
23 for order in verse_order:
24 if order.Type < len(VERSE_TAGS):
25 self.verse_order_list.append(VERSE_TAGS[order.Type] + str(order.Number))
26
27=== modified file 'openlp/plugins/songs/lib/importers/songimport.py'
28--- openlp/plugins/songs/lib/importers/songimport.py 2016-04-21 19:49:22 +0000
29+++ openlp/plugins/songs/lib/importers/songimport.py 2016-09-23 22:26:31 +0000
30@@ -140,10 +140,13 @@
31 text = text.replace('\u2026', '...')
32 text = text.replace('\u2013', '-')
33 text = text.replace('\u2014', '-')
34+ # Replace vertical tab with 2 linebreaks
35+ text = text.replace('\v', '\n\n')
36+ # Replace form feed (page break) with 2 linebreaks
37+ text = text.replace('\f', '\n\n')
38 # Remove surplus blank lines, spaces, trailing/leading spaces
39- text = re.sub(r'[ \t\v]+', ' ', text)
40+ text = re.sub(r'[ \t]+', ' ', text)
41 text = re.sub(r' ?(\r\n?|\n) ?', '\n', text)
42- text = re.sub(r' ?(\n{5}|\f)+ ?', '\f', text)
43 return text
44
45 def process_song_text(self, text):

Subscribers

People subscribed via source and target branches

to all changes: