From 15e4a578ce758140740f83c61fec00c9841a6b50 Mon Sep 17 00:00:00 2001 From: Oliverpool Date: Tue, 12 Jan 2016 13:18:34 +0100 Subject: [PATCH] songsection is now yaml compatible --- patacrep/content/songsection.py | 15 +++------------ test/test_content/songsection.source | 12 ++++++------ test/test_songbook/content.sb | 2 +- 3 files changed, 10 insertions(+), 19 deletions(-) diff --git a/patacrep/content/songsection.py b/patacrep/content/songsection.py index c5fea4ab..6572cc66 100755 --- a/patacrep/content/songsection.py +++ b/patacrep/content/songsection.py @@ -20,24 +20,15 @@ class SongSection(ContentItem): return r'\{}{{{}}}'.format(self.keyword, self.name) #pylint: disable=unused-argument -def parse(keyword, argument, contentlist, config): +def parse(keyword, argument, config): """Parse the contentlist. Arguments: - keyword ("songsection" or "songchapter"): the section to use; - - argument: unused; - - contentlist: a list of one string, which is the name of the section; + - argument: name of the section; - config: configuration dictionary of the current songbook. """ - try: - if (keyword not in KEYWORDS) and (len(contentlist) != 1): - raise ContentError( - keyword, - "Starred section names must have exactly one argument.", - ) - return ContentList([SongSection(keyword, contentlist[0])]) - except ContentError as error: - return EmptyContentList(errors=[error]) + return ContentList([SongSection(keyword, argument)]) CONTENT_PLUGINS = dict([ diff --git a/test/test_content/songsection.source b/test/test_content/songsection.source index 089322c4..f4540159 100644 --- a/test/test_content/songsection.source +++ b/test/test_content/songsection.source @@ -1,6 +1,6 @@ -[["songsection", "Traditional"], - "exsong.sg", - ["songchapter", "English"], - "texsong.tsg", - "chordpro.csg", - "exsong.sg"] \ No newline at end of file +- songsection: Traditional +- "exsong.sg" +- songchapter: English +- "texsong.tsg" +- "chordpro.csg" +- "exsong.sg" \ No newline at end of file diff --git a/test/test_songbook/content.sb b/test/test_songbook/content.sb index d012cd0d..1aa5b0f7 100644 --- a/test/test_songbook/content.sb +++ b/test/test_songbook/content.sb @@ -9,7 +9,7 @@ chords: content: - section: Test of section - ["sorted"] - - ["songsection", "Test of song section"] + - songsection: Test of song section - ["cwd(content_datadir/content)", "song.csg", "song.tsg", ["tex", "foo.tex"]