diff --git a/patacrep/content/__init__.py b/patacrep/content/__init__.py index 1604204b..a65b0525 100755 --- a/patacrep/content/__init__.py +++ b/patacrep/content/__init__.py @@ -21,7 +21,7 @@ met, the corresponding parser is called. - sort - section* - - cwd + - cd # Parsers diff --git a/patacrep/content/cwd.py b/patacrep/content/cd.py similarity index 74% rename from patacrep/content/cwd.py rename to patacrep/content/cd.py index 7efee676..418a111f 100755 --- a/patacrep/content/cwd.py +++ b/patacrep/content/cd.py @@ -25,20 +25,16 @@ def parse(keyword, config, argument): This function adds 'path' to the directories where songs are searched for, and then processes the content. - The 'path' is added: - - first as a relative path to the *.yaml file directory; - - then as a relative path to every path already present in - config['songdir'] (which are 'song' dir inside the datadirs). + The 'path' is added as a relative path to every path already present in + config['songdir'] (which are 'songs' dir inside the datadirs). """ subpath = argument['path'] old_songdir = config['_songdir'] config['_songdir'] = [path.clone().join(subpath) for path in config['_songdir']] - if '_songbookfile_dir' in config: - config['_songdir'].insert(0, DataSubpath(config['_songbookfile_dir'], subpath)) processed_content = process_content(argument.get('content'), config) config['_songdir'] = old_songdir return processed_content -CONTENT_PLUGINS = {'cwd': parse} +CONTENT_PLUGINS = {'cd': parse} diff --git a/test/test_content/cwd.source b/test/test_content/cwd.source index 1d0663d7..b1cc6e36 100644 --- a/test/test_content/cwd.source +++ b/test/test_content/cwd.source @@ -1,3 +1,3 @@ -- cwd: +- cd: path: subdir content: \ No newline at end of file diff --git a/test/test_content/cwd_list.source b/test/test_content/cwd_list.source index 15f85307..e95ae6ab 100644 --- a/test/test_content/cwd_list.source +++ b/test/test_content/cwd_list.source @@ -1,4 +1,4 @@ -- cwd: +- cd: path: subdir content: - "exsong.sg" diff --git a/test/test_content/sort.source b/test/test_content/sort.source index 0e6d71da..2a1b19af 100644 --- a/test/test_content/sort.source +++ b/test/test_content/sort.source @@ -1,5 +1,5 @@ -- cwd: - path: "datadir_sort" +- cd: + path: "../../datadir_sort" content: - section: name: "Title" diff --git a/test/test_songbook/content.yaml b/test/test_songbook/content.yaml index 15b06a91..e4552f92 100644 --- a/test/test_songbook/content.yaml +++ b/test/test_songbook/content.yaml @@ -11,14 +11,14 @@ content: - section: Test of section - sort: - songsection: Test of song section - - cwd: + - cd: # relative to yaml songfile - path: content_datadir/content + path: /content_datadir/content content: - "song.csg" - "song.tsg" - - cwd: - # relative to datadir + - cd: + # relative to datadir 'songs' dir path: ../content content: - tex: foo.tex diff --git a/test/test_songbook/onthefly/content.onthefly.yaml b/test/test_songbook/onthefly/content.onthefly.yaml index 3d5b585f..bb7ae271 100644 --- a/test/test_songbook/onthefly/content.onthefly.yaml +++ b/test/test_songbook/onthefly/content.onthefly.yaml @@ -11,8 +11,8 @@ content: - section: Test of section - sort: - songsection: Test of song section - - cwd: - # relative to datadir 'song' dir + - cd: + # relative to datadir 'songs' dir path: ../content content: - tex: foo.tex