Skip to content

Commit

Permalink
Merge branch 'master' into md-metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
ralsina committed May 29, 2017
2 parents 08da62f + 2623322 commit 08bc2be
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 24 deletions.
7 changes: 6 additions & 1 deletion CHANGES.txt
Expand Up @@ -6,7 +6,12 @@ Features

* Support for Markdown Meta extension for Pelican
compatibility (Issue #1923)
* Support for JSON, YAML and TOML metadata (Issue #2801)
* Support for YAML and TOML metadata (Issue #2801)

Bugfixes
--------

* Fix unbound variable error in locale guessing (Issue #2806)

New in v7.8.6
=============
Expand Down
12 changes: 0 additions & 12 deletions docs/manual.txt
Expand Up @@ -321,18 +321,6 @@ The exact format is described in the `markdown metadata extension docs <https://
slug: how-to-make-money
date: 2012-09-15 19:52:05 UTC

JSON metadata is wrapped in braces and the usual JSON syntax applies. Be careful not to leave any
braces alone in a line other than the last one:

.. code:: json

{
title: "How to make money"
slug: "how-to-make-money"
date: "2012-09-15 19:52:05 UTC"
}


Basic
`````

Expand Down
2 changes: 1 addition & 1 deletion nikola/nikola.py
Expand Up @@ -2823,7 +2823,7 @@ def guess_locale_from_lang_posix(lang):
# only that type is accepted by the locale module
locale_n = str('.'.join(locale.getdefaultlocale()))
except (ValueError, TypeError):
pass
locale_n = str()
# Use guess only if it’s the same language
if not locale_n.startswith(lang.lower()):
locale_n = str()
Expand Down
10 changes: 0 additions & 10 deletions nikola/post.py
Expand Up @@ -1053,16 +1053,6 @@ def _get_metadata_from_file(meta_data):
meta = toml.load('\n'.join(meta_data[1:idx]))
return meta

# If 1st line is '{', then it's JSON metadata
if meta_data[0] == '{':
idx = meta_data.index('}', 1)
meta = json.loads('\n'.join(meta_data[1:idx]))
# We expect empty metadata to be '', not None
for k in meta:
if meta[k] is None:
meta[k] = ''
return meta

# First, get metadata from the beginning of the file,
# up to first empty line

Expand Down

0 comments on commit 08bc2be

Please sign in to comment.