From c7268a147471695b6ece884e607f9362aecb7baa Mon Sep 17 00:00:00 2001 From: Oliverpool Date: Wed, 20 Jul 2016 22:40:39 +0200 Subject: [PATCH 1/3] Do no espace ~ and ^ --- .../data/templates/songs/chordpro/latex/content_word | 2 +- patacrep/songs/chordpro/__init__.py | 4 ++-- test/test_book/special.tex.control | 11 +++++++++-- test/test_book/special_datadir/songs/special.csg | 2 ++ test/test_song/special.tsg | 4 ++-- 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/patacrep/data/templates/songs/chordpro/latex/content_word b/patacrep/data/templates/songs/chordpro/latex/content_word index ebe4d86f..f52978c4 100644 --- a/patacrep/data/templates/songs/chordpro/latex/content_word +++ b/patacrep/data/templates/songs/chordpro/latex/content_word @@ -1 +1 @@ -(( content.value|escape_specials('{}&#_^%~$\\') )) +(( content.value|escape_specials('{}&#_%$\\') )) diff --git a/patacrep/songs/chordpro/__init__.py b/patacrep/songs/chordpro/__init__.py index 9d10d7b4..7f3a88e1 100644 --- a/patacrep/songs/chordpro/__init__.py +++ b/patacrep/songs/chordpro/__init__.py @@ -132,8 +132,8 @@ class Chordpro2LatexSong(ChordproSong): '{': r'\{', '}': r'\}', '\\': r'\textbackslash{}', - '^': r'\textasciicircum{}', - '~': r'\textasciitilde{}', + '^': r'\textasciicircum{}', # Has special meaning in songs package (repeat chord) + '~': r'\textasciitilde{}', # Used for non-breaking space in LaTeX '#': r'\#', '&': r'\&', '$': r'\$', diff --git a/test/test_book/special.tex.control b/test/test_book/special.tex.control index e2fa50fe..74825e21 100644 --- a/test/test_book/special.tex.control +++ b/test/test_book/special.tex.control @@ -144,13 +144,20 @@ guitar, +\ifchorded +\begin{verse*} + \musicnote {\nolyrics \[A]} +\end{verse*} +\fi + + \begin{verse} - \& \$ \% \# \_ \} \{ \textasciitilde{} \textasciicircum{} \textbackslash{} + \& \$ \% \# \_ \} \{ ~ ^ \textbackslash{} \end{verse} \begin{chorus} - \& \$ \% \# \_ \} \{ \textasciitilde{} \textasciicircum{} \textbackslash{} + \& \$ \% \# \_ \} \{ ~ ^ \textbackslash{} \end{chorus} \endsong diff --git a/test/test_book/special_datadir/songs/special.csg b/test/test_book/special_datadir/songs/special.csg index f5874022..84d3f8be 100644 --- a/test/test_book/special_datadir/songs/special.csg +++ b/test/test_book/special_datadir/songs/special.csg @@ -3,6 +3,8 @@ {album: & $ % # _ \} \{ ~ ^ \\} {url: http://&$%#_~^} +[A] + & $ % \# _ \} \{ ~ ^ \\ {start_of_chorus} diff --git a/test/test_song/special.tsg b/test/test_song/special.tsg index a7b232bb..c5b82988 100644 --- a/test/test_song/special.tsg +++ b/test/test_song/special.tsg @@ -11,12 +11,12 @@ \begin{verse} - \& \$ \% \# \_ \} \{ \textasciitilde{} \textasciicircum{} \textbackslash{} + \& \$ \% \# \_ \} \{ ~ ^ \textbackslash{} \end{verse} \begin{chorus} - \& \$ \% \# \_ \} \{ \textasciitilde{} \textasciicircum{} \textbackslash{} + \& \$ \% \# \_ \} \{ ~ ^ \textbackslash{} \end{chorus} \endsong From 2d790bb3ad05994bc187970890d27d1f223d2e37 Mon Sep 17 00:00:00 2001 From: Oliverpool Date: Wed, 20 Jul 2016 22:44:39 +0200 Subject: [PATCH 2/3] allow tilde in titles and artists --- patacrep/data/templates/songs/chordpro/latex/song | 8 ++++---- test/test_book/special.tex.control | 6 +++--- test/test_song/special.tsg | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/patacrep/data/templates/songs/chordpro/latex/song b/patacrep/data/templates/songs/chordpro/latex/song index af97c285..b1a35715 100644 --- a/patacrep/data/templates/songs/chordpro/latex/song +++ b/patacrep/data/templates/songs/chordpro/latex/song @@ -8,7 +8,7 @@ \beginsong{ (*- for title in titles -*) - (( title|escape_specials('{}&#_^%~$\\') )) + (( title|escape_specials('{}&#_^%$\\') )) (*- if not loop.last -*) \\ (* endif *) @@ -16,7 +16,7 @@ }[ by={ (* for author in authors *) - (( author[1]|escape_specials('{}&#_^%~$\\') )) (( author[0]|escape_specials('{}&#_^%~$\\') )) + (( author[1]|escape_specials('{}&#_^%$\\') )) (( author[0]|escape_specials('{}&#_^%$\\') )) (*- if not loop.last -*) , (* endif *) @@ -24,7 +24,7 @@ }, (* for key in ['album', 'copyright'] *) (* if key in metadata *) - (( key ))={(( metadata[key]|escape_specials('{}&#_^%~$\\') ))}, + (( key ))={(( metadata[key]|escape_specials('{}&#_^%$\\') ))}, (* endif *) (* endfor *) (* if 'url' in metadata *) @@ -39,7 +39,7 @@ (* endblock *) (* endif *) (* for key in metadata.morekeys *) - (( key.keyword ))={(( key.argument|escape_specials('{}&#_^%~$\\') ))}, + (( key.keyword ))={(( key.argument|escape_specials('{}&#_^%$\\') ))}, (* endfor *) ] diff --git a/test/test_book/special.tex.control b/test/test_book/special.tex.control index 74825e21..967a6c22 100644 --- a/test/test_book/special.tex.control +++ b/test/test_book/special.tex.control @@ -134,10 +134,10 @@ guitar, \selectlanguage{english} -\beginsong{\& \$ \% \# \_ \} \{ \textasciitilde{} \textasciicircum{} \textbackslash{}}[ +\beginsong{\& \$ \% \# \_ \} \{ ~ \textasciicircum{} \textbackslash{}}[ by={ - \& \$ \% \# \_ \} \{ \textasciitilde{} \textasciicircum{} \textbackslash{} }, - album={\& \$ \% \# \_ \} \{ \textasciitilde{} \textasciicircum{} \textbackslash{}}, + \& \$ \% \# \_ \} \{ ~ \textasciicircum{} \textbackslash{} }, + album={\& \$ \% \# \_ \} \{ ~ \textasciicircum{} \textbackslash{}}, url={http://&$\%\#_~^}, ] diff --git a/test/test_song/special.tsg b/test/test_song/special.tsg index c5b82988..8011323a 100644 --- a/test/test_song/special.tsg +++ b/test/test_song/special.tsg @@ -1,9 +1,9 @@ \selectlanguage{english} -\beginsong{\& \$ \% \# \_ \} \{ \textasciitilde{} \textasciicircum{} \textbackslash{}}[ +\beginsong{\& \$ \% \# \_ \} \{ ~ \textasciicircum{} \textbackslash{}}[ by={ - \& \$ \% \# \_ \} \{ \textasciitilde{} \textasciicircum{} \textbackslash{} }, - album={\& \$ \% \# \_ \} \{ \textasciitilde{} \textasciicircum{} \textbackslash{}}, + \& \$ \% \# \_ \} \{ ~ \textasciicircum{} \textbackslash{} }, + album={\& \$ \% \# \_ \} \{ ~ \textasciicircum{} \textbackslash{}}, url={http://&$\%\#_~^}, ] From 073b6f3a0aeafd535cb4d7df0f1320a75332077d Mon Sep 17 00:00:00 2001 From: Oliverpool Date: Wed, 20 Jul 2016 22:44:46 +0200 Subject: [PATCH 3/3] update news --- NEWS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS.md b/NEWS.md index 1bb8b80a..9bef0d93 100644 --- a/NEWS.md +++ b/NEWS.md @@ -16,6 +16,7 @@ * The 'error' option is considered for contentlist errors (incorrect syntax for instance) [#226](https://github.com/patacrep/patacrep/pull/226) * Chordpro songs * The `meta` directive is now supported: `{meta: COMMANDNAME:arg}` [#220](https://github.com/patacrep/patacrep/pull/220) + * The `~` and `^` characters will not be escaped [#239](https://github.com/patacrep/patacrep/pull/239) * LaTeX songs * The `meta` directive is now supported: `\metacrep{COMMANDNAME}{arg}` [#220](https://github.com/patacrep/patacrep/pull/220) * Faster index generation [#233](https://github.com/patacrep/patacrep/pull/233)