Browse Source

Rename 'sorted' keyword to 'sort'

pull/190/head
Louis 9 years ago
parent
commit
5df09d1744
  1. 2
      examples/example-all.sb
  2. 2
      examples/example-all.yaml.sb
  3. 8
      patacrep/content/__init__.py
  4. 6
      patacrep/content/sort.py
  5. 2
      test/test_content/datadir/songs/custom_list.yaml
  6. 0
      test/test_content/datadir_sort/path1_title1_author1.csg
  7. 0
      test/test_content/datadir_sort/path1_title1_author2.csg
  8. 0
      test/test_content/datadir_sort/path1_title2_author1.csg
  9. 0
      test/test_content/datadir_sort/path1_title2_author2.csg
  10. 0
      test/test_content/datadir_sort/path2_title1_author1.csg
  11. 0
      test/test_content/datadir_sort/path2_title1_author2.csg
  12. 0
      test/test_content/datadir_sort/path2_title2_author1.csg
  13. 0
      test/test_content/datadir_sort/path2_title2_author2.csg
  14. 27
      test/test_content/sort.control
  15. 8
      test/test_content/sort.source
  16. 27
      test/test_content/sorted.control
  17. 4
      test/test_songbook/content.sb

2
examples/example-all.sb

@ -14,6 +14,6 @@
"sep" : ["and", "et"]
},
"datadir" : ".",
"content": [["sorted"]]
"content": [["sort"]]
}

2
examples/example-all.yaml.sb

@ -13,7 +13,7 @@ authors:
separators:
- "and"
- "et"
content: {"sorted"}
content: {"sort"}
template:
patacrep.tex:

8
patacrep/content/__init__.py

