Skip to content
Permalink
Browse files

Merge branch 'master' into toml-metadata

  • Loading branch information...
ralsina committed May 28, 2017
2 parents 2948013 + 18a4c67 commit 99be63ca8417d9cc54ee08180712966cd14ce9ff
Showing with 5 additions and 2 deletions.
  1. +1 −0 CHANGES.txt
  2. +1 −1 docs/manual.txt
  3. +3 −1 nikola/utils.py
@@ -4,6 +4,7 @@ New in master
Features
--------


* Support for YAML and TOML metadata (Issue #2801)

New in v7.8.6
@@ -302,7 +302,7 @@ YAML metadata should be wrapped by a "---" separator and in that case, the usual
date: 2012-09-15 19:52:05 UTC
---

TOML metadata should be wrapped by a "---" separator and in that case, the usual TOML syntax is used:
TOML metadata should be wrapped by a "+++" separator and in that case, the usual TOML syntax is used:

.. code:: yaml

@@ -2050,8 +2050,10 @@ def load_data(path):
"""Given path to a file, load data from it."""
ext = os.path.splitext(path)[-1]
loader = None
function = 'load'
if ext in {'.yml', '.yaml'}:
loader = yaml
function = 'safe_load'
if yaml is None:
req_missing(['yaml'], 'use YAML data files')
return {}
@@ -2065,7 +2067,7 @@ def load_data(path):
if loader is None:
return
with io.open(path, 'r', encoding='utf8') as inf:
return loader.load(inf)
return getattr(loader, function)(inf)


# see http://stackoverflow.com/a/2087433

0 comments on commit 99be63c

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