From 5df09d17440594cc621ebf49dc3dc6bc59462a28 Mon Sep 17 00:00:00 2001 From: Louis Date: Mon, 1 Feb 2016 22:09:05 +0100 Subject: [PATCH] Rename 'sorted' keyword to 'sort' --- examples/example-all.sb | 2 +- examples/example-all.yaml.sb | 2 +- patacrep/content/__init__.py | 8 +++--- patacrep/content/{sorted.py => sort.py} | 6 ++--- .../datadir/songs/custom_list.yaml | 2 +- .../path1_title1_author1.csg | 0 .../path1_title1_author2.csg | 0 .../path1_title2_author1.csg | 0 .../path1_title2_author2.csg | 0 .../path2_title1_author1.csg | 0 .../path2_title1_author2.csg | 0 .../path2_title2_author1.csg | 0 .../path2_title2_author2.csg | 0 test/test_content/sort.control | 27 +++++++++++++++++++ .../{sorted.source => sort.source} | 8 +++--- test/test_content/sorted.control | 27 ------------------- test/test_songbook/content.sb | 4 +-- 17 files changed, 43 insertions(+), 43 deletions(-) rename patacrep/content/{sorted.py => sort.py} (95%) rename test/test_content/{datadir_sorted => datadir_sort}/path1_title1_author1.csg (100%) rename test/test_content/{datadir_sorted => datadir_sort}/path1_title1_author2.csg (100%) rename test/test_content/{datadir_sorted => datadir_sort}/path1_title2_author1.csg (100%) rename test/test_content/{datadir_sorted => datadir_sort}/path1_title2_author2.csg (100%) rename test/test_content/{datadir_sorted => datadir_sort}/path2_title1_author1.csg (100%) rename test/test_content/{datadir_sorted => datadir_sort}/path2_title1_author2.csg (100%) rename test/test_content/{datadir_sorted => datadir_sort}/path2_title2_author1.csg (100%) rename test/test_content/{datadir_sorted => datadir_sort}/path2_title2_author2.csg (100%) create mode 100644 test/test_content/sort.control rename test/test_content/{sorted.source => sort.source} (75%) delete mode 100644 test/test_content/sorted.control diff --git a/examples/example-all.sb b/examples/example-all.sb index 8f5d80a6..8c0639d4 100644 --- a/examples/example-all.sb +++ b/examples/example-all.sb @@ -14,6 +14,6 @@ "sep" : ["and", "et"] }, "datadir" : ".", - "content": [["sorted"]] + "content": [["sort"]] } diff --git a/examples/example-all.yaml.sb b/examples/example-all.yaml.sb index 4933280c..814e8875 100644 --- a/examples/example-all.yaml.sb +++ b/examples/example-all.yaml.sb @@ -13,7 +13,7 @@ authors: separators: - "and" - "et" -content: {"sorted"} +content: {"sort"} template: patacrep.tex: diff --git a/patacrep/content/__init__.py b/patacrep/content/__init__.py index f9c78fd6..9b049a68 100755 --- a/patacrep/content/__init__.py +++ b/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"], diff --git a/patacrep/content/sorted.py b/patacrep/content/sort.py similarity index 95% rename from patacrep/content/sorted.py rename to patacrep/content/sort.py index 452a0c04..b87f251d 100755 --- a/patacrep/content/sorted.py +++ b/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} diff --git a/test/test_content/datadir/songs/custom_list.yaml b/test/test_content/datadir/songs/custom_list.yaml index 5a5cd657..440c12e4 100644 --- a/test/test_content/datadir/songs/custom_list.yaml +++ b/test/test_content/datadir/songs/custom_list.yaml @@ -1,4 +1,4 @@ -- sorted: +- sort: key: "title" content: - exsong.sg diff --git a/test/test_content/datadir_sorted/path1_title1_author1.csg b/test/test_content/datadir_sort/path1_title1_author1.csg similarity index 100% rename from test/test_content/datadir_sorted/path1_title1_author1.csg rename to test/test_content/datadir_sort/path1_title1_author1.csg diff --git a/test/test_content/datadir_sorted/path1_title1_author2.csg b/test/test_content/datadir_sort/path1_title1_author2.csg similarity index 100% rename from test/test_content/datadir_sorted/path1_title1_author2.csg rename to test/test_content/datadir_sort/path1_title1_author2.csg diff --git a/test/test_content/datadir_sorted/path1_title2_author1.csg b/test/test_content/datadir_sort/path1_title2_author1.csg similarity index 100% rename from test/test_content/datadir_sorted/path1_title2_author1.csg rename to test/test_content/datadir_sort/path1_title2_author1.csg diff --git a/test/test_content/datadir_sorted/path1_title2_author2.csg b/test/test_content/datadir_sort/path1_title2_author2.csg similarity index 100% rename from test/test_content/datadir_sorted/path1_title2_author2.csg rename to test/test_content/datadir_sort/path1_title2_author2.csg diff --git a/test/test_content/datadir_sorted/path2_title1_author1.csg b/test/test_content/datadir_sort/path2_title1_author1.csg similarity index 100% rename from test/test_content/datadir_sorted/path2_title1_author1.csg rename to test/test_content/datadir_sort/path2_title1_author1.csg diff --git a/test/test_content/datadir_sorted/path2_title1_author2.csg b/test/test_content/datadir_sort/path2_title1_author2.csg similarity index 100% rename from test/test_content/datadir_sorted/path2_title1_author2.csg rename to test/test_content/datadir_sort/path2_title1_author2.csg diff --git a/test/test_content/datadir_sorted/path2_title2_author1.csg b/test/test_content/datadir_sort/path2_title2_author1.csg similarity index 100% rename from test/test_content/datadir_sorted/path2_title2_author1.csg rename to test/test_content/datadir_sort/path2_title2_author1.csg diff --git a/test/test_content/datadir_sorted/path2_title2_author2.csg b/test/test_content/datadir_sort/path2_title2_author2.csg similarity index 100% rename from test/test_content/datadir_sorted/path2_title2_author2.csg rename to test/test_content/datadir_sort/path2_title2_author2.csg diff --git a/test/test_content/sort.control b/test/test_content/sort.control new file mode 100644 index 00000000..a7430273 --- /dev/null +++ b/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" diff --git a/test/test_content/sorted.source b/test/test_content/sort.source similarity index 75% rename from test/test_content/sorted.source rename to test/test_content/sort.source index b3fedbab..0e6d71da 100644 --- a/test/test_content/sorted.source +++ b/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] diff --git a/test/test_content/sorted.control b/test/test_content/sorted.control deleted file mode 100644 index 76558cf9..00000000 --- a/test/test_content/sorted.control +++ /dev/null @@ -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" diff --git a/test/test_songbook/content.sb b/test/test_songbook/content.sb index 69961d20..19fe515a 100644 --- a/test/test_songbook/content.sb +++ b/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 \ No newline at end of file + - include: include.sbc