Skip to content
Permalink
Browse files

Unicode ``nikola init`` output (via #1644)

Requires UTF-8 input on Python 2.

Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Mar 31, 2015
1 parent e30f892 commit fb3a7dbaa1d5eb9bc1e094f5214f15e97c8e4f61
Showing with 7 additions and 2 deletions.
  1. +1 −0 CHANGES.txt
  2. +6 −2 nikola/plugins/command/init.py
@@ -4,6 +4,7 @@ New in master
Features
--------

* Produce Unicode output in ``nikola init`` (via Issue #1644)
* Add ``HIDDEN_TAGS`` and ``HIDDEN_CATEGORIES`` settings to hide some
tags and categories (eg. ``mathjax``) from view (Issue #1640)
* Instruct browsers to prefetch newest post when visiting the front page
@@ -188,7 +188,7 @@ def get_msg(lang):
pairs.append(f.format('DEFAULT_LANG', '', get_msg(default_lang)))

for l in additional_languages:
pairs.append(f.format(json.dumps(l), '/' + l, get_msg(l)))
pairs.append(f.format(json.dumps(l, ensure_ascii=False), '/' + l, get_msg(l)))

return u'{{\n{0}\n}}'.format('\n\n'.join(pairs))

@@ -198,7 +198,7 @@ def get_msg(lang):
def prepare_config(config):
"""Parse sample config with JSON."""
p = config.copy()
p.update(dict((k, json.dumps(v)) for k, v in p.items()
p.update(dict((k, json.dumps(v, ensure_ascii=False)) for k, v in p.items()
if k not in ('POSTS', 'PAGES', 'COMPILERS', 'TRANSLATIONS', 'NAVIGATION_LINKS', '_SUPPORTED_LANGUAGES', '_SUPPORTED_COMMENT_SYSTEMS', 'INDEX_READ_MORE_LINK', 'RSS_READ_MORE_LINK')))
# READ_MORE_LINKs require some special treatment.
p['INDEX_READ_MORE_LINK'] = "'" + p['INDEX_READ_MORE_LINK'].replace("'", "\\'") + "'"
@@ -399,6 +399,10 @@ def chandler(default, toconf):
query(default, toconf)
else:
answer = ask(query, default)
try:
answer = answer.decode('utf-8')
except (AttributeError, UnicodeDecodeError):
pass
if toconf:
SAMPLE_CONF[destination] = answer
if destination == '!target':

0 comments on commit fb3a7db

Please sign in to comment.
You can’t perform that action at this time.