mirror of https://github.com/patacrep/patacrep.git
Louis
9 years ago
81 changed files with 458 additions and 222 deletions
@ -1 +1,6 @@ |
|||
(* block image *) |
|||
(* set image = content.argument|search_image *) |
|||
(* if image *) |
|||
<img src="(( content.argument|search_image ))"> |
|||
(* endif *) |
|||
(* endblock *) |
|||
|
@ -1,3 +1,8 @@ |
|||
(* block cov *) |
|||
(* if 'cov' in metadata -*) |
|||
<img src="(( metadata['cov'].argument|search_image ))"><br> |
|||
(* set cov = metadata['cov'].argument|search_image *) |
|||
(* if cov *) |
|||
<img src="(( cov ))"><br> |
|||
(* endif *) |
|||
(* endif *) |
|||
(* endblock *) |
|||
|
@ -1 +1,6 @@ |
|||
<a class="song-partition" href="(( content.argument|search_partition ))">((content.argument))</a> |
|||
(* block partition *) |
|||
(* set partition = content.argument|search_partition *) |
|||
(* if partition *) |
|||
<a class="song-partition" href="(( partition ))">((content.argument))</a> |
|||
(* endif *) |
|||
(* endblock *) |
|||
|
@ -1 +1,6 @@ |
|||
\image{(( content.argument|search_image ))} |
|||
(* block image *) |
|||
(* set image = content.argument|search_image *) |
|||
(* if image *) |
|||
\image{(( image ))} |
|||
(*- endif *) |
|||
(*- endblock *) |
|||
|
@ -1 +1,6 @@ |
|||
(* block partition *) |
|||
(* set partition = content.argument|search_partition *) |
|||
(* if partition *) |
|||
\lilypond{ ((- content.argument|search_partition -)) } |
|||
(*- endif -*) |
|||
(*- endblock -*) |
|||
|
@ -0,0 +1,61 @@ |
|||
"""Some utility functions""" |
|||
|
|||
from collections import UserDict |
|||
|
|||
class DictOfDict(UserDict): |
|||
"""Dictionary, with a recursive :meth:`update` method. |
|||
|
|||
By "recursive", we mean: if `self.update(other)` is called, and for some |
|||
key both `self[key]` and `other[key]` are dictionary, then `self[key]` is |
|||
not replaced by `other[key]`, but instead is updated. This is done |
|||
recursively (that is, `self[foo][bar][baz]` is updated with |
|||
`other[foo][bar][baz]`, if the corresponding objects are dictionaries). |
|||
|
|||
>>> ordinal = DictOfDict({ |
|||
... "francais": { |
|||
... 1: "premier", |
|||
... 2: "deuxieme", |
|||
... }, |
|||
... "english": { |
|||
... 1: "first", |
|||
... }, |
|||
... }) |
|||
>>> ordinal.update({ |
|||
... "francais": { |
|||
... 2: "second", |
|||
... 3: "troisieme", |
|||
... }, |
|||
... "espanol": { |
|||
... 1: "primero", |
|||
... }, |
|||
... }) |
|||
>>> ordinal == { |
|||
... "francais": { |
|||
... 1: "premier", |
|||
... 2: "second", |
|||
... 3: "troisieme", |
|||
... }, |
|||
... "english": { |
|||
... 1: "first", |
|||
... }, |
|||
... "espanol": { |
|||
... 1: "primero", |
|||
... }, |
|||
... } |
|||
True |
|||
""" |
|||
|
|||
def update(self, other): |
|||
# pylint: disable=arguments-differ |
|||
self._update(self, other) |
|||
|
|||
@staticmethod |
|||
def _update(left, right): |
|||
"""Equivalent to `left.update(right)`, with recursive update.""" |
|||
for key in right: |
|||
if key not in left: |
|||
left[key] = right[key] |
|||
elif isinstance(left[key], dict) and isinstance(right[key], dict): |
|||
DictOfDict._update(left[key], right[key]) |
|||
else: |
|||
left[key] = right[key] |
@ -1 +1 @@ |
|||
{language: english} |
|||
{lang: en} |
|||
|
@ -1,3 +1,3 @@ |
|||
{language: english} |
|||
{lang: en} |
|||
|
|||
A verse line |
|||
|
@ -1,3 +1,3 @@ |
|||
{language: english} |
|||
{lang: en} |
|||
{title: A directive} |
|||
|
|||
|
@ -1,2 +1,2 @@ |
|||
{language: english} |
|||
{lang: en} |
|||
|
|||
|
@ -1,2 +1,2 @@ |
|||
{language: english} |
|||
{lang: en} |
|||
|
|||
|
@ -1,4 +1,4 @@ |
|||
{language: english} |
|||
{lang: en} |
|||
|
|||
|
|||
A lot of new lines |
|||
|
@ -1,3 +1,3 @@ |
|||
{language: english} |
|||
{lang: en} |
|||
|
|||
A line[A] with a chord |
|||
|
@ -1,3 +1,3 @@ |
|||
{language: english} |
|||
{lang: en} |
|||
|
|||
A line ending with a chord[A] |
|||
|
@ -1,3 +1,3 @@ |
|||
{language: english} |
|||
{lang: en} |
|||
|
|||
[A]A line starting with a chord |
|||
|
@ -1,3 +1,3 @@ |
|||
{language: english} |
|||
{lang: en} |
|||
|
|||
A verse line |
|||
|
@ -1,3 +1,3 @@ |
|||
{language: english} |
|||
{lang: en} |
|||
{title: A directive} |
|||
|
|||
|
@ -1 +1 @@ |
|||
{language: english} |
|||
{lang: en} |
|||
|
@ -1,2 +1,2 @@ |
|||
{language: english} |
|||
{lang: en} |
|||
|
|||
|
@ -1,4 +1,4 @@ |
|||
{language: english} |
|||
{lang: en} |
|||
|
|||
|
|||
A lot of new lines |
|||
|
@ -1,3 +1,3 @@ |
|||
{language: english} |
|||
{lang: en} |
|||
|
|||
This is invalid. |
|||
|
@ -1,2 +1,2 @@ |
|||
{language: english} |
|||
{lang: en} |
|||
|
|||
|
@ -0,0 +1 @@ |
|||
{lang: fr} |
@ -0,0 +1 @@ |
|||
{language: fr} |
@ -1,22 +1,22 @@ |
|||
{language: french} |
|||
{lang: fr} |
|||
{capo: Capo} |
|||
{title: Title} |
|||
{title: Je t'ai Manqué} |
|||
{title: Subtitle1} |
|||
{title: Subtitle2} |
|||
{title: Subtitle3} |
|||
{title: Subtitle4} |
|||
{title: Subtitle5} |
|||
{artist: Author1} |
|||
{artist: Author2} |
|||
{artist: Texte de Jean Richepin, chanté par Georges Brassens} |
|||
{album: Album} |
|||
{copyright: Copyright} |
|||
{cov: Cover} |
|||
{cov: metadata_cover} |
|||
{key: foo: Foo} |
|||
|
|||
{comment: Comment} |
|||
{guitar_comment: GuitarComment} |
|||
{partition: Lilypond} |
|||
{image: Image} |
|||
{partition: metadata_lilypond} |
|||
{image: metadata_image} |
|||
|
|||
|
|||
Foo |
|||
|
@ -1,21 +1,21 @@ |
|||
{subtitle: Subtitle3} |
|||
{title: Title} |
|||
{title: Je t'ai Manqué} |
|||
{title: Subtitle1} |
|||
{subtitle: Subtitle4} |
|||
{t: Subtitle2} |
|||
{st: Subtitle5} |
|||
{language: french} |
|||
{language: english} |
|||
{lang: en} |
|||
{lang: fr} |
|||
{by: Author1} |
|||
{artist: Author2} |
|||
{artist: Texte de Jean Richepin, chanté par Georges Brassens} |
|||
{album: Album} |
|||
{copyright: Copyright} |
|||
{cover: Cover} |
|||
{cover: metadata_cover} |
|||
{capo: Capo} |
|||
{key: foo: Foo} |
|||
{comment: Comment} |
|||
{guitar_comment: GuitarComment} |
|||
{partition: Lilypond} |
|||
{image: Image} |
|||
{partition: metadata_lilypond} |
|||
{image: metadata_image} |
|||
|
|||
Foo |
|||
|
@ -1,50 +1,43 @@ |
|||
<span class="song-language">Language: english</span><br> |
|||
|
|||
<span class="song-language">Lang: en</span><br> |
|||
|
|||
|
|||
|
|||
<div class="song_content"> |
|||
<p class="verse"> |
|||
This is a verse<br> |
|||
With a new line<br> |
|||
<br> |
|||
The second part of the verse<br> |
|||
Is this line |
|||
<p class="verse">This is a verse<br> |
|||
With a new line<br> |
|||
<br> |
|||
The second part of the verse<br> |
|||
Is this line |
|||
</p> |
|||
|
|||
<p class="verse"> |
|||
Here is a new line at the end<br> |
|||
<p class="verse">Here is a new line at the end<br> |
|||
|
|||
</p> |
|||
|
|||
<p class="verse"> |
|||
Foo bar |
|||
<p class="verse">Foo bar |
|||
</p> |
|||
|
|||
<p class="verse"> |
|||
<br> |
|||
And a new line<br> |
|||
At the beginning |
|||
<p class="verse"><br> |
|||
And a new line<br> |
|||
At the beginning |
|||
</p> |
|||
|
|||
<p class="chorus"> |
|||
New lines can also<br> |
|||
<br> |
|||
Be in chorus |
|||
<p class="chorus">New lines can also<br> |
|||
<br> |
|||
Be in chorus |
|||
</p> |
|||
|
|||
<p class="bridge"> |
|||
New lines can also<br> |
|||
<br> |
|||
Be in bridges |
|||
<p class="bridge">New lines can also<br> |
|||
<br> |
|||
Be in bridges |
|||
</p> |
|||
|
|||
<p class="verse"> |
|||
New lines can also<br> |
|||
<br> |
|||
Be surrounded by spaces |
|||
<p class="verse">New lines can also<br> |
|||
<br> |
|||
Be surrounded by spaces |
|||
</p> |
|||
|
|||
<p class="verse"> |
|||
New lines cannot |
|||
<p class="verse">New lines cannot |
|||
</p> |
|||
</div> |
@ -1,10 +1,10 @@ |
|||
\beginsong{Image included from datadir\\\LaTeX} |
|||
[cov={datadir}] |
|||
[cov={img/datadir}] |
|||
|
|||
\cover |
|||
|
|||
\lilypond{datadir.ly} |
|||
\lilypond{scores/datadir.ly} |
|||
|
|||
\image{datadir} |
|||
\image{img/datadir} |
|||
|
|||
\endsong |
|||
|
@ -1,10 +1,10 @@ |
|||
\beginsong{Image included from a different datadir\\\LaTeX} |
|||
[cov={datadir2}] |
|||
[cov={img/datadir2}] |
|||
|
|||
\cover |
|||
|
|||
\lilypond{datadir2.ly} |
|||
\lilypond{scores/datadir2.ly} |
|||
|
|||
\image{datadir2} |
|||
\image{img/datadir2} |
|||
|
|||
\endsong |
|||
|
Loading…
Reference in new issue