Replace Change and Credit with Markdown-enabled Notes section.

Data in Notes is taken from N: section starting "Dottes:".
This commit is contained in:
Jim Hague 2016-11-02 15:02:06 +00:00
parent 945454da9d
commit 3061852caf
5 changed files with 19 additions and 49 deletions

View File

@ -56,30 +56,20 @@ if __name__ == "__main__":
lines = f.readlines()
input_path = pathlib.Path(args.input.name)
fname = input_path.stem
fdir = input_path.parent
vars = dict()
vars["changename"] = ""
vars["changetitle"] = ""
vars["changevisibility"] = "no"
vars["creditvisibility"] = "no"
vars["notesvisibility"] = "no"
vars["name"] = input_path.stem
vars["title"] = getFieldDisplayText(lines, "T", latex=args.latex)
vars["subtitle"] = getFieldDisplayText(lines, "T", n=2, latex=args.latex)
vars["composer"] = getFieldDisplayText(lines, "C", latex=args.latex)
vars["key"] = getFieldDisplayText(lines, "K", latex=args.latex)
vars["changefile"] = getFieldDisplayText(lines, "N", starts="Change:", latex=args.latex)
vars["credit"] = getFieldDisplayText(lines, "N", starts="Credit:", latex=args.latex)
if vars["changefile"]:
vars["changevisibility"] = "yes"
vars["changename"] = pathlib.Path(vars["changefile"]).stem
cf = pathlib.Path(input_path.parent, vars["changefile"])
with cf.open() as f:
vars["changetitle"] = getFieldDisplayText(f, "T", latex=args.latex)
if vars["credit"]:
vars["creditvisibility"] = "yes"
vars["name"] = fname
vars["title"] = getFieldDisplayText(lines, fdir, "T", latex=args.latex)
vars["subtitle"] = getFieldDisplayText(lines, fdir, "T", n=2, latex=args.latex)
vars["composer"] = getFieldDisplayText(lines, fdir, "C", latex=args.latex)
vars["key"] = getFieldDisplayText(lines, fdir, "K", latex=args.latex)
vars["notes"] = getFieldDisplayText(lines, fdir, "N", starts="Dottes:", latex=args.latex)
if vars["notes"]:
vars["notesvisibility"] = "yes"
for val in args.values:
keyval = val.partition("=")

View File

@ -43,12 +43,8 @@
</div>
</div>
<img class="dottes-png" src="${name}.png" alt="${title} dots">
<div class="dottes-credit-${creditvisibility}">
From ${credit}.
</div>
<div class="dottes-change-${changevisibility}">
Change: <a class="dottes-change-link"
href="${changename}.html">${changetitle}</a>
<div class="dottes-notes-${notesvisibility}">
${notes}
</div>
<div class="dottes-tune-footer">
<div class="dottes-tune-footer-row">

View File

@ -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, credit.
\newcommand{\showtune}[8]{%
% filename, notes.
\newcommand{\showtune}[6]{%
\phantomsection
\begin{tabularx}{\textwidth}{LCR}
\addcontentsline{toc}{section}{#2}
@ -59,11 +59,8 @@
\multicolumn{3}{c}{%
\includegraphics[width=\textwidth,height=0.8\textheight,keepaspectratio]{#5}%
}\tabularnewline
\multicolumn{3}{p{\textwidth}}{%
\ifemptyarg{#8}{}{From {#8}. }%
\ifemptyarg{#6}{}{Change: \hyperlink{#6}{#7}.}%
}\tabularnewline
\end{tabularx}
#6
\vfill
}

View File

@ -1 +1 @@
\showtune{$name}{$title}{$subtitle}{$composer}{$graphicsdir/$name}{$changename}{$changetitle}{$credit}
\showtune{$name}{$title}{$subtitle}{$composer}{$graphicsdir/$name}{$notes}

View File

@ -266,24 +266,11 @@ div.dottes-tune-list-item-image
vertical-align: middle;
}
div.dottes-change-no
div.dottes-notes-no
{
display: none;
}
div.dottes-change-yes
{
}
div.dottes-change-link
{
}
div.dottes-credit-no
{
display: none;
}
div.dottes-credit-yes
div.dottes-notes-yes
{
}