Browse Source

Merge pull request #153 from patacrep/nolyrics_shrp_bug

Sharp in LaTeX `\nolyrics` command
pull/152/merge
Louis 9 years ago
parent
commit
085442b583
  1. 2
      patacrep/data/ast_templates/chordpro/latex/content_verse
  2. 2
      test/test_chordpro/nolyrics.tex
  3. 4
      test/test_compilation/syntax.sb
  4. 116
      test/test_compilation/syntax.tex.control
  5. 4
      test/test_compilation/syntax_datadir/songs/musicnote.sgc
  6. 10
      test/test_compilation/test_compilation.py

2
patacrep/data/ast_templates/chordpro/latex/content_verse

@ -6,7 +6,7 @@
\ifchorded
\begin{verse*}
(* for line in content.lines *)
\musicnote {\nolyrics (( render(line) ))}
\musicnote {\nolyrics (( render(line)|replace("#", "{\shrp}") ))}
(* endfor *)
\end{verse*}
\fi

2
test/test_chordpro/nolyrics.tex

@ -14,7 +14,7 @@
\ifchorded
\begin{verse*}
\musicnote {\nolyrics \[A B#]}
\musicnote {\nolyrics \[A B{\shrp}]}
\end{verse*}
\fi

4
test/test_compilation/syntax.sb

@ -0,0 +1,4 @@
{
"datadir": ["syntax_datadir"],
"lang": "en"
}

116
test/test_compilation/syntax.tex.control

@ -0,0 +1,116 @@
%% 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@/syntax_datadir/latex/} %
{@TEST_FOLDER@/latex/} %
{@DATA_FOLDER@/latex/} %
}
\makeatother
\documentclass[
]{article}
\usepackage[
chorded,
diagram,
pictures,
guitar,
]{patacrep}
\usepackage{lmodern}
\PassOptionsToPackage{english}{babel}
\usepackage[english]{babel}
\lang{english}
\usepackage{graphicx}
\graphicspath{ %
{@TEST_FOLDER@/syntax_datadir/} %
{@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{Guitar songbook}
\author{The Patacrep Team}
\newindex{titleidx}{syntax_title}
\newauthorindex{authidx}{syntax_auth}
\notenamesout{A}{B}{C}{D}{E}{F}{G}
\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}
\begin{songs}{titleidx,authidx}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% songs/./musicnote.sgc
\selectlanguage{english}
\beginsong{Song with Sharp in musicnote}[
by={
},
]
\ifchorded
\begin{verse*}
\musicnote {\nolyrics \[Am C{\shrp}m]}
\end{verse*}
\fi
\endsong
\end{songs}
\end{document}

4
test/test_compilation/syntax_datadir/songs/musicnote.sgc

@ -0,0 +1,4 @@
{title : Song with Sharp in musicnote}
{lang: en}
[Am C#m]

10
test/test_compilation/test_compilation.py

@ -38,15 +38,12 @@ class FileTest(unittest.TestCase, metaclass=dynamic.DynamicTest):
'*.sb',
))):
base = songbook[:-len(".sb")]
control = "{}.tex.control".format(base)
if not os.path.exists(control):
continue
yield (
"test_generation_{}".format(os.path.basename(base)),
"test_latex_generation_{}".format(os.path.basename(base)),
cls._create_generation_test(base),
)
yield (
"test_compilation_{}".format(os.path.basename(base)),
"test_pdf_compilation_{}".format(os.path.basename(base)),
cls._create_compilation_test(base),
)
@ -63,6 +60,9 @@ class FileTest(unittest.TestCase, metaclass=dynamic.DynamicTest):
# Check generated tex
control = "{}.tex.control".format(base)
if not os.path.exists(control):
raise unittest.SkipTest('No control file for {}'.format(songbook))
tex = "{}.tex".format(base)
with open_read(control) as expectfile:
with open_read(tex) as latexfile:

Loading…
Cancel
Save