From 02b29f13f32859e488d7a2976ec1ccaa1866c0bf Mon Sep 17 00:00:00 2001 From: Jim Hague Date: Mon, 9 Oct 2017 17:30:31 +0100 Subject: [PATCH] Add subtitle if present in tune links. --- abcfield.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/abcfield.py b/abcfield.py index 05d8c94..cb3db54 100755 --- a/abcfield.py +++ b/abcfield.py @@ -181,7 +181,12 @@ def expandCustomMarkdown(t, dir, latex): fname = m.group(1) + ".abc" path = pathlib.Path(dir, fname) with path.open() as f: - return "[" + getFieldDisplayText(f, dir, "T", latex) + "](" + fname + ")" + title = getFieldDisplayText(f, dir, "T", latex=latex) + f.seek(0) + subtitle = getFieldDisplayText(f, dir, "T", n=2, latex=latex) + if len(subtitle) > 0: + title = title + " (" + subtitle + ")" + return "[" + title + "](" + fname + ")" return re.sub(r'<(.*?).abc>', getTitle, t) # Return the raw text for a given field. Optionally the nth field is taken,