more clean ups

This commit is contained in:
Andreas Preikschat 2011-10-03 22:26:51 +02:00
parent d3bfffa4b1
commit 91c20c4271
2 changed files with 8 additions and 4 deletions

View File

@ -82,13 +82,16 @@ class BGExtract(object):
Receiver.send_message(u'openlp_process_events') Receiver.send_message(u'openlp_process_events')
footnotes = soup.findAll(u'sup', u'footnote') footnotes = soup.findAll(u'sup', u'footnote')
if footnotes: if footnotes:
[footnote.extract() for footnote in footnotes] for footnote in footnotes:
footnote.extract()
crossrefs = soup.findAll(u'sup', u'xref') crossrefs = soup.findAll(u'sup', u'xref')
if crossrefs: if crossrefs:
[crossref.extract() for crossref in crossrefs] for crossref in crossrefs:
crossref.extract()
headings = soup.findAll(u'h5') headings = soup.findAll(u'h5')
if headings: if headings:
[heading.extract() for heading in headings] for heading in headings:
heading.extract()
cleanup = [(re.compile('\s+'), lambda match: ' ')] cleanup = [(re.compile('\s+'), lambda match: ' ')]
verses = BeautifulSoup(str(soup), markupMassage=cleanup) verses = BeautifulSoup(str(soup), markupMassage=cleanup)
verse_list = {} verse_list = {}

View File

@ -333,5 +333,6 @@ class CCLIFileImport(SongImport):
if len(author_list) < 2: if len(author_list) < 2:
author_list = song_author.split(u'|') author_list = song_author.split(u'|')
# Clean spaces before and after author names. # Clean spaces before and after author names.
[self.addAuthor(author_name.strip()) for author_name in author_list] for author_name in author_list:
self.addAuthor(author_name.strip())
return self.finish() return self.finish()