@ -19,7 +19,7 @@ met, the corresponding parser is called.
# Keyword examples
- sorted
- sort
- section*
- cwd
@ -35,14 +35,14 @@ A parser returns a ContentList object (a list of instances of the ContentItem
class), defined in this module (or of subclasses of this class).
Example: When the following piece of content is met
sorted:
sort:
key: ["author", "title"]
content:
- "a_song.sg"
- "another_song.sg"
the parser associated to keyword 'sorted' get the arguments:
- keyword = "sorted"
the parser associated to keyword 'sort' get the arguments:
- keyword = "sort"
- argument = {
'key': ["author", "title"],
'content': ["a_song.sg", "another_song.sg"],

6
patacrep/content/sorted.py → patacrep/content/sort.py

@ -1,6 +1,6 @@
"""Sorted list of songs.
This plugin provides keyword 'sorted', used to include a sorted list of songs
This plugin provides keyword 'sort', used to include a sorted list of songs
to a songbook.
"""
@ -85,7 +85,7 @@ def parse(keyword, config, argument):
"""Return a sorted list of songs.
Arguments:
- keyword: the string 'sorted';
- keyword: the string 'sort';
- config: the current songbook configuration dictionary;
- argument: a dict of:
key: the list of the fields used to sort songs (e.g. "by", "album", "title")
@ -108,4 +108,4 @@ def parse(keyword, config, argument):
))
return sorted(songlist, key=key_generator(sort))
CONTENT_PLUGINS = {'sorted': parse}
CONTENT_PLUGINS = {'sort': parse}

2
test/test_content/datadir/songs/custom_list.yaml

@ -1,4 +1,4 @@
- sorted:
- sort:
key: "title"
content:
- exsong.sg

0
test/test_content/datadir_sorted/path1_title1_author1.csg → test/test_content/datadir_sort/path1_title1_author1.csg

0
test/test_content/datadir_sorted/path1_title1_author2.csg → test/test_content/datadir_sort/path1_title1_author2.csg

0
test/test_content/datadir_sorted/path1_title2_author1.csg → test/test_content/datadir_sort/path1_title2_author1.csg

0
test/test_content/datadir_sorted/path1_title2_author2.csg → test/test_content/datadir_sort/path1_title2_author2.csg

0
test/test_content/datadir_sorted/path2_title1_author1.csg → test/test_content/datadir_sort/path2_title1_author1.csg

0
test/test_content/datadir_sorted/path2_title1_author2.csg → test/test_content/datadir_sort/path2_title1_author2.csg

0
test/test_content/datadir_sorted/path2_title2_author1.csg → test/test_content/datadir_sort/path2_title2_author1.csg

0
test/test_content/datadir_sorted/path2_title2_author2.csg → test/test_content/datadir_sort/path2_title2_author2.csg

27
test/test_content/sort.control

@ -0,0 +1,27 @@
- section{Title}
- "@TEST_FOLDER@/datadir_sort/path1_title1_author1.csg"
- "@TEST_FOLDER@/datadir_sort/path1_title1_author2.csg"
- "@TEST_FOLDER@/datadir_sort/path2_title1_author1.csg"
- "@TEST_FOLDER@/datadir_sort/path2_title1_author2.csg"
- "@TEST_FOLDER@/datadir_sort/path1_title2_author1.csg"
- "@TEST_FOLDER@/datadir_sort/path1_title2_author2.csg"
- "@TEST_FOLDER@/datadir_sort/path2_title2_author1.csg"
- "@TEST_FOLDER@/datadir_sort/path2_title2_author2.csg"
- section{Author, Title}
- "@TEST_FOLDER@/datadir_sort/path1_title1_author1.csg"
- "@TEST_FOLDER@/datadir_sort/path2_title1_author1.csg"
- "@TEST_FOLDER@/datadir_sort/path1_title2_author1.csg"
- "@TEST_FOLDER@/datadir_sort/path2_title2_author1.csg"
- "@TEST_FOLDER@/datadir_sort/path1_title1_author2.csg"
- "@TEST_FOLDER@/datadir_sort/path2_title1_author2.csg"
- "@TEST_FOLDER@/datadir_sort/path1_title2_author2.csg"
- "@TEST_FOLDER@/datadir_sort/path2_title2_author2.csg"
- section{Path, Title}
- "@TEST_FOLDER@/datadir_sort/path1_title1_author1.csg"
- "@TEST_FOLDER@/datadir_sort/path1_title1_author2.csg"
- "@TEST_FOLDER@/datadir_sort/path1_title2_author1.csg"
- "@TEST_FOLDER@/datadir_sort/path1_title2_author2.csg"
- "@TEST_FOLDER@/datadir_sort/path2_title1_author1.csg"
- "@TEST_FOLDER@/datadir_sort/path2_title1_author2.csg"
- "@TEST_FOLDER@/datadir_sort/path2_title2_author1.csg"
- "@TEST_FOLDER@/datadir_sort/path2_title2_author2.csg"

8
test/test_content/sorted.source → test/test_content/sort.source

@ -1,15 +1,15 @@
- cwd:
path: "datadir_sorted"
path: "datadir_sort"
content:
- section:
name: "Title"
- sorted:
- sort:
key: title
- section:
name: "Author, Title"
- sorted:
- sort:
key: [by, title]
- section:
name: "Path, Title"
- sorted:
- sort:
key: [path, title]

27
test/test_content/sorted.control

@ -1,27 +0,0 @@
- section{Title}
- "@TEST_FOLDER@/datadir_sorted/path1_title1_author1.csg"
- "@TEST_FOLDER@/datadir_sorted/path1_title1_author2.csg"
- "@TEST_FOLDER@/datadir_sorted/path2_title1_author1.csg"
- "@TEST_FOLDER@/datadir_sorted/path2_title1_author2.csg"
- "@TEST_FOLDER@/datadir_sorted/path1_title2_author1.csg"
- "@TEST_FOLDER@/datadir_sorted/path1_title2_author2.csg"
- "@TEST_FOLDER@/datadir_sorted/path2_title2_author1.csg"
- "@TEST_FOLDER@/datadir_sorted/path2_title2_author2.csg"
- section{Author, Title}
- "@TEST_FOLDER@/datadir_sorted/path1_title1_author1.csg"
- "@TEST_FOLDER@/datadir_sorted/path2_title1_author1.csg"
- "@TEST_FOLDER@/datadir_sorted/path1_title2_author1.csg"
- "@TEST_FOLDER@/datadir_sorted/path2_title2_author1.csg"
- "@TEST_FOLDER@/datadir_sorted/path1_title1_author2.csg"
- "@TEST_FOLDER@/datadir_sorted/path2_title1_author2.csg"
- "@TEST_FOLDER@/datadir_sorted/path1_title2_author2.csg"
- "@TEST_FOLDER@/datadir_sorted/path2_title2_author2.csg"
- section{Path, Title}
- "@TEST_FOLDER@/datadir_sorted/path1_title1_author1.csg"
- "@TEST_FOLDER@/datadir_sorted/path1_title1_author2.csg"
- "@TEST_FOLDER@/datadir_sorted/path1_title2_author1.csg"
- "@TEST_FOLDER@/datadir_sorted/path1_title2_author2.csg"
- "@TEST_FOLDER@/datadir_sorted/path2_title1_author1.csg"
- "@TEST_FOLDER@/datadir_sorted/path2_title1_author2.csg"
- "@TEST_FOLDER@/datadir_sorted/path2_title2_author1.csg"
- "@TEST_FOLDER@/datadir_sorted/path2_title2_author2.csg"

4
test/test_songbook/content.sb

@ -9,7 +9,7 @@ chords:
content:
- section: Test of section
- sorted:
- sort:
- songsection: Test of song section
- cwd:
# relative to sg file
@ -22,4 +22,4 @@ content:
path: ../content
content:
- tex: foo.tex
- include: include.sbc
- include: include.sbc

Loading…
Cancel
Save