Browse Source

Add songbook_model locale (description and default)

pull/200/head
Oliverpool 9 years ago
parent
commit
5517667b6d
  1. 133
      patacrep/data/templates/songbook_model.yml
  2. 11
      patacrep/songbook/__main__.py
  3. 2
      test/test_content/test_content.py
  4. 2
      test/test_song/test_parser.py
  5. 131
      test/test_songbook/french.tex.control
  6. 5
      test/test_songbook/french.yaml

133
patacrep/data/templates/songbook_model.yml

@ -79,44 +79,101 @@ schema:
contents: //str
- type: //nil
default:
book:
lang: en
encoding: utf-8
pictures: yes
template: patacrep.tex
onesongperpage: no
en:
book:
lang: en
encoding: utf-8
pictures: yes
template: patacrep.tex
onesongperpage: no
chords:
show: yes
diagramreminder: important
diagrampage: yes
repeatchords: yes
lilypond: no
tablatures: no
instrument: guitar
notation: alphascale
chords: # Options relatives aux accords
show: yes
diagramreminder: important
diagrampage: yes
repeatchords: yes
lilypond: no
tablatures: no
instrument: guitar
notation: alphascale
authors:
separators:
- and
ignore:
- unknown
after:
- by
authors: # Comment sont analysés les auteurs
separators:
- and
ignore:
- unknown
after:
- by
titles:
prefix:
- The
- Le
- La
- "L'"
- A
- Au
- Ces
- De
- Des
- El
- Les
- Ma
- Mon
- Un
titles: # Comment sont analysés les titres
prefix:
- The
- Le
- La
- "L'"
- A
- Au
- Ces
- De
- Des
- El
- Les
- Ma
- Mon
- Un
fr:
chords:
notation: solfedge
description:
en:
book:
lang: "Main language of the songbook"
encoding: "Encoding of the files"
pictures: "Display the album pictures"
template: "Main template to use"
onesongperpage: "Start every song on a new page"
chords:
show: "Display chords"
diagramreminder: "Display some diagram reminders before the songs"
diagrampage: "Add a diagram page"
repeatchords: "Repeat the chords inside the songs"
lilypond: "Display lilypond scores"
tablatures: "Display tablatures"
instrument: "Instrument for the diagrams"
notation: "Chord notation"
authors:
separators: "Separator words between artists"
ignore: "Artist names to ignore"
after: "Word preceding artist names"
titles:
prefix: "Words to ignore at the beginning of song titles for the index"
en:
book:
lang: "Langue principale"
encoding: "Encodage des fichiers"
pictures: "Afficher les illustrations d'albums"
template: "Template de base"
onesongperpage: "Commencer chaque chant sur une nouvelle page"
chords:
show: "Afficher les accords"
diagramreminder: "Afficher quelques diagrammes d'accords au début des chants"
diagrampage: "Inclure une page de rappel des accords"
repeatchords: "Répéter l'affichage des accords au sein des chants"
lilypond: "Inclure les partitions lilypond"
tablatures: "Inclure les tablatures"
instrument: "Instrument pour les diagrammes d'accords"
notation: "Notation des accords"
authors:
separators: "Mots de séparation entre les artistes"
ignore: "Noms d'artistes à ignorer"
after: "Mots précédents les noms d'artistes"
titles:
prefix: "Préfixes de chants à ignorer dans le classement"

11
patacrep/songbook/__main__.py

@ -149,7 +149,16 @@ def main():
sys.exit(1)
# Merge the default and user configs
default_songbook = DictOfDict(config_model('default'))
locale_default = config_model('default')
# Initialize with default in english
default_songbook = locale_default.get('en', {})
default_songbook = DictOfDict(default_songbook)
if 'lang' in user_songbook.get('book', []):
# Update default with current lang
lang = user_songbook['book']['lang']
default_songbook.update(locale_default.get(lang, {}))
# Update default with user_songbook
default_songbook.update(user_songbook)
songbook = dict(default_songbook)

2
test/test_content/test_content.py

