Add subtitle if present in tune links.

This commit is contained in:
Jim Hague 2017-10-09 17:30:31 +01:00
parent 98f0d36349
commit 02b29f13f3
1 changed files with 6 additions and 1 deletions

View File

@ -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,