Permalink
Browse files

Merge 3c85db8 into c3dd139

  • Loading branch information...
tom-mi committed Dec 11, 2016
2 parents c3dd139 + 3c85db8 commit 79453212e6a3d45541e4354b9f9659e6ff3a64ef
Showing with 16 additions and 1 deletion.
  1. +5 −1 softhyphen/html.py
  2. +11 −0 softhyphen/tests.py
@@ -66,7 +66,7 @@ def hyphenate(html, language=None, hyphenator=None, blacklist_tags=(
# Recursively hyphenate each element
hyphenate_element(soup, hyphenator, blacklist_tags)
return six.text_type(soup)
return fix_linebreaks(six.text_type(soup))
# Constants
@@ -151,6 +151,10 @@ def get_hyphenator_for_language(language):
return Hyphenator(path)
def fix_linebreaks(html):
return html.replace('</br>', '')
# Test when standalone
def _test():
"""Run doctests"""
@@ -102,3 +102,14 @@ def test_russian_filter(self):
after,
six.u('<h1>\u043f\u0435&shy;\u0440\u0435.</h1>')
)
def test_linebreak_fix(self):
'''
Test that <br> tags are handled correctly.
'''
before = six.u('<p>Breaking<br>changes</p>')
after = hyphenate(before)
self.failUnlessEqual(
after,
six.u('<p>Break&shy;ing<br>changes</p>')
)

0 comments on commit 7945321

Please sign in to comment.