@ -101,7 +101,7 @@ class FileTest(unittest.TestCase, metaclass=dynamic.DynamicTest):
"""Generate the config to process the content"""
# Load the default songbook config
config = config_model('default')
config = config_model('default')['en']
datadirpaths = [os.path.join(os.path.dirname(__file__), 'datadir')]

2
test/test_song/test_parser.py

@ -76,7 +76,7 @@ class FileTest(unittest.TestCase, metaclass=dynamic.DynamicTest):
"""Iterate over song files to test."""
# Setting datadir
# Load the default songbook config
cls.config = config_model('default')
cls.config = config_model('default')['en']
if '_datadir' not in cls.config:
cls.config['_datadir'] = []

131
test/test_songbook/french.tex.control

@ -0,0 +1,131 @@
%% Automatically generated document.
%% You may edit this file but all changes will be overwritten.
%% If you want to change this document, have a look at
%% the templating system.
%%
%% Generated using Songbook <http://www.patacrep.com>
\makeatletter
\def\input@path{ %
{@TEST_FOLDER@/latex/} %
{@DATA_FOLDER@/latex/} %
}
\makeatother
\documentclass[
]{article}
\usepackage[
chorded,
pictures,
repeatchords,
importantdiagramonly,
guitar,
]{crepbook}
\usepackage[
a4paper % paper size
,includeheadfoot % include header and footer into text size
,hmarginratio=1:1 % ratio between inner and outer margin (default)
,outer=1.8cm % outer margin (right)
,vmarginratio=1:1 % ratio between top and bottom margin
,bmargin=1.3cm % bottom margin
]{geometry}
\usepackage{lmodern}
\usepackage[french]{babel}
\lang{french}
\usepackage{graphicx}
\graphicspath{ %
{@TEST_FOLDER@/} %
{@DATA_FOLDER@/} %
}
\makeatletter
\@ifpackageloaded{hyperref}{}{
\usepackage{url}
\newcommand{\phantomsection}{}
\newcommand{\hyperlink}[2]{#2}
\newcommand{\href}[2]{\expandafter\url\expandafter{#1}}
}
\makeatother
\usepackage{chords}
\title{Recueil de chansons pour guitare}
\author{L'équipe Patacrep}
\newindex{titleidx}{french_title}
\newauthorindex{authidx}{french_auth}
\authignoreword{unknown}
\authbyword{by}
\authsepword{and}
\notenamesout{La}{Si}{Do}{R\'e}{Mi}{Fa}{Sol}
\pagestyle{empty}\definecolor{SongNumberBgColor}{HTML}{D1E4AE}
\definecolor{NoteBgColor}{HTML}{D1E4AE}
\definecolor{IndexBgColor}{HTML}{D1E4AE}
\renewcommand{\snumbgcolor}{SongNumberBgColor}
\renewcommand{\notebgcolor}{NoteBgColor}
\renewcommand{\idxbgcolor}{IndexBgColor}
\definecolor{tango-green-3}{HTML}{4e9a06}
\definecolor{tango-blue-3}{HTML}{204a87}
\usepackage[
bookmarks,
bookmarksopen,
hyperfigures=true,
colorlinks=true,
linkcolor=tango-green-3,
urlcolor=tango-blue-3
]{hyperref}
\subtitle{}
\mail{crep@team-on-fire.com}
\web{http://www.patacrep.com}
\picture{img/treble_a}
\picturecopyright{Dbolton \url{http://commons.wikimedia.org/wiki/User:Dbolton}}
\footer{Créé avec le programme Songbook (\url{http://www.patacrep.com})}
\begin{document}
\maketitle
\showindex{\songindexname}{titleidx}
\showindex{\authorindexname}{authidx}
% list of chords
\ifchorded
\ifdiagram
\phantomsection
\addcontentsline{toc}{section}{\chordlistname}
\chords
\fi
\fi
\phantomsection
\addcontentsline{toc}{section}{\songlistname}
\end{document}

5
test/test_songbook/french.yaml

@ -0,0 +1,5 @@
book:
lang: fr
content:
- sort:
Loading…
Cancel
Save