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 ))"> |
<img src="(( content.argument|search_image ))"> |
||||
|
(* endif *) |
||||
|
(* endblock *) |
||||
|
@ -1,3 +1,8 @@ |
|||||
|
(* block cov *) |
||||
(* if 'cov' in metadata -*) |
(* 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 *) |
||||
|
(* 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 -)) } |
\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 |
A verse line |
||||
|
@ -1,3 +1,3 @@ |
|||||
{language: english} |
{lang: en} |
||||
{title: A directive} |
{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 |
A lot of new lines |
||||
|
@ -1,3 +1,3 @@ |
|||||
{language: english} |
{lang: en} |
||||
|
|
||||
A line[A] with a chord |
A line[A] with a chord |
||||
|
@ -1,3 +1,3 @@ |
|||||
{language: english} |
{lang: en} |
||||
|
|
||||
A line ending with a chord[A] |
A line ending with a chord[A] |
||||
|
@ -1,3 +1,3 @@ |
|||||
{language: english} |
{lang: en} |
||||
|
|
||||
[A]A line starting with a chord |
[A]A line starting with a chord |
||||
|
@ -1,3 +1,3 @@ |
|||||
{language: english} |
{lang: en} |
||||
|
|
||||
A verse line |
A verse line |
||||
|
@ -1,3 +1,3 @@ |
|||||
{language: english} |
{lang: en} |
||||
{title: A directive} |
{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 |
A lot of new lines |
||||
|
@ -1,3 +1,3 @@ |
|||||
{language: english} |
{lang: en} |
||||
|
|
||||
This is invalid. |
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} |
{capo: Capo} |
||||
{title: Title} |
{title: Je t'ai Manqué} |
||||
{title: Subtitle1} |
{title: Subtitle1} |
||||
{title: Subtitle2} |
{title: Subtitle2} |
||||
{title: Subtitle3} |
{title: Subtitle3} |
||||
{title: Subtitle4} |
{title: Subtitle4} |
||||
{title: Subtitle5} |
{title: Subtitle5} |
||||
{artist: Author1} |
{artist: Author1} |
||||
{artist: Author2} |
{artist: Texte de Jean Richepin, chanté par Georges Brassens} |
||||
{album: Album} |
{album: Album} |
||||
{copyright: Copyright} |
{copyright: Copyright} |
||||
{cov: Cover} |
{cov: metadata_cover} |
||||
{key: foo: Foo} |
{key: foo: Foo} |
||||
|
|
||||
{comment: Comment} |
{comment: Comment} |
||||
{guitar_comment: GuitarComment} |
{guitar_comment: GuitarComment} |
||||
{partition: Lilypond} |
{partition: metadata_lilypond} |
||||
{image: Image} |
{image: metadata_image} |
||||
|
|
||||
|
|
||||
Foo |
Foo |
||||
|
@ -1,21 +1,21 @@ |
|||||
{subtitle: Subtitle3} |
{subtitle: Subtitle3} |
||||
{title: Title} |
{title: Je t'ai Manqué} |
||||
{title: Subtitle1} |
{title: Subtitle1} |
||||
{subtitle: Subtitle4} |
{subtitle: Subtitle4} |
||||
{t: Subtitle2} |
{t: Subtitle2} |
||||
{st: Subtitle5} |
{st: Subtitle5} |
||||
{language: french} |
{lang: en} |
||||
{language: english} |
{lang: fr} |
||||
{by: Author1} |
{by: Author1} |
||||
{artist: Author2} |
{artist: Texte de Jean Richepin, chanté par Georges Brassens} |
||||
{album: Album} |
{album: Album} |
||||
{copyright: Copyright} |
{copyright: Copyright} |
||||
{cover: Cover} |
{cover: metadata_cover} |
||||
{capo: Capo} |
{capo: Capo} |
||||
{key: foo: Foo} |
{key: foo: Foo} |
||||
{comment: Comment} |
{comment: Comment} |
||||
{guitar_comment: GuitarComment} |
{guitar_comment: GuitarComment} |
||||
{partition: Lilypond} |
{partition: metadata_lilypond} |
||||
{image: Image} |
{image: metadata_image} |
||||
|
|
||||
Foo |
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"> |
<div class="song_content"> |
||||
<p class="verse"> |
<p class="verse">This is a verse<br> |
||||
This is a verse<br> |
|
||||
With a new line<br> |
With a new line<br> |
||||
<br> |
<br> |
||||
The second part of the verse<br> |
The second part of the verse<br> |
||||
Is this line |
Is this line |
||||
</p> |
</p> |
||||
|
|
||||
<p class="verse"> |
<p class="verse">Here is a new line at the end<br> |
||||
Here is a new line at the end<br> |
|
||||
|
|
||||
</p> |
</p> |
||||
|
|
||||
<p class="verse"> |
<p class="verse">Foo bar |
||||
Foo bar |
|
||||
</p> |
</p> |
||||
|
|
||||
<p class="verse"> |
<p class="verse"><br> |
||||
<br> |
|
||||
And a new line<br> |
And a new line<br> |
||||
At the beginning |
At the beginning |
||||
</p> |
</p> |
||||
|
|
||||
<p class="chorus"> |
<p class="chorus">New lines can also<br> |
||||
New lines can also<br> |
|
||||
<br> |
<br> |
||||
Be in chorus |
Be in chorus |
||||
</p> |
</p> |
||||
|
|
||||
<p class="bridge"> |
<p class="bridge">New lines can also<br> |
||||
New lines can also<br> |
|
||||
<br> |
<br> |
||||
Be in bridges |
Be in bridges |
||||
</p> |
</p> |
||||
|
|
||||
<p class="verse"> |
<p class="verse">New lines can also<br> |
||||
New lines can also<br> |
|
||||
<br> |
<br> |
||||
Be surrounded by spaces |
Be surrounded by spaces |
||||
</p> |
</p> |
||||
|
|
||||
<p class="verse"> |
<p class="verse">New lines cannot |
||||
New lines cannot |
|
||||
</p> |
</p> |
||||
</div> |
</div> |
@ -1,10 +1,10 @@ |
|||||
\beginsong{Image included from datadir\\\LaTeX} |
\beginsong{Image included from datadir\\\LaTeX} |
||||
[cov={datadir}] |
[cov={img/datadir}] |
||||
|
|
||||
\cover |
\cover |
||||
|
|
||||
\lilypond{datadir.ly} |
\lilypond{scores/datadir.ly} |
||||
|
|
||||
\image{datadir} |
\image{img/datadir} |
||||
|
|
||||
\endsong |
\endsong |
||||
|
@ -1,10 +1,10 @@ |
|||||
\beginsong{Image included from a different datadir\\\LaTeX} |
\beginsong{Image included from a different datadir\\\LaTeX} |
||||
[cov={datadir2}] |
[cov={img/datadir2}] |
||||
|
|
||||
\cover |
\cover |
||||
|
|
||||
\lilypond{datadir2.ly} |
\lilypond{scores/datadir2.ly} |
||||
|
|
||||
\image{datadir2} |
\image{img/datadir2} |
||||
|
|
||||
\endsong |
\endsong |
||||
|
Loading…
Reference in new issue