Browse Source

Rename cwd to cd

pull/207/head
Oliverpool 9 years ago
parent
commit
b5c7425ed6
  1. 2
      patacrep/content/__init__.py
  2. 10
      patacrep/content/cd.py
  3. 2
      test/test_content/cwd.source
  4. 2
      test/test_content/cwd_list.source
  5. 4
      test/test_content/sort.source
  6. 8
      test/test_songbook/content.yaml
  7. 4
      test/test_songbook/onthefly/content.onthefly.yaml

2
patacrep/content/__init__.py

@ -21,7 +21,7 @@ met, the corresponding parser is called.
- sort
- section*
- cwd
- cd
# Parsers

10
patacrep/content/cwd.py → 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}

2
test/test_content/cwd.source

@ -1,3 +1,3 @@
- cwd:
- cd:
path: subdir
content:

2
test/test_content/cwd_list.source

@ -1,4 +1,4 @@
- cwd:
- cd:
path: subdir
content:
- "exsong.sg"

4
test/test_content/sort.source

@ -1,5 +1,5 @@
- cwd:
path: "datadir_sort"
- cd:
path: "../../datadir_sort"
content:
- section:
name: "Title"

8
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

4
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

Loading…
Cancel
Save