From 566b2ee019954bf4207f3b75fc4bd03436b04c73 Mon Sep 17 00:00:00 2001 From: Oliverpool Date: Tue, 12 Jan 2016 13:55:48 +0100 Subject: [PATCH] tex is now in yaml --- patacrep/content/tex.py | 18 +++++++++--------- test/test_content/tex.control | 2 +- test/test_content/tex.source | 5 ++++- test/test_songbook/content.sb | 2 +- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/patacrep/content/tex.py b/patacrep/content/tex.py index dd506655..73221c1b 100755 --- a/patacrep/content/tex.py +++ b/patacrep/content/tex.py @@ -22,26 +22,26 @@ class LaTeX(ContentItem): ))) #pylint: disable=unused-argument -def parse(keyword, argument, contentlist, config): - """Parse the contentlist. +def parse(keyword, argument, config): + """Parse the tex files. Arguments: - keyword: unused; - - argument: unused; - - contentlist: a list of name of tex files; + - argument: + a list of tex files to include + or a string of the tex file to include; - config: configuration dictionary of the current songbook. """ - if not contentlist: - LOGGER.warning( - "Useless 'tex' content: list of files to include is empty." - ) + if isinstance(argument, str): + argument = [argument] + filelist = ContentList() basefolders = itertools.chain( (path.fullpath for path in config['_songdir']), files.iter_datadirs(config['_datadir']), files.iter_datadirs(config['_datadir'], 'latex'), ) - for filename in contentlist: + for filename in argument: checked_file = None for path in basefolders: if os.path.exists(os.path.join(path, filename)): diff --git a/test/test_content/tex.control b/test/test_content/tex.control index 85eeb47e..3aca29e0 100644 --- a/test/test_content/tex.control +++ b/test/test_content/tex.control @@ -1 +1 @@ -["test/test_content/datadir/songs/texfile.tex"] \ No newline at end of file +["test/test_content/datadir/songs/texfile.tex", "test/test_content/datadir/songs/texfile.tex"] \ No newline at end of file diff --git a/test/test_content/tex.source b/test/test_content/tex.source index 56852196..9cbed25b 100644 --- a/test/test_content/tex.source +++ b/test/test_content/tex.source @@ -1 +1,4 @@ -[["tex", "texfile.tex", "chordpro.csg"]] \ No newline at end of file +- tex: + - texfile.tex + - chordpro.csg +- tex: texfile.tex \ No newline at end of file diff --git a/test/test_songbook/content.sb b/test/test_songbook/content.sb index 997c5c0a..2d37d9d0 100644 --- a/test/test_songbook/content.sb +++ b/test/test_songbook/content.sb @@ -15,5 +15,5 @@ content: content: - "song.csg" - "song.tsg" - - ["tex", "foo.tex"] + - tex: foo.tex - include: include.sbc \ No newline at end of file