Skip to content
Permalink
Browse files

Fix pyphen graceful degradation and en dictionary

Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Jul 2, 2016
1 parent 7245ff5 commit f98b90d187738972030861278983295f04bfbe70
Showing with 5 additions and 1 deletion.
  1. +2 −0 CHANGES.txt
  2. +1 −1 nikola/nikola.py
  3. +2 −0 nikola/post.py
@@ -11,6 +11,8 @@ Features
Bugfixes
--------

* 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))
else:
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.
You can’t perform that action at this time.