From 1876b5b5b4887101d3b9f03688e6588873efbcfa Mon Sep 17 00:00:00 2001 From: Louis Date: Wed, 21 Oct 2015 20:36:12 +0200 Subject: [PATCH] Merge master --- examples/.gitignore | 1 + examples/example-all.sb | 3 ++- examples/songs/greensleeves.sgc | 2 +- examples/songs/tests/chords.sgc | 2 +- examples/songs/tests/errors.sgc | 2 +- patacrep/build.py | 2 +- patacrep/content/song.py | 6 ++--- patacrep/data/templates/songs.tex | 10 ++++---- patacrep/latex/__init__.py | 23 +++++++++++++++++++ patacrep/latex/ast.py | 6 +++-- patacrep/songbook.py | 2 ++ patacrep/songs/__init__.py | 6 ++--- patacrep/songs/chordpro/__init__.py | 6 +++-- patacrep/songs/chordpro/ast.py | 4 ++-- .../songs/chordpro/data/chordpro/song_header | 4 ++-- patacrep/songs/chordpro/data/html/song_header | 4 ++-- patacrep/songs/chordpro/data/latex/song | 4 ++-- patacrep/songs/latex/__init__.py | 20 ++++++++++++---- patacrep/templates.py | 4 +++- test/test_chordpro/00.sgc | 2 +- test/test_chordpro/01.sgc | 2 +- test/test_chordpro/02.sgc | 2 +- test/test_chordpro/03.sgc | 2 +- test/test_chordpro/04.sgc | 2 +- test/test_chordpro/05.sgc | 2 +- test/test_chordpro/06.sgc | 2 +- test/test_chordpro/07.sgc | 2 +- test/test_chordpro/08.sgc | 2 +- test/test_chordpro/09.sgc | 2 +- test/test_chordpro/10.sgc | 2 +- test/test_chordpro/11.sgc | 2 +- test/test_chordpro/12.sgc | 2 +- test/test_chordpro/13.sgc | 2 +- test/test_chordpro/21.sgc | 2 +- test/test_chordpro/22.sgc | 2 +- test/test_chordpro/23.sgc | 2 +- test/test_chordpro/24.sgc | 2 +- test/test_chordpro/25.sgc | 2 +- test/test_chordpro/26.sgc | 2 +- test/test_chordpro/27.sgc | 2 +- test/test_chordpro/28.sgc | 2 +- test/test_chordpro/29.sgc | 2 +- test/test_chordpro/author_names.sgc | 2 +- test/test_chordpro/chords.sgc | 2 +- test/test_chordpro/customchords.sgc | 2 +- test/test_chordpro/greensleeves.sgc | 2 +- test/test_chordpro/greensleeves.source | 2 +- test/test_chordpro/invalid_chord.sgc | 2 +- test/test_chordpro/invalid_customchord.sgc | 2 +- test/test_chordpro/lang.sgc | 1 + test/test_chordpro/lang.source | 1 + test/test_chordpro/metadata.sgc | 2 +- test/test_chordpro/metadata.source | 4 ++-- test/test_chordpro/newline.html | 2 +- test/test_chordpro/newline.sgc | 2 +- test/test_chordpro/nolyrics.sgc | 2 +- test/test_chordpro/ukulelechords.sgc | 2 +- 57 files changed, 117 insertions(+), 70 deletions(-) create mode 100644 test/test_chordpro/lang.sgc create mode 100644 test/test_chordpro/lang.source diff --git a/examples/.gitignore b/examples/.gitignore index 8c36c429..5b3a77ab 100644 --- a/examples/.gitignore +++ b/examples/.gitignore @@ -1 +1,2 @@ /.cache +/*tex diff --git a/examples/example-all.sb b/examples/example-all.sb index dba08cc0..8f5d80a6 100644 --- a/examples/example-all.sb +++ b/examples/example-all.sb @@ -6,8 +6,9 @@ "pictures" ], "booktype" : "chorded", +"datadir": ["datadir2"], "template" : "patacrep.tex", -"lang" : "french", +"lang" : "fr", "encoding": "utf8", "authwords" : { "sep" : ["and", "et"] diff --git a/examples/songs/greensleeves.sgc b/examples/songs/greensleeves.sgc index e7a6d7cb..c1295968 100644 --- a/examples/songs/greensleeves.sgc +++ b/examples/songs/greensleeves.sgc @@ -1,4 +1,4 @@ -{language : english} +{lang : en} {columns : 2} { title : Greensleeves} {subtitle: Test of the chordpro format} diff --git a/examples/songs/tests/chords.sgc b/examples/songs/tests/chords.sgc index 8779a140..1539387b 100644 --- a/examples/songs/tests/chords.sgc +++ b/examples/songs/tests/chords.sgc @@ -1,4 +1,4 @@ -{language: english} +{lang: en} {columns: 1} {title: Chords testing} {subtitle: Test of the chords specification and LaTeX translation} diff --git a/examples/songs/tests/errors.sgc b/examples/songs/tests/errors.sgc index 56cb61b7..3b682f4c 100644 --- a/examples/songs/tests/errors.sgc +++ b/examples/songs/tests/errors.sgc @@ -1,4 +1,4 @@ -{language : english} +{lang : en} {columns : 2} { title : Error} {subtitle: A chordpro file with many errors} diff --git a/patacrep/build.py b/patacrep/build.py index 8151f797..40ef74ff 100644 --- a/patacrep/build.py +++ b/patacrep/build.py @@ -29,7 +29,7 @@ GENERATED_EXTENSIONS = [ ] DEFAULT_CONFIG = { 'template': "default.tex", - 'lang': 'english', + 'lang': 'en', 'content': [], 'titleprefixwords': [], 'encoding': None, diff --git a/patacrep/content/song.py b/patacrep/content/song.py index d6bff200..480583fa 100755 --- a/patacrep/content/song.py +++ b/patacrep/content/song.py @@ -60,8 +60,8 @@ def parse(keyword, argument, contentlist, config): Return a list of Song() instances. """ plugins = config['_song_plugins'] - if '_languages' not in config: - config['_languages'] = set() + if '_langs' not in config: + config['_langs'] = set() songlist = [] for songdir in config['_songdir']: if contentlist: @@ -92,7 +92,7 @@ def parse(keyword, argument, contentlist, config): datadir=songdir.datadir, )) songlist.append(renderer) - config["_languages"].update(renderer.song.languages) + config["_langs"].add(renderer.song.lang) if len(songlist) > before: break if len(songlist) == before: diff --git a/patacrep/data/templates/songs.tex b/patacrep/data/templates/songs.tex index bdfcf7bb..957e610e 100644 --- a/patacrep/data/templates/songs.tex +++ b/patacrep/data/templates/songs.tex @@ -52,7 +52,7 @@ "mandatory": true }, "lang": {"description": {"english": "Language", "french": "Langue"}, - "default": {"english": "english", "french": "french"} + "default": {"english": "en", "french": "fr"} }, "titleprefixwords": {"description": {"english": "Ignore some words in the beginning of song titles", "french": "Ignore des mots dans le classement des chansons"}, @@ -80,11 +80,11 @@ (* block songbookpreambule *) (( super() )) -(* for lang in _languages -*) - \PassOptionsToPackage{((lang))}{babel} +(* for lang in _langs -*) + \PassOptionsToPackage{(( lang2babel(lang) ))}{babel} (* endfor *) -\usepackage[((lang))]{babel} -\lang{((lang))} +\usepackage[(( lang2babel(lang) ))]{babel} +\lang{(( lang2babel(lang) ))} \usepackage{graphicx} \graphicspath{ % diff --git a/patacrep/latex/__init__.py b/patacrep/latex/__init__.py index 2c6db73a..d01cfbe5 100644 --- a/patacrep/latex/__init__.py +++ b/patacrep/latex/__init__.py @@ -5,4 +5,27 @@ This module uses an LALR parser to try to parse LaTeX code. LaTeX language will work on simple cases, but not on complex ones. """ +import logging +from collections import OrderedDict + from patacrep.latex.syntax import tex2plain, parse_song + +LOGGER = logging.getLogger(__name__) + +BABEL_LANGUAGES = OrderedDict(( + ('fr', 'french'), + ('en', 'english'), + ('de', 'german'), + ('es', 'spanish'), + ('it', 'italian'), + ('pt', 'portuguese'), +)) + +def lang2babel(lang): + """Return the language used by babel, corresponding to the language code""" + try: + return BABEL_LANGUAGES[lang] + except KeyError: + available = ", ".join(BABEL_LANGUAGES.keys()) + LOGGER.error('Unknown lang code: ' + lang + '. Supported: ' + available) + return 'english' diff --git a/patacrep/latex/ast.py b/patacrep/latex/ast.py index c4763ddf..46017fda 100644 --- a/patacrep/latex/ast.py +++ b/patacrep/latex/ast.py @@ -2,6 +2,8 @@ # pylint: disable=too-few-public-methods +DEFAULT_LANGUAGE = "english" + class AST: """Base class for the tree.""" # pylint: disable=no-init @@ -16,7 +18,7 @@ class AST: parsing. """ cls.metadata = { - '@languages': set(), + '@language': DEFAULT_LANGUAGE, } class Expression(AST): @@ -44,7 +46,7 @@ class Command(AST): self.optional = optional if name == r'\selectlanguage': - self.metadata['@languages'] |= set(self.mandatory) + self.metadata['@language'] = self.mandatory[0] def __str__(self): if self.name in [r'\emph']: diff --git a/patacrep/songbook.py b/patacrep/songbook.py index 71340cae..e0e3979e 100644 --- a/patacrep/songbook.py +++ b/patacrep/songbook.py @@ -105,6 +105,8 @@ def main(): options = argument_parser(sys.argv[1:]) songbook_path = options.book[0] + if os.path.exists(songbook_path + ".sb") and not os.path.exists(songbook_path): + songbook_path += ".sb" basename = os.path.basename(songbook_path)[:-3] diff --git a/patacrep/songs/__init__.py b/patacrep/songs/__init__.py index a9f083d5..e8a91fa3 100644 --- a/patacrep/songs/__init__.py +++ b/patacrep/songs/__init__.py @@ -89,7 +89,7 @@ class Song: "cached", "data", "subpath", - "languages", + "lang", "authors", "_filehash", "_version", @@ -131,6 +131,7 @@ class Song: self.titles = [] self.data = {} self.cached = None + self.lang = None self._parse(config) # Post processing of data @@ -182,8 +183,7 @@ class Song: - titles: the list of (raw) titles. This list will be processed to remove prefixes. - - languages: the list of languages used in the song, as languages - recognized by the LaTeX babel package. + - lang: the main language of the song, as language code.. - authors: the list of (raw) authors. This list will be processed to 'clean' it (see function :func:`patacrep.authors.processauthors`). - data: song metadata. Used (among others) to sort the songs. diff --git a/patacrep/songs/chordpro/__init__.py b/patacrep/songs/chordpro/__init__.py index 39c8825c..c7d749b3 100644 --- a/patacrep/songs/chordpro/__init__.py +++ b/patacrep/songs/chordpro/__init__.py @@ -10,6 +10,7 @@ from patacrep import encoding, files from patacrep.songs import Song from patacrep.songs.chordpro.syntax import parse_song from patacrep.templates import Renderer +from patacrep.latex import lang2babel LOGGER = logging.getLogger(__name__) @@ -25,7 +26,7 @@ class ChordproSong(Song): song = parse_song(song.read(), self.fullpath) self.authors = song.authors self.titles = song.titles - self.languages = song.get_data_argument('language', [self.config['lang']]) + self.lang = song.get_data_argument('lang', self.config['lang']) self.data = song.meta self.cached = { 'song': song, @@ -33,7 +34,7 @@ class ChordproSong(Song): def render(self, output=None, template="song"): # pylint: disable=arguments-differ context = { - 'language': self.languages[0], + 'lang': self.lang, "titles": self.titles, "authors": self.authors, "metadata": self.data, @@ -52,6 +53,7 @@ class ChordproSong(Song): ])) jinjaenv.filters['search_image'] = self.search_image jinjaenv.filters['search_partition'] = self.search_partition + jinjaenv.filters['lang2babel'] = lang2babel try: return Renderer( diff --git a/patacrep/songs/chordpro/ast.py b/patacrep/songs/chordpro/ast.py index 18805e9b..9213ed37 100644 --- a/patacrep/songs/chordpro/ast.py +++ b/patacrep/songs/chordpro/ast.py @@ -31,6 +31,7 @@ DIRECTIVE_SHORTCUTS = { "c": "comment", "gc": "guitar_comment", "cover": "cov", + "language": "lang", } def directive_name(text): @@ -181,7 +182,7 @@ class Song(AST): - content: the song content, as a list of objects `foo` such that `foo.inline` is True. - titles: The list of titles - - language: The language (if set), None otherwise + - lang: The language code (if set), None otherwise - authors: The list of authors - meta: Every other metadata. """ @@ -193,7 +194,6 @@ class Song(AST): "artist": "add_author", "key": "add_key", "define": "add_cumulative", - "language": "add_cumulative", } def __init__(self, filename): diff --git a/patacrep/songs/chordpro/data/chordpro/song_header b/patacrep/songs/chordpro/data/chordpro/song_header index ac5d8329..2ffb1d30 100644 --- a/patacrep/songs/chordpro/data/chordpro/song_header +++ b/patacrep/songs/chordpro/data/chordpro/song_header @@ -1,5 +1,5 @@ -(* if language is defined -*) - {language: (( language ))} +(* if lang is defined -*) + {lang: (( lang ))} (* endif *) (* if metadata.columns is defined -*) {columns: (( metadata.columns ))} diff --git a/patacrep/songs/chordpro/data/html/song_header b/patacrep/songs/chordpro/data/html/song_header index 963ef686..bd401864 100644 --- a/patacrep/songs/chordpro/data/html/song_header +++ b/patacrep/songs/chordpro/data/html/song_header @@ -17,8 +17,8 @@ (* endif *) (* endfor *) -(* if language is defined -*) - Language: (( language ))
+(* if lang is defined -*) + Lang: (( lang ))
(* endif *) (* include 'content_metadata_cover' *) diff --git a/patacrep/songs/chordpro/data/latex/song b/patacrep/songs/chordpro/data/latex/song index 050cf66b..6f026c79 100644 --- a/patacrep/songs/chordpro/data/latex/song +++ b/patacrep/songs/chordpro/data/latex/song @@ -1,5 +1,5 @@ -(* if language is defined -*) - \selectlanguage{((language))} +(* if lang is defined -*) + \selectlanguage{(( lang2babel(lang) ))} (* endif *) (*- if metadata.columns is defined *) diff --git a/patacrep/songs/latex/__init__.py b/patacrep/songs/latex/__init__.py index 565b4067..d787707b 100644 --- a/patacrep/songs/latex/__init__.py +++ b/patacrep/songs/latex/__init__.py @@ -8,7 +8,7 @@ will work on simple cases, but not on complex ones. import os from patacrep import files, encoding -from patacrep.latex import parse_song +from patacrep.latex import parse_song, BABEL_LANGUAGES from patacrep.songs import Song class Latex2LatexSong(Song): @@ -16,13 +16,13 @@ class Latex2LatexSong(Song): # pylint: disable=abstract-method def _parse(self, __config): - """Parse content, and return the dictinory of song data.""" + """Parse content, and return the dictionary of song data.""" with encoding.open_read(self.fullpath, encoding=self.encoding) as song: self.data = parse_song(song.read(), self.fullpath) self.titles = self.data['@titles'] del self.data['@titles'] - self.languages = self.data['@languages'] - del self.data['@languages'] + self.set_lang(self.data['@language']) + del self.data['@language'] if "by" in self.data: self.authors = [self.data['by']] del self.data['by'] @@ -40,6 +40,18 @@ class Latex2LatexSong(Song): )) return r'\import{{{}/}}{{{}}}'.format(os.path.dirname(path), os.path.basename(path)) + def set_lang(self, language): + """Set the language code""" + for lang, babel_language in BABEL_LANGUAGES.items(): + if language == babel_language: + self.lang = lang + return + + # Add a custom language to the babel dictionary (language is not officially supported) + custom_lang = '_' + language + BABEL_LANGUAGES[custom_lang] = language + self.lang = custom_lang + SONG_RENDERERS = { "latex": { 'is': Latex2LatexSong, diff --git a/patacrep/templates.py b/patacrep/templates.py index 4b81c08d..6a799295 100644 --- a/patacrep/templates.py +++ b/patacrep/templates.py @@ -9,6 +9,7 @@ import re import json from patacrep import errors, files +from patacrep.latex import lang2babel import patacrep.encoding _LATEX_SUBS = ( @@ -84,6 +85,7 @@ class Renderer: self.jinjaenv.trim_blocks = True self.jinjaenv.lstrip_blocks = True self.jinjaenv.globals["path2posix"] = files.path2posix + self.jinjaenv.globals["lang2babel"] = lang2babel self.template = self.jinjaenv.get_template(template) @@ -153,7 +155,7 @@ class TexBookRenderer(Renderer): variable = default["default"] elif "en" in default: variable = default["en"] - elif len(default > 0): + elif len(default): variable = default.popitem()[1] else: variable = None diff --git a/test/test_chordpro/00.sgc b/test/test_chordpro/00.sgc index 3e2185b7..768ee9ee 100644 --- a/test/test_chordpro/00.sgc +++ b/test/test_chordpro/00.sgc @@ -1 +1 @@ -{language: english} +{lang: en} diff --git a/test/test_chordpro/01.sgc b/test/test_chordpro/01.sgc index 25d6a677..6cf1934e 100644 --- a/test/test_chordpro/01.sgc +++ b/test/test_chordpro/01.sgc @@ -1,3 +1,3 @@ -{language: english} +{lang: en} A verse line diff --git a/test/test_chordpro/02.sgc b/test/test_chordpro/02.sgc index 2a8629e0..365a1b9b 100644 --- a/test/test_chordpro/02.sgc +++ b/test/test_chordpro/02.sgc @@ -1,3 +1,3 @@ -{language: english} +{lang: en} {title: A directive} diff --git a/test/test_chordpro/03.sgc b/test/test_chordpro/03.sgc index 341c9bd4..6468f5e9 100644 --- a/test/test_chordpro/03.sgc +++ b/test/test_chordpro/03.sgc @@ -1,2 +1,2 @@ -{language: english} +{lang: en} diff --git a/test/test_chordpro/04.sgc b/test/test_chordpro/04.sgc index e9c2a952..d25f38a8 100644 --- a/test/test_chordpro/04.sgc +++ b/test/test_chordpro/04.sgc @@ -1,4 +1,4 @@ -{language: english} +{lang: en} {start_of_chorus} A one line chorus diff --git a/test/test_chordpro/05.sgc b/test/test_chordpro/05.sgc index 9bc7f016..cf6a654b 100644 --- a/test/test_chordpro/05.sgc +++ b/test/test_chordpro/05.sgc @@ -1,4 +1,4 @@ -{language: english} +{lang: en} {start_of_bridge} A one line bridge diff --git a/test/test_chordpro/06.sgc b/test/test_chordpro/06.sgc index 341c9bd4..6468f5e9 100644 --- a/test/test_chordpro/06.sgc +++ b/test/test_chordpro/06.sgc @@ -1,2 +1,2 @@ -{language: english} +{lang: en} diff --git a/test/test_chordpro/07.sgc b/test/test_chordpro/07.sgc index b05a536f..1362cdeb 100644 --- a/test/test_chordpro/07.sgc +++ b/test/test_chordpro/07.sgc @@ -1,4 +1,4 @@ -{language: english} +{lang: en} {start_of_tab} A tab diff --git a/test/test_chordpro/08.sgc b/test/test_chordpro/08.sgc index 9a9f0566..bfcb44dd 100644 --- a/test/test_chordpro/08.sgc +++ b/test/test_chordpro/08.sgc @@ -1,4 +1,4 @@ -{language: english} +{lang: en} A lot of new lines diff --git a/test/test_chordpro/09.sgc b/test/test_chordpro/09.sgc index 193db1b0..b252de69 100644 --- a/test/test_chordpro/09.sgc +++ b/test/test_chordpro/09.sgc @@ -1,4 +1,4 @@ -{language: english} +{lang: en} {title: and a directive} diff --git a/test/test_chordpro/10.sgc b/test/test_chordpro/10.sgc index e7537b3b..431ddd11 100644 --- a/test/test_chordpro/10.sgc +++ b/test/test_chordpro/10.sgc @@ -1,3 +1,3 @@ -{language: english} +{lang: en} A line[A] with a chord diff --git a/test/test_chordpro/11.sgc b/test/test_chordpro/11.sgc index 3610f67c..350f195d 100644 --- a/test/test_chordpro/11.sgc +++ b/test/test_chordpro/11.sgc @@ -1,3 +1,3 @@ -{language: english} +{lang: en} A line ending with a chord[A] diff --git a/test/test_chordpro/12.sgc b/test/test_chordpro/12.sgc index 029ccad4..946d7add 100644 --- a/test/test_chordpro/12.sgc +++ b/test/test_chordpro/12.sgc @@ -1,3 +1,3 @@ -{language: english} +{lang: en} [A]A line starting with a chord diff --git a/test/test_chordpro/13.sgc b/test/test_chordpro/13.sgc index aa6f6603..1000c0db 100644 --- a/test/test_chordpro/13.sgc +++ b/test/test_chordpro/13.sgc @@ -1,4 +1,4 @@ -{language: english} +{lang: en} {start_of_tab} A table diff --git a/test/test_chordpro/21.sgc b/test/test_chordpro/21.sgc index 25d6a677..6cf1934e 100644 --- a/test/test_chordpro/21.sgc +++ b/test/test_chordpro/21.sgc @@ -1,3 +1,3 @@ -{language: english} +{lang: en} A verse line diff --git a/test/test_chordpro/22.sgc b/test/test_chordpro/22.sgc index 2a8629e0..365a1b9b 100644 --- a/test/test_chordpro/22.sgc +++ b/test/test_chordpro/22.sgc @@ -1,3 +1,3 @@ -{language: english} +{lang: en} {title: A directive} diff --git a/test/test_chordpro/23.sgc b/test/test_chordpro/23.sgc index 3e2185b7..768ee9ee 100644 --- a/test/test_chordpro/23.sgc +++ b/test/test_chordpro/23.sgc @@ -1 +1 @@ -{language: english} +{lang: en} diff --git a/test/test_chordpro/24.sgc b/test/test_chordpro/24.sgc index e9c2a952..d25f38a8 100644 --- a/test/test_chordpro/24.sgc +++ b/test/test_chordpro/24.sgc @@ -1,4 +1,4 @@ -{language: english} +{lang: en} {start_of_chorus} A one line chorus diff --git a/test/test_chordpro/25.sgc b/test/test_chordpro/25.sgc index 9bc7f016..cf6a654b 100644 --- a/test/test_chordpro/25.sgc +++ b/test/test_chordpro/25.sgc @@ -1,4 +1,4 @@ -{language: english} +{lang: en} {start_of_bridge} A one line bridge diff --git a/test/test_chordpro/26.sgc b/test/test_chordpro/26.sgc index 341c9bd4..6468f5e9 100644 --- a/test/test_chordpro/26.sgc +++ b/test/test_chordpro/26.sgc @@ -1,2 +1,2 @@ -{language: english} +{lang: en} diff --git a/test/test_chordpro/27.sgc b/test/test_chordpro/27.sgc index b05a536f..1362cdeb 100644 --- a/test/test_chordpro/27.sgc +++ b/test/test_chordpro/27.sgc @@ -1,4 +1,4 @@ -{language: english} +{lang: en} {start_of_tab} A tab diff --git a/test/test_chordpro/28.sgc b/test/test_chordpro/28.sgc index 9a9f0566..bfcb44dd 100644 --- a/test/test_chordpro/28.sgc +++ b/test/test_chordpro/28.sgc @@ -1,4 +1,4 @@ -{language: english} +{lang: en} A lot of new lines diff --git a/test/test_chordpro/29.sgc b/test/test_chordpro/29.sgc index 193db1b0..b252de69 100644 --- a/test/test_chordpro/29.sgc +++ b/test/test_chordpro/29.sgc @@ -1,4 +1,4 @@ -{language: english} +{lang: en} {title: and a directive} diff --git a/test/test_chordpro/author_names.sgc b/test/test_chordpro/author_names.sgc index 36a39230..b1756cc3 100644 --- a/test/test_chordpro/author_names.sgc +++ b/test/test_chordpro/author_names.sgc @@ -1,4 +1,4 @@ -{language: english} +{lang: en} {title: Title} {artist: The Beatles} {artist: Oasis} diff --git a/test/test_chordpro/chords.sgc b/test/test_chordpro/chords.sgc index 040dcf07..983e03ee 100644 --- a/test/test_chordpro/chords.sgc +++ b/test/test_chordpro/chords.sgc @@ -1,4 +1,4 @@ -{language: english} +{lang: en} [A]Simple [Bb]BĂ©mol diff --git a/test/test_chordpro/customchords.sgc b/test/test_chordpro/customchords.sgc index 3357bb96..dd42e025 100644 --- a/test/test_chordpro/customchords.sgc +++ b/test/test_chordpro/customchords.sgc @@ -1,4 +1,4 @@ -{language: english} +{lang: en} {define: E4 base-fret 7 frets 0 1 3 3 x x} {define: E5 base-fret 7 frets 0 1 3 3 x x fingers - 1 2 3 - -} {define: E5/A* base-fret 7 frets 0 1 3 3 x x fingers - 1 2 3 - -} diff --git a/test/test_chordpro/greensleeves.sgc b/test/test_chordpro/greensleeves.sgc index 389f14d1..7ff25a58 100644 --- a/test/test_chordpro/greensleeves.sgc +++ b/test/test_chordpro/greensleeves.sgc @@ -1,4 +1,4 @@ -{language: english} +{lang: en} {columns: 2} {title: Greensleeves} {title: Un autre sous-titre} diff --git a/test/test_chordpro/greensleeves.source b/test/test_chordpro/greensleeves.source index 1dee93ff..3801418d 100644 --- a/test/test_chordpro/greensleeves.source +++ b/test/test_chordpro/greensleeves.source @@ -1,4 +1,4 @@ -{language : english} +{lang : en} {columns : 2} {subtitle : Un sous titre} { title : Greensleeves} diff --git a/test/test_chordpro/invalid_chord.sgc b/test/test_chordpro/invalid_chord.sgc index acb5444f..3d6319be 100644 --- a/test/test_chordpro/invalid_chord.sgc +++ b/test/test_chordpro/invalid_chord.sgc @@ -1,3 +1,3 @@ -{language: english} +{lang: en} This is invalid. diff --git a/test/test_chordpro/invalid_customchord.sgc b/test/test_chordpro/invalid_customchord.sgc index 341c9bd4..6468f5e9 100644 --- a/test/test_chordpro/invalid_customchord.sgc +++ b/test/test_chordpro/invalid_customchord.sgc @@ -1,2 +1,2 @@ -{language: english} +{lang: en} diff --git a/test/test_chordpro/lang.sgc b/test/test_chordpro/lang.sgc new file mode 100644 index 00000000..be2eff89 --- /dev/null +++ b/test/test_chordpro/lang.sgc @@ -0,0 +1 @@ +{lang: fr} \ No newline at end of file diff --git a/test/test_chordpro/lang.source b/test/test_chordpro/lang.source new file mode 100644 index 00000000..c9a4c305 --- /dev/null +++ b/test/test_chordpro/lang.source @@ -0,0 +1 @@ +{language: fr} diff --git a/test/test_chordpro/metadata.sgc b/test/test_chordpro/metadata.sgc index e270b729..559f3dd3 100644 --- a/test/test_chordpro/metadata.sgc +++ b/test/test_chordpro/metadata.sgc @@ -1,4 +1,4 @@ -{language: french} +{lang: fr} {capo: Capo} {title: Title} {title: Subtitle1} diff --git a/test/test_chordpro/metadata.source b/test/test_chordpro/metadata.source index 05031dd2..7a623009 100644 --- a/test/test_chordpro/metadata.source +++ b/test/test_chordpro/metadata.source @@ -4,8 +4,8 @@ {subtitle: Subtitle4} {t: Subtitle2} {st: Subtitle5} -{language: french} -{language: english} +{lang: en} +{lang: fr} {by: Author1} {artist: Author2} {album: Album} diff --git a/test/test_chordpro/newline.html b/test/test_chordpro/newline.html index 1fbb02a3..aca33fa6 100644 --- a/test/test_chordpro/newline.html +++ b/test/test_chordpro/newline.html @@ -1,4 +1,4 @@ -Language: english
+Lang: en
diff --git a/test/test_chordpro/newline.sgc b/test/test_chordpro/newline.sgc index 72bdc1a2..e9bf0c62 100644 --- a/test/test_chordpro/newline.sgc +++ b/test/test_chordpro/newline.sgc @@ -1,4 +1,4 @@ -{language: english} +{lang: en} This is a verse With a new line diff --git a/test/test_chordpro/nolyrics.sgc b/test/test_chordpro/nolyrics.sgc index fd59c884..2ad06b03 100644 --- a/test/test_chordpro/nolyrics.sgc +++ b/test/test_chordpro/nolyrics.sgc @@ -1,4 +1,4 @@ -{language: english} +{lang: en} A chorus [A]with lyrics [Emaj3]maj et nombre diff --git a/test/test_chordpro/ukulelechords.sgc b/test/test_chordpro/ukulelechords.sgc index 3b37123d..bbf4aa81 100644 --- a/test/test_chordpro/ukulelechords.sgc +++ b/test/test_chordpro/ukulelechords.sgc @@ -1,4 +1,4 @@ -{language: english} +{lang: en} {define: G frets 0 2 3 2} {define: D7 frets 2 2 2 3 fingers 1 1 1 2} {define: G frets 3 2 0 0 0 3}