changeset 594:60749c792cde

Replace Change and Credit with Markdown-enabled Notes section. Data in Notes is taken from N: section starting "Dottes:".
author Jim Hague <jim.hague@acm.org>
date Wed, 02 Nov 2016 15:02:06 +0000
parents 82e818c41e81
children 76aa6580b277
files abctemplate.py dottes.html.tune dottes.tex dottes.tex.tune web/css/dottes.css
diffstat 5 files changed, 19 insertions(+), 49 deletions(-) [+]
line wrap: on
line diff
--- a/abctemplate.py	Wed Nov 02 14:59:31 2016 +0000
+++ b/abctemplate.py	Wed Nov 02 15:02:06 2016 +0000
@@ -56,30 +56,20 @@
         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("=")
--- a/dottes.html.tune	Wed Nov 02 14:59:31 2016 +0000
+++ b/dottes.html.tune	Wed Nov 02 15:02:06 2016 +0000
@@ -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">
--- a/dottes.tex	Wed Nov 02 14:59:31 2016 +0000
+++ b/dottes.tex	Wed Nov 02 15:02:06 2016 +0000
@@ -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
 }
 
--- a/dottes.tex.tune	Wed Nov 02 14:59:31 2016 +0000
+++ b/dottes.tex.tune	Wed Nov 02 15:02:06 2016 +0000
@@ -1,1 +1,1 @@
-\showtune{$name}{$title}{$subtitle}{$composer}{$graphicsdir/$name}{$changename}{$changetitle}{$credit}
+\showtune{$name}{$title}{$subtitle}{$composer}{$graphicsdir/$name}{$notes}
--- a/web/css/dottes.css	Wed Nov 02 14:59:31 2016 +0000
+++ b/web/css/dottes.css	Wed Nov 02 15:02:06 2016 +0000
@@ -266,24 +266,11 @@
     vertical-align: middle;
 }
 
-div.dottes-change-no
+div.dottes-notes-no
 {
     display: none;
 }
 
-div.dottes-change-yes
-{
-}
-
-div.dottes-change-link
+div.dottes-notes-yes
 {
 }
-
-div.dottes-credit-no
-{
-    display: none;
-}
-
-div.dottes-credit-yes
-{
-}