diff abctemplate.py @ 726:833e6185b6a2 build-default-282

Add fulltitle to template fields. fulltitle is title + [(" subtitle ")"] if subtitle is present. To do: extend full title to next and prev. this means exposing it in abcfield.py.
author Jim Hague <jim.hague@acm.org>
date Wed, 11 Oct 2017 17:09:31 +0100
parents 7e9d5852c802
children c81a1ed21877
line wrap: on
line diff
--- a/abctemplate.py	Wed Oct 11 17:03:29 2017 +0100
+++ b/abctemplate.py	Wed Oct 11 17:09:31 2017 +0100
@@ -21,6 +21,7 @@
 # * name. The file base name. Base filename without extension.
 # * title. The tune title.
 # * subtitle. The tune subtitle (second Title field), if any.
+# * fulltitle. The tune title followed, if it exists, by " (" subtitle ")"
 # * tradition. The Morris tradition the dance tune is from.
 # * composer. The tune composer.
 # * key. The tune key.
@@ -37,7 +38,7 @@
 import pathlib
 import string
 
-from abcfield import getFieldDisplayText
+from abcfield import getFieldDisplayText, getFullTitle
 
 if __name__ == "__main__":
     parser = argparse.ArgumentParser(description='Substitute values from ABC file into template.')
@@ -68,6 +69,7 @@
     vars["name"] = fname
     vars["title"] = getFieldDisplayText(lines, fdir, "T", latex=args.latex)
     vars["subtitle"] = getFieldDisplayText(lines, fdir, "T", n=2, latex=args.latex)
+    vars["fulltitle"] = getFullTitle(lines, fdir, latex=args.latex)
     vars["tradition"] = getFieldDisplayText(lines, fdir, "A", latex=args.latex)
     vars["composer"] = getFieldDisplayText(lines, fdir, "C", latex=args.latex)
     vars["key"] = getFieldDisplayText(lines, fdir, "K", latex=args.latex)