Render tune title, subtitle and composer in Latex/HTML and not in the image.

This way the titles remains a constant size even if the image needs to be scaled.
And we have that text appearance under our control.

I can't find a way of switching off the tune title in abcm2ps, and have worked around
by setting the title format to Y0. Y is not a defined ABC header and is not found in
any Dottes tune.
This commit is contained in:
Jim Hague 2013-07-16 16:35:07 +01:00
parent 470ad386fc
commit d8357c8cec
7 changed files with 105 additions and 31 deletions

View File

@ -20,22 +20,35 @@
</a> </a>
<div class="grid_12 dottes-body"> <div class="grid_12 dottes-body">
<h1>@TITLE@</h1> <div class="dottes-tune-display">
<img class="dottes-png" src="@TUNE@.png" alt="@TITLE@ dots"> <div class="dottes-tune-header">
<div class="dottes-change-@CHANGEVISIBILITY@"> <div class="dottes-tune-header-row">
Change: <a class="dottes-change-link" <div class="dottes-tune-header-left"></div>
href="@CHANGETUNE@">@CHANGETITLE@</a> <div class="dottes-tune-header-middle">
<h1>@TITLE@</h1>
<h2>@SUBTITLE@</h2>
</div>
<div class="dottes-tune-header-right">
<em>@COMPOSER@</em>
</div>
</div>
</div>
<img class="dottes-png" src="@TUNE@.png" alt="@TITLE@ dots">
<div class="dottes-change-@CHANGEVISIBILITY@">
Change: <a class="dottes-change-link"
href="@CHANGETUNE@">@CHANGETITLE@</a>
</div>
<ul class="tune-data-list">
<li><a class="dottes-link-tune dottes-pdf"
href="@TUNE@.pdf">PDF</a></li>
<li><a class="dottes-link-tune dottes-midi"
href="../@MASTERBOOKE@/@TUNE@.mid">MIDI</a></li>
<li><a class="dottes-link-tune dottes-mp3"
href="../@MASTERBOOKE@/@TUNE@.mp3">MP3</a></li>
<li><a class="dottes-link-tune dottes-abc"
href="@TUNE@.abc">ABC</a></li>
</ul>
</div> </div>
<ul class="tune-data-list">
<li><a class="dottes-link-tune dottes-pdf"
href="@TUNE@.pdf">PDF</a></li>
<li><a class="dottes-link-tune dottes-midi"
href="../@MASTERBOOKE@/@TUNE@.mid">MIDI</a></li>
<li><a class="dottes-link-tune dottes-mp3"
href="../@MASTERBOOKE@/@TUNE@.mp3">MP3</a></li>
<li><a class="dottes-link-tune dottes-abc"
href="@TUNE@.abc">ABC</a></li>
</ul>
</div> </div>
</div> </div>

View File

