← Back to team overview

openlp-core team mailing list archive

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

 

Raoul Snyman has proposed merging lp:~raoul-snyman/openlp/bug-907164 into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)
Related bugs:
  Bug #907164 in OpenLP: "Unwanted Footnotes in Web Download Bible from Bible Gateway"
  https://bugs.launchpad.net/openlp/+bug/907164

For more details, see:
https://code.launchpad.net/~raoul-snyman/openlp/bug-907164/+merge/86494

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
-- 
https://code.launchpad.net/~raoul-snyman/openlp/bug-907164/+merge/86494
Your team OpenLP Core is requested to review the proposed merge of lp:~raoul-snyman/openlp/bug-907164 into lp:openlp.
=== modified file 'openlp/plugins/bibles/lib/http.py'
--- openlp/plugins/bibles/lib/http.py	2011-10-03 20:26:51 +0000
+++ openlp/plugins/bibles/lib/http.py	2011-12-21 05:27:26 +0000
@@ -92,6 +92,15 @@
         if headings:
             for heading in headings:
                 heading.extract()
+        chapter_notes = soup.findAll('div', 'footnotes')
+        if chapter_notes:
+            log.debug('Found chapter notes')
+            for note in chapter_notes:
+                note.extract()
+        note_comments = soup.findAll(text=u'end of footnotes')
+        if note_comments:
+            for comment in note_comments:
+                comment.extract()
         cleanup = [(re.compile('\s+'), lambda match: ' ')]
         verses = BeautifulSoup(str(soup), markupMassage=cleanup)
         verse_list = {}


Follow ups