Browse Source

include is now in yaml

pull/190/head
Oliverpool 9 years ago
parent
commit
2a421fba77
  1. 12
      patacrep/content/include.py
  2. 2
      test/test_content/include.control
  3. 4
      test/test_content/include.source
  4. 2
      test/test_songbook/content.sb

12
patacrep/content/include.py

@ -28,18 +28,22 @@ def load_from_datadirs(path, datadirs):
)
#pylint: disable=unused-argument
def parse(keyword, config, argument, contentlist):
def parse(keyword, config, argument):
"""Include an external file content.
Arguments:
- keyword: the string 'include';
- config: the current songbook configuration dictionary;
- argument: None;
- contentlist: a list of file paths to be included.
- argument:
a list of file paths to be included
or a string of the file to include
"""
new_contentlist = ContentList()
if isinstance(argument, str):
argument = [argument]
for path in contentlist:
for path in argument:
try:
filepath = load_from_datadirs(path, config['_datadir'])
except ContentError as error:

2
test/test_content/include.control

@ -1 +1 @@
["exsong.sg", "chordpro.csg", "subdir/chordpro.csg"]
["exsong.sg", "chordpro.csg", "subdir/chordpro.csg", "exsong.sg", "chordpro.csg", "subdir/chordpro.csg"]

4
test/test_content/include.source

@ -1 +1,3 @@
[["include" , "custom_list.json"]]
- include:
- custom_list.json
- include: custom_list.json

2
test/test_songbook/content.sb

@ -16,4 +16,4 @@ content:
- "song.csg"
- "song.tsg"
- ["tex", "foo.tex"]
- ["include", "include.sbc"]
- include: include.sbc
Loading…
Cancel
Save