Mercurial > dottes
changeset 326:27f29e8aafea
Add --contains flag to abcfield.py.
Currently we rely on any N: field with a Change: subnotice being the first
N: field. Add --contains field to abcfield.py to remove this restriction.
Also use it to extract new subfield Credit: and add that if present
to the tune information in print and on web.
author | Jim Hague <jim.hague@acm.org> |
---|---|
date | Sun, 04 Aug 2013 22:09:25 +0100 |
parents | 21615733c3f3 |
children | 55afb58d4a9a |
files | Session/AllInAGardenGreen.abc Session/ButteredPeas.abc Session/OrangeInBloom.abc abcfield.py dottes.html.tune dottes.tex makeBookeTunePages.sh makeWeb.sh web/css/dottes.css |
diffstat | 9 files changed, 40 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/Session/AllInAGardenGreen.abc Sun Aug 04 21:28:05 2013 +0100 +++ b/Session/AllInAGardenGreen.abc Sun Aug 04 22:09:25 2013 +0100 @@ -5,6 +5,7 @@ O:England Z:Paul Hardy's Session Tunebook 2013 (see www.paulhardy.net). Creative Commons cc by-nc-sa licenced. N: Change: GatheringPeascods.abc +N: Credit: Paul Hardy's Session Tunebook M:2/2 L:1/8 Q:1/2=90
--- a/Session/ButteredPeas.abc Sun Aug 04 21:28:05 2013 +0100 +++ b/Session/ButteredPeas.abc Sun Aug 04 22:09:25 2013 +0100 @@ -3,6 +3,7 @@ R:Polka O:England Z:Paul Hardy's Session Tunebook 2013 (see www.paulhardy.net). Creative Commons cc by-nc-sa licenced. +N: Credit: Paul Hardy's Session Tunebook M:2/2 L:1/8 Q:1/4=180
--- a/Session/OrangeInBloom.abc Sun Aug 04 21:28:05 2013 +0100 +++ b/Session/OrangeInBloom.abc Sun Aug 04 22:09:25 2013 +0100 @@ -3,6 +3,7 @@ T:Sherborne Waltz R:Waltz O:England +N: Credit: Paul Hardy's Session Tunebook Z:Paul Hardy's Session Tunebook 2013 (see www.paulhardy.net). Creative Commons cc by-nc-sa licenced. M:3/4 L:1/8
--- a/abcfield.py Sun Aug 04 21:28:05 2013 +0100 +++ b/abcfield.py Sun Aug 04 22:09:25 2013 +0100 @@ -109,6 +109,9 @@ for line in inf: line = line.strip() if len(line) > 2 and line[0] == options.field and line[1] == ':': + if len(options.contains) > 0: + if line.find(options.contains) < 0: + continue if n > 1: n = n - 1 else: @@ -129,6 +132,10 @@ action="store", type="int", default=1, help="report INDEXth value [default: %default]", metavar="INDEX") +parser.add_option("-c", "--contains", dest="contains", + action="store", type="string", default="", + help="report only if line contains CONTENT", + metavar="CONTENT") (options, args) = parser.parse_args() if options.html and options.latex:
--- a/dottes.html.tune Sun Aug 04 21:28:05 2013 +0100 +++ b/dottes.html.tune Sun Aug 04 22:09:25 2013 +0100 @@ -34,6 +34,9 @@ </div> </div> <img class="dottes-png" src="@TUNE@.png" alt="@TITLE@ dots"> + <div class="dottes-credit-@CREDITVISIBILITY@"> + From @CREDIT@. + </div> <div class="dottes-change-@CHANGEVISIBILITY@"> Change: <a class="dottes-change-link" href="@CHANGETUNE@">@CHANGETITLE@</a>
--- a/dottes.tex Sun Aug 04 21:28:05 2013 +0100 +++ b/dottes.tex Sun Aug 04 22:09:25 2013 +0100 @@ -47,8 +47,8 @@ % Show the main tune graphic and optional change. % Args are tune name, tune title, tune subtitle, composer, tune graphic -% filename, change name, change title. -\newcommand{\showtune}[7]{% +% filename, change name, change title, credit. +\newcommand{\showtune}[8]{% \vfill \begin{center} \phantomsection @@ -63,8 +63,11 @@ } \addcontentsline{toc}{section}{#2} \end{center} + \ifemptyarg{#8}{}{% + From {#8}. + }% \ifemptyarg{#6}{}{% - Change: \hyperlink{#6}{#7} + Change: \hyperlink{#6}{#7}. }% }
--- a/makeBookeTunePages.sh Sun Aug 04 21:28:05 2013 +0100 +++ b/makeBookeTunePages.sh Sun Aug 04 22:09:25 2013 +0100 @@ -44,7 +44,7 @@ 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 --contains "Change:" $filename | sed -e "s/Change: *//"` changename="" changetitle="" if [ -n "$changefile" ]; then @@ -53,7 +53,9 @@ fixtitle "$changetitle" changetitle=$retval fi - echo -E "\showtune{$name}{$title}{$subtitle}{$composer}{$graphicsdir/$name}{$changename}{$changetitle}" >> $tunesoutput + + credit=`$dir/abcfield.py --field N --contains "Credit:" $filename | sed -e "s/Credit: *//"` + echo -E "\showtune{$name}{$title}{$subtitle}{$composer}{$graphicsdir/$name}{$changename}{$changetitle}{$credit}" >> $tunesoutput echo -E "\showfirstline{$name}{$title}{$graphicsdir/firstline-$name}" >> $indexoutput done
--- a/makeWeb.sh Sun Aug 04 21:28:05 2013 +0100 +++ b/makeWeb.sh Sun Aug 04 22:09:25 2013 +0100 @@ -67,7 +67,7 @@ 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 --contains "Change:" $filename | sed -e "s/Change: *//"` changetitle="" changevisibility="no" if [ -n "$changefile" ]; then @@ -77,6 +77,11 @@ fixtitle "$changetitle" changetitle=$retval fi + credit=`$dir/abcfield.py --field N --contains "Credit:" $filename | sed -e "s/Credit: *//"` + creditvisibility="no" + if [ -n "$credit" ]; then + creditvisibility="yes" + fi # Copy the ABC into the web. cp $filename $webdir @@ -93,6 +98,8 @@ -e "s/@CHANGETITLE@/${changetitle//&/\&}/" \ -e "s/@CHANGETUNE@/${changefile/.abc/.html}/" \ -e "s/@CHANGEVISIBILITY@/${changevisibility}/" \ + -e "s/@CREDIT@/${credit}/" \ + -e "s/@CREDITVISIBILITY@/${creditvisibility}/" \ -e "s/@TUNE@/${name}/" dottes.html.tune > $webdir/$tunepage sed -e "s/@TITLE@/${title//&/\&}/" \