Skip to content
Browse files
Skip more tags when hyphenating
  • Loading branch information
da2x committed May 14, 2015
1 parent 691fc61 commit 7d1d7fd5fd361c516291de38a0cba65954fd1607
Showing 1 changed file with 7 additions and 7 deletions.
@@ -1001,15 +1001,15 @@ def hyphenate(dom, _lang):
LOGGER.error("Pyphen cannot be installed to ~/.local (pip install --user).")
for tag in ('p', 'li', 'span'):
for node in dom.xpath("//%s[not(parent::pre)]" % tag):
math_found = False
skip_node = False
skippable_nodes = ['kbd', 'code', 'samp', 'mark', 'math', 'data', 'ruby', 'svg']
if node.getchildren():
for child in node.getchildren():
if child.tag == 'span' and 'math' in child.get('class', []):
math_found = True
if 'math' in node.get('class', []):
math_found = True
if not math_found:
if child.tag in skippable_nodes or (child.tag == 'span' and 'math' in child.get('class', [])):
skip_node = True
elif 'math' in node.get('class', []):
skip_node = True
if not skip_node:
insert_hyphens(node, hyphenator)
return dom

0 comments on commit 7d1d7fd

Please sign in to comment.