Merge remote-tracking branch 'upstream/master'

This commit is contained in:
kerobaros 2014-10-24 23:41:56 -05:00
commit 81b513c720
2 changed files with 6 additions and 1 deletions

View file

@ -335,8 +335,8 @@ def _scrape_strip_cruft(html, plain_text_out=False):
html = re.sub(r'<(script).*?</\1>(?s)', '', html) # Strip script tags.
if plain_text_out: # Strip remaining HTML tags
html = TAG_RE.sub('', html)
html = COMMENT_RE.sub('', html)
html = TAG_RE.sub('', html)
# Strip lines
html = '\n'.join([x.strip() for x in html.strip().split('\n')])

View file

@ -148,6 +148,11 @@ class LyricsPluginTest(unittest.TestCase):
self.assertEqual(lyrics._scrape_strip_cruft(text, True),
"foobaz")
def test_scrape_strip_tag_in_comment(self):
text = u"""foo<!--<bar>-->qux"""
self.assertEqual(lyrics._scrape_strip_cruft(text, True),
"fooqux")
def test_scrape_merge_paragraphs(self):
text = u"one</p> <p class='myclass'>two</p><p>three"
self.assertEqual(lyrics._scrape_merge_paragraphs(text),