From 0912eaf0d246a2c392841d2075b025f2ae94b5ff Mon Sep 17 00:00:00 2001 From: Oliverpool Date: Tue, 9 Feb 2016 22:48:50 +0100 Subject: [PATCH] Change sb to yaml extension --- README.rst | 2 +- examples/{example-all.sb => example-all.yaml} | 0 .../{example-all.yaml.sb => example-all.yaml.yaml} | 0 .../{example-crepbook.sb => example-crepbook.yaml} | 0 examples/{example-layout.sb => example-layout.yaml} | 0 examples/{example-songs.sb => example-songs.yaml} | 0 examples/{example-test.sb => example-test.yaml} | 0 examples/{example.sb => example.yaml} | 0 .../{example_encoding.sb => example_encoding.yaml} | 0 patacrep/build.py | 8 ++++---- patacrep/content/__init__.py | 6 +++--- patacrep/content/cwd.py | 2 +- patacrep/songbook/__main__.py | 4 ++-- test/test_content/test_content.py | 2 +- test/test_songbook/{content.sb => content.yaml} | 2 +- test/test_songbook/{datadir.sb => datadir.yaml} | 0 test/test_songbook/{languages.sb => languages.yaml} | 0 test/test_songbook/{syntax.sb => syntax.yaml} | 0 test/test_songbook/test_compilation.py | 10 +++++----- test/test_songbook/{unicode.sb => unicode.yaml} | 0 20 files changed, 18 insertions(+), 18 deletions(-) rename examples/{example-all.sb => example-all.yaml} (100%) rename examples/{example-all.yaml.sb => example-all.yaml.yaml} (100%) rename examples/{example-crepbook.sb => example-crepbook.yaml} (100%) rename examples/{example-layout.sb => example-layout.yaml} (100%) rename examples/{example-songs.sb => example-songs.yaml} (100%) rename examples/{example-test.sb => example-test.yaml} (100%) rename examples/{example.sb => example.yaml} (100%) rename examples/{example_encoding.sb => example_encoding.yaml} (100%) rename test/test_songbook/{content.sb => content.yaml} (92%) rename test/test_songbook/{datadir.sb => datadir.yaml} (100%) rename test/test_songbook/{languages.sb => languages.yaml} (100%) rename test/test_songbook/{syntax.sb => syntax.yaml} (100%) rename test/test_songbook/{unicode.sb => unicode.yaml} (100%) diff --git a/README.rst b/README.rst index da4c1660..b5046dee 100644 --- a/README.rst +++ b/README.rst @@ -55,7 +55,7 @@ Run :: - songbook + songbook Look for existing songbook files in `patadata `_. diff --git a/examples/example-all.sb b/examples/example-all.yaml similarity index 100% rename from examples/example-all.sb rename to examples/example-all.yaml diff --git a/examples/example-all.yaml.sb b/examples/example-all.yaml.yaml similarity index 100% rename from examples/example-all.yaml.sb rename to examples/example-all.yaml.yaml diff --git a/examples/example-crepbook.sb b/examples/example-crepbook.yaml similarity index 100% rename from examples/example-crepbook.sb rename to examples/example-crepbook.yaml diff --git a/examples/example-layout.sb b/examples/example-layout.yaml similarity index 100% rename from examples/example-layout.sb rename to examples/example-layout.yaml diff --git a/examples/example-songs.sb b/examples/example-songs.yaml similarity index 100% rename from examples/example-songs.sb rename to examples/example-songs.yaml diff --git a/examples/example-test.sb b/examples/example-test.yaml similarity index 100% rename from examples/example-test.sb rename to examples/example-test.yaml diff --git a/examples/example.sb b/examples/example.yaml similarity index 100% rename from examples/example.sb rename to examples/example.yaml diff --git a/examples/example_encoding.sb b/examples/example_encoding.yaml similarity index 100% rename from examples/example_encoding.sb rename to examples/example_encoding.yaml diff --git a/patacrep/build.py b/patacrep/build.py index f123228d..b003a0ee 100644 --- a/patacrep/build.py +++ b/patacrep/build.py @@ -1,4 +1,4 @@ -"""Build a songbook, according to parameters found in a .sb file.""" +"""Build a songbook, according to parameters found in a .yaml file.""" import codecs import copy @@ -34,10 +34,10 @@ GENERATED_EXTENSIONS = [ # pylint: disable=too-few-public-methods class Songbook: - """Represent a songbook (.sb) file. + """Represent a songbook (.yaml) file. - Low level: provide a Python representation of the values stored in the - '.sb' file. + '.yaml' file. - High level: provide some utility functions to manipulate these data. """ @@ -183,7 +183,7 @@ class SongbookBuilder: _called_functions = {} def __init__(self, raw_songbook, basename): - # Representation of the .sb songbook configuration file. + # Representation of the .yaml songbook configuration file. self.songbook = Songbook(raw_songbook, basename) # Basename of the songbook to be built. self.basename = basename diff --git a/patacrep/content/__init__.py b/patacrep/content/__init__.py index c265f5b7..6b7c70fa 100755 --- a/patacrep/content/__init__.py +++ b/patacrep/content/__init__.py @@ -1,7 +1,7 @@ """Content plugin management. Content that can be included in a songbook is controlled by plugins. From the -user (or .sb file) point of view, each piece of content is introduced by a +user (or .yaml file) point of view, each piece of content is introduced by a keyword. This keywold is associated with a plugin (a submodule of this very module), which parses the content, and return a ContentList object, which is little more than a list of instances of the ContentItem class. @@ -14,7 +14,7 @@ dictionary where: - keys are keywords, - values are parsers (see below). -When analysing the content field of the .sb file, when those keywords are +When analysing the content field of the .yaml file, when those keywords are met, the corresponding parser is called. # Keyword examples @@ -252,7 +252,7 @@ def process_content(content, config=None): """Process content, and return a list of ContentItem() objects. Arguments are: - - content: the content field of the .sb file, which should be a nested list + - content: the content field of the .yaml file, which should be a nested list and describe what is to be included in the songbook; - config: the configuration dictionary of the current songbook. diff --git a/patacrep/content/cwd.py b/patacrep/content/cwd.py index efc37553..2c43af39 100755 --- a/patacrep/content/cwd.py +++ b/patacrep/content/cwd.py @@ -28,7 +28,7 @@ def parse(keyword, config, argument): for, and then processes the content. The 'path' is added: - - first as a relative path to the *.sb file directory; + - first as a relative path to the *.yaml file directory; - then as a relative path to every path already present in config['songdir']. """ diff --git a/patacrep/songbook/__main__.py b/patacrep/songbook/__main__.py index 3e9e592b..f341e004 100644 --- a/patacrep/songbook/__main__.py +++ b/patacrep/songbook/__main__.py @@ -128,8 +128,8 @@ def main(): options = argument_parser(sys.argv[1:]) songbook_path = options.book[-1] - if os.path.exists(songbook_path + ".sb") and not os.path.exists(songbook_path): - songbook_path += ".sb" + if os.path.exists(songbook_path + ".yaml") and not os.path.exists(songbook_path): + songbook_path += ".yaml" basename = os.path.basename(songbook_path)[:-3] diff --git a/test/test_content/test_content.py b/test/test_content/test_content.py index 060467d9..1bbec7af 100644 --- a/test/test_content/test_content.py +++ b/test/test_content/test_content.py @@ -21,7 +21,7 @@ class FileTest(unittest.TestCase, metaclass=dynamic.DynamicTest): """Test of the content plugins. For any given `foo.source`, it parses the content as a yaml "content" - argument of a .sb file. + argument of a .yaml file. It controls that the generated file list is equal to the one in `foo.control`. """ diff --git a/test/test_songbook/content.sb b/test/test_songbook/content.yaml similarity index 92% rename from test/test_songbook/content.sb rename to test/test_songbook/content.yaml index a49ff77f..15b06a91 100644 --- a/test/test_songbook/content.sb +++ b/test/test_songbook/content.yaml @@ -12,7 +12,7 @@ content: - sort: - songsection: Test of song section - cwd: - # relative to sb file + # relative to yaml songfile path: content_datadir/content content: - "song.csg" diff --git a/test/test_songbook/datadir.sb b/test/test_songbook/datadir.yaml similarity index 100% rename from test/test_songbook/datadir.sb rename to test/test_songbook/datadir.yaml diff --git a/test/test_songbook/languages.sb b/test/test_songbook/languages.yaml similarity index 100% rename from test/test_songbook/languages.sb rename to test/test_songbook/languages.yaml diff --git a/test/test_songbook/syntax.sb b/test/test_songbook/syntax.yaml similarity index 100% rename from test/test_songbook/syntax.sb rename to test/test_songbook/syntax.yaml diff --git a/test/test_songbook/test_compilation.py b/test/test_songbook/test_compilation.py index b225756e..09a3e382 100644 --- a/test/test_songbook/test_compilation.py +++ b/test/test_songbook/test_compilation.py @@ -18,7 +18,7 @@ LOGGER = logging.getLogger(__name__) class FileTest(unittest.TestCase, metaclass=dynamic.DynamicTest): """Test of songbook compilation. - For any given `foo.sb`, it performs several checks: + For any given `foo.yaml`, it performs several checks: - the corresponding tex file is generated; - the generated tex file matches the `foo.tex.control` control file; - the compilation (tex, pdf, indexes) works without errors. @@ -34,9 +34,9 @@ class FileTest(unittest.TestCase, metaclass=dynamic.DynamicTest): """Iterate over dynamically generated test methods.""" for songbook in sorted(glob.glob(os.path.join( os.path.dirname(__file__), - '*.sb', + '*.yaml', ))): - base = songbook[:-len(".sb")] + base = songbook[:-len(".yaml")] yield ( "test_latex_generation_{}".format(os.path.basename(base)), cls._create_generation_test(base), @@ -52,7 +52,7 @@ class FileTest(unittest.TestCase, metaclass=dynamic.DynamicTest): def test_generation(self): """Test that `base.tex` is correctly generated.""" - songbook = "{}.sb".format(base) + songbook = "{}.yaml".format(base) # Check tex generation self.assertEqual(0, self.compile_songbook(songbook, "tex")) @@ -100,7 +100,7 @@ class FileTest(unittest.TestCase, metaclass=dynamic.DynamicTest): def test_compilation(self): """Test that `base` is rendered to pdf.""" # Check compilation - songbook = "{}.sb".format(base) + songbook = "{}.yaml".format(base) self.assertEqual(0, self.compile_songbook(songbook)) test_compilation.__doc__ = ( diff --git a/test/test_songbook/unicode.sb b/test/test_songbook/unicode.yaml similarity index 100% rename from test/test_songbook/unicode.sb rename to test/test_songbook/unicode.yaml