Merge lp:~raoul-snyman/openlp/bug-907164 into lp:openlp

Proposed by Raoul Snyman
Status: Merged
Approved by: Tim Bentley
Approved revision: 1845
Merged at revision: 1851
Proposed branch: lp:~raoul-snyman/openlp/bug-907164
Merge into: lp:openlp
Diff against target: 19 lines (+9/-0)
1 file modified
openlp/plugins/bibles/lib/http.py (+9/-0)
To merge this branch: bzr merge lp:~raoul-snyman/openlp/bug-907164
Reviewer Review Type Date Requested Status
Tim Bentley Approve
Review via email: mp+86494@code.launchpad.net

Commit message

Fixed bug #907164: Exclude footnotes div and the comment after it.

Description of the change

If one of the verses happens to be the last verse in the chapter, it also includes all the footnotes for the chapter.

To reproduce:
- Import a Bible
- Select Web Download
- Select BibleGateway and NIV 1984
- Register Bible
- Search for Isaiah 53:12
- See footnotes in text

To post a comment you must log in.
Revision history for this message
Tim Bentley (trb143) :
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 2011-10-03 20:26:51 +0000
3+++ openlp/plugins/bibles/lib/http.py 2011-12-21 05:27:26 +0000
4@@ -92,6 +92,15 @@
5 if headings:
6 for heading in headings:
7 heading.extract()
8+ chapter_notes = soup.findAll('div', 'footnotes')
9+ if chapter_notes:
10+ log.debug('Found chapter notes')
11+ for note in chapter_notes:
12+ note.extract()
13+ note_comments = soup.findAll(text=u'end of footnotes')
14+ if note_comments:
15+ for comment in note_comments:
16+ comment.extract()
17 cleanup = [(re.compile('\s+'), lambda match: ' ')]
18 verses = BeautifulSoup(str(soup), markupMassage=cleanup)
19 verse_list = {}