@ -47,17 +47,23 @@
% Show the main tune graphic and optional change. % Show the main tune graphic and optional change.
% Args are change title (optional), tune title, tune graphic filename. % Args are change title (optional), tune title, tune graphic filename.
\newcommand{\showtune}[3][]{% \newcommand{\showtune}[5]{%
\vfill \vfill
\begin{center} \begin{center}
\phantomsection \phantomsection
\hypertarget{#2}{% \begin{tabular*}{\textwidth}{@{} p{0.25\textwidth} @{\extracolsep{\fill}} c >{\raggedleft\arraybackslash}p{0.25\textwidth} @{}}
\includegraphics[width=\textwidth,height=0.85\textheight,keepaspectratio]{#3} & \Large{#1} & \emph{#3} \\
\ifemptyarg{#2}{}{%
& #2 & \\
}%
\end{tabular*}
\hypertarget{#1}{%
\includegraphics[width=\textwidth,height=0.85\textheight,keepaspectratio]{#4}
} }
\addcontentsline{toc}{section}{#2} \addcontentsline{toc}{section}{#1}
\end{center} \end{center}
\ifemptyarg{#1}{}{% \ifemptyarg{#5}{}{%
Change: \hyperlink{#1}{#1} Change: \hyperlink{#5}{#5}
}% }%
} }

View File

@ -2,7 +2,7 @@
continueall false continueall false
measurenb false measurenb false
writefields SRBDZHN 0 writefields SRBDZHN 0
titleformat titleformat Y0
titlespace 0 titlespace 0
topspace 0 topspace 0
infoline false infoline false

View File

@ -41,6 +41,8 @@ find $booke -name "*.abc" | sort |
title=`$dir/abcfield.py --field T --latex $filename` title=`$dir/abcfield.py --field T --latex $filename`
fixtitle "$title" fixtitle "$title"
title=$retval title=$retval
subtitle=`$dir/abcfield.py --index 2 --field T --latex $filename`
composer=`$dir/abcfield.py --field C --latex $filename`
changefile=`$dir/abcfield.py --field N $filename | grep "Change:" | sed -e "s/Change: *//"` changefile=`$dir/abcfield.py --field N $filename | grep "Change:" | sed -e "s/Change: *//"`
changetitle="" changetitle=""
@ -49,7 +51,7 @@ find $booke -name "*.abc" | sort |
fixtitle "$changetitle" fixtitle "$changetitle"
changetitle=$retval changetitle=$retval
fi fi
echo -E "\showtune[$changetitle]{$title}{$graphicsdir/$name}" >> $tunesoutput echo -E "\showtune{$title}{$subtitle}{$composer}{$graphicsdir/$name}{$changetitle}" >> $tunesoutput
echo -E "\showfirstline{$title}{$graphicsdir/firstline-$name}" >> $indexoutput echo -E "\showfirstline{$title}{$graphicsdir/firstline-$name}" >> $indexoutput
done done

View File

@ -65,6 +65,8 @@ find $bookedir -name "*.abc" | sort |
title=`$dir/abcfield.py --field T --html $filename` title=`$dir/abcfield.py --field T --html $filename`
fixtitle "$title" fixtitle "$title"
title=$retval title=$retval
subtitle=`$dir/abcfield.py --index 2 --field T --latex $filename`
composer=`$dir/abcfield.py --field C --latex $filename`
changefile=`$dir/abcfield.py --field N $filename | grep "Change:" | sed -e "s/Change: *//"` changefile=`$dir/abcfield.py --field N $filename | grep "Change:" | sed -e "s/Change: *//"`
changetitle="" changetitle=""
changevisibility="no" changevisibility="no"
@ -88,6 +90,8 @@ find $bookedir -name "*.abc" | sort |
# If the title contains HTML character entities, escape # If the title contains HTML character entities, escape
# initial '&' in the title - it means things to sed. # initial '&' in the title - it means things to sed.
sed -e "s/@TITLE@/${title//&/\&}/" \ sed -e "s/@TITLE@/${title//&/\&}/" \
-e "s/@SUBTITLE@/${subtitle}/" \
-e "s/@COMPOSER@/${composer}/" \
-e "s/@MASTERBOOKE@/${masterbooke}/" \ -e "s/@MASTERBOOKE@/${masterbooke}/" \
-e "s/@CHANGETITLE@/${changetitle//&/\&}/" \ -e "s/@CHANGETITLE@/${changetitle//&/\&}/" \
-e "s/@CHANGETUNE@/${changefile/.abc/.html}/" \ -e "s/@CHANGETUNE@/${changefile/.abc/.html}/" \

View File

@ -6,7 +6,7 @@ leftmargin 0
rightmarin 0 rightmarin 0
topmargin 0 topmargin 0
scale 0.9 scale 0.9
titleformat T0 C1 titleformat Y0
titlespace 0 titlespace 0
topspace 0 topspace 0
% I don't want any info fields in the graphics. To turn off the % I don't want any info fields in the graphics. To turn off the
@ -18,6 +18,6 @@ infoname D
infoname Z infoname Z
infoname H infoname H
infoname N infoname N
infoline true infoline false
writehistory true writehistory true
continueall false continueall false

View File

@ -11,7 +11,6 @@ body {
h1 { h1 {
background: white; background: white;
font-weight: normal;
text-align: center; text-align: center;
font-size: 25px; font-size: 25px;
font-weight: bold; font-weight: bold;
@ -121,6 +120,56 @@ div.dottes-transpose-tune-types
width: 30%; width: 30%;
} }
div.dottes-tune-display
{
margin: 10px;
}
div.dottes-tune-header
{
display: table;
width: 100%;
}
div.dottes-tune-header-row
{
display: table-row;
}
div.dottes-tune-header-left
{
display: table-cell;
width: 25%;
}
div.dottes-tune-header-middle
{
display: table-cell;
}
div.dottes-tune-header-middle h1
{
font-size: 25px;
font-weight: bold;
text-align: center;
margin: 0px;
}
div.dottes-tune-header-middle h2
{
font-size: 15px;
font-weight: normal;
text-align: center;
margin: 0px;
}
div.dottes-tune-header-right
{
display: table-cell;
text-align: right;
width: 25%;
}
a.dottes-tune-link a.dottes-tune-link
{ {
font-size: 20px; font-size: 20px;
@ -143,19 +192,21 @@ img.dottes-png
{ {
display: block; display: block;
width: 100%; /* Make image fill width */ width: 100%; /* Make image fill width */
/* margin-left: auto; /* Centre image */ margin-top: 10px;
/* margin-right: auto; */ margin-bottom: 10px;
} }
ul.tune-data-list ul.tune-data-list
{ {
list-style-type: none; list-style-type: none;
margin: 0px;
} }
ul.tune-data-list li ul.tune-data-list li
{ {
display: inline; display: inline;
margin: 10px; margin-left: 0;
margin-right: 20px;
} }
div.dottes-tune-list div.dottes-tune-list
@ -188,8 +239,6 @@ div.dottes-change-no
div.dottes-change-yes div.dottes-change-yes
{ {
display: block;
margin: 10px;
} }
div.dottes-change-link div.dottes-change-link