From 9751e1136cac35a4b489f7f9752e4a3394df7bd2 Mon Sep 17 00:00:00 2001 From: Oliverpool Date: Wed, 13 Jan 2016 10:00:41 +0100 Subject: [PATCH] include now supports yaml --- patacrep/content/include.py | 6 +++--- test/test_content/include.control | 4 ++-- test/test_content/include.source | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/patacrep/content/include.py b/patacrep/content/include.py index b469d4d5..275c30ba 100644 --- a/patacrep/content/include.py +++ b/patacrep/content/include.py @@ -1,10 +1,10 @@ """Include an external list of songs This plugin provides keyword 'include', used to include an external list of -songs in JSON format. +songs in JSON or YAML format. """ -import json +import yaml import os import logging @@ -62,7 +62,7 @@ def parse(keyword, config, argument): filepath, encoding=config['book']['encoding'] ) as content_file: - new_content = json.load(content_file) + new_content = yaml.load(content_file) except Exception as error: # pylint: disable=broad-except new_contentlist.append_error(ContentError( keyword="include", diff --git a/test/test_content/include.control b/test/test_content/include.control index 2b4bbab4..6aba97ae 100644 --- a/test/test_content/include.control +++ b/test/test_content/include.control @@ -1,6 +1,6 @@ - exsong.sg - chordpro.csg - subdir/chordpro.csg -- exsong.sg - chordpro.csg -- subdir/chordpro.csg \ No newline at end of file +- subdir/chordpro.csg +- exsong.sg \ No newline at end of file diff --git a/test/test_content/include.source b/test/test_content/include.source index 3a438e2a..d7eb147c 100644 --- a/test/test_content/include.source +++ b/test/test_content/include.source @@ -1,3 +1,3 @@ - include: - custom_list.json -- include: custom_list.json \ No newline at end of file +- include: custom_list.yaml \ No newline at end of file