Browse Source

Rename cwd to cd

pull/207/head
Oliverpool 8 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 - sort
- section* - section*
- cwd - cd
# Parsers # 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 This function adds 'path' to the directories where songs are searched
for, and then processes the content. for, and then processes the content.
The 'path' is added: The 'path' is added as a relative path to every path already present in
- first as a relative path to the *.yaml file directory; config['songdir'] (which are 'songs' dir inside the datadirs).
- then as a relative path to every path already present in
config['songdir'] (which are 'song' dir inside the datadirs).
""" """
subpath = argument['path'] subpath = argument['path']
old_songdir = config['_songdir'] old_songdir = config['_songdir']
config['_songdir'] = [path.clone().join(subpath) for path in 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) processed_content = process_content(argument.get('content'), config)
config['_songdir'] = old_songdir config['_songdir'] = old_songdir
return processed_content 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 path: subdir
content: content:

2
test/test_content/cwd_list.source

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

4
test/test_content/sort.source

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

8
test/test_songbook/content.yaml

@ -11,14 +11,14 @@ content:
- section: Test of section - section: Test of section
- sort: - sort:
- songsection: Test of song section - songsection: Test of song section
- cwd: - cd:
# relative to yaml songfile # relative to yaml songfile
path: content_datadir/content path: /content_datadir/content
content: content:
- "song.csg" - "song.csg"
- "song.tsg" - "song.tsg"
- cwd: - cd:
# relative to datadir # relative to datadir 'songs' dir
path: ../content path: ../content
content: content:
- tex: foo.tex - tex: foo.tex

4
test/test_songbook/onthefly/content.onthefly.yaml

@ -11,8 +11,8 @@ content:
- section: Test of section - section: Test of section
- sort: - sort:
- songsection: Test of song section - songsection: Test of song section
- cwd: - cd:
# relative to datadir 'song' dir # relative to datadir 'songs' dir
path: ../content path: ../content
content: content:
- tex: foo.tex - tex: foo.tex

Loading…
Cancel
Save