Skip to content
Browse files
Fix pyphen graceful degradation and en dictionary
Signed-off-by: Chris Warrick <>
  • Loading branch information
Kwpolska committed Jul 2, 2016
1 parent 7245ff5 commit f98b90d187738972030861278983295f04bfbe70
Showing 3 changed files with 5 additions and 1 deletion.
@@ -11,6 +11,8 @@ Features

* Use ``en_US`` dictionary name with pyphen for better compatibility
* Fix graceful degradation if ``pyphen`` lacks dictionaries
* Add horizontal scrollbar to listings (via getnikola/nikola-themes#86)
* Copy files when importing two-file posts instead of reading and
writing (useful for binary formats, eg. docx) (Issue #2380)
@@ -289,7 +289,7 @@
'da': 'da',
'de': 'de',
'el': 'el',
'en': 'en',
'en': 'en_US',
'es': 'es',
'et': 'et',
'fr': 'fr',
@@ -1097,6 +1097,7 @@ def hyphenate(dom, _lang):
lang = LEGAL_VALUES['PYPHEN_LOCALES'].get(_lang, pyphen.language_fallback(_lang))
utils.req_missing(['pyphen'], 'hyphenate texts', optional=True)
hyphenator = None
if pyphen is not None and lang is not None:
# If pyphen does exist, we tell the user when configuring the site.
# If it does not support a language, we ignore it quietly.
@@ -1105,6 +1106,7 @@ def hyphenate(dom, _lang):
except KeyError:
LOGGER.error("Cannot find hyphenation dictoniaries for {0} (from {1}).".format(lang, _lang))
LOGGER.error("Pyphen cannot be installed to ~/.local (pip install --user).")
if hyphenator is not None:
for tag in ('p', 'li', 'span'):
for node in dom.xpath("//%s[not(parent::pre)]" % tag):
skip_node = False

0 comments on commit f98b90d

Please sign in to comment.