Browse Source

Change sb to yaml extension

pull/198/head
Oliverpool 9 years ago
parent
commit
0912eaf0d2
  1. 2
      README.rst
  2. 0
      examples/example-all.yaml
  3. 0
      examples/example-all.yaml.yaml
  4. 0
      examples/example-crepbook.yaml
  5. 0
      examples/example-layout.yaml
  6. 0
      examples/example-songs.yaml
  7. 0
      examples/example-test.yaml
  8. 0
      examples/example.yaml
  9. 0
      examples/example_encoding.yaml
  10. 8
      patacrep/build.py
  11. 6
      patacrep/content/__init__.py
  12. 2
      patacrep/content/cwd.py
  13. 4
      patacrep/songbook/__main__.py
  14. 2
      test/test_content/test_content.py
  15. 2
      test/test_songbook/content.yaml
  16. 0
      test/test_songbook/datadir.yaml
  17. 0
      test/test_songbook/languages.yaml
  18. 0
      test/test_songbook/syntax.yaml
  19. 10
      test/test_songbook/test_compilation.py
  20. 0
      test/test_songbook/unicode.yaml

2
README.rst

@ -55,7 +55,7 @@ Run
::
songbook <songbook_file.sb>
songbook <songbook_file.yaml>
<pdfreader> <songbook_file.pdf>
Look for existing songbook files in `patadata <http://github.com/patacrep/patadata>`_.

0
examples/example-all.sb → examples/example-all.yaml

0
examples/example-all.yaml.sb → examples/example-all.yaml.yaml

0
examples/example-crepbook.sb → examples/example-crepbook.yaml

0
examples/example-layout.sb → examples/example-layout.yaml

0
examples/example-songs.sb → examples/example-songs.yaml

0
examples/example-test.sb → examples/example-test.yaml

0
examples/example.sb → examples/example.yaml

0
examples/example_encoding.sb → examples/example_encoding.yaml

8
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

6
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.

2
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'].
"""

4
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]

2
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`.
"""

2
test/test_songbook/content.sb → 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"

0
test/test_songbook/datadir.sb → test/test_songbook/datadir.yaml

0
test/test_songbook/languages.sb → test/test_songbook/languages.yaml

0
test/test_songbook/syntax.sb → test/test_songbook/syntax.yaml

10
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__ = (

0
test/test_songbook/unicode.sb → test/test_songbook/unicode.yaml

Loading…
Cancel
Save