comparison abcfield.py @ 728:9b562923ac71

Fix full title text in markdown - getFullTitle() needs a list of lines.
author Jim Hague <jim.hague@acm.org>
date Wed, 11 Oct 2017 18:05:32 +0100
parents 772402f5f8ea
children 841f7c19cb55
comparison
equal deleted inserted replaced
727:772402f5f8ea 728:9b562923ac71
183 # title (and subtitle, if present) of the tune as the text of the link. 183 # title (and subtitle, if present) of the tune as the text of the link.
184 def getTitleLink(m): 184 def getTitleLink(m):
185 fname = m.group(1) + ".abc" 185 fname = m.group(1) + ".abc"
186 path = pathlib.Path(dir, fname) 186 path = pathlib.Path(dir, fname)
187 with path.open() as f: 187 with path.open() as f:
188 return "[" + getFullTitle(f, dir, latex=latex) + "](" + fname + ")" 188 lines = f.readlines()
189 return "[" + getFullTitle(lines, dir, latex=latex) + "](" + fname + ")"
189 return re.sub(r'<(.*?).abc>', getTitleLink, t) 190 return re.sub(r'<(.*?).abc>', getTitleLink, t)
190 191
191 # Return the raw text for a given field. Optionally the nth field is taken, 192 # Return the raw text for a given field. Optionally the nth field is taken,
192 # or the field data must start with a designated string to be recognised. 193 # or the field data must start with a designated string to be recognised.
193 def getFieldText(lines, field, n = 1, starts = None): 194 def getFieldText(lines, field, n = 1, starts = None):