Skip to content

Commit

Permalink
Skip more tags when hyphenating
Browse files Browse the repository at this point in the history
  • Loading branch information
da2x committed May 14, 2015
1 parent 691fc61 commit 7d1d7fd
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions nikola/post.py
Expand Up @@ -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
else:
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

Expand Down

0 comments on commit 7d1d7fd

Please sign in to comment.