Mercurial > dottes
comparison abcfield.py @ 1026:e4d31e094d24
Changes to get Beginners booke building.
The web pages include prev and next links, so to get those right we
have to make the tune filenames distinct from the main booke names.
So fall back to taking the easy way, and just prefix all tune names with
@ or _.
author | Jim Hague <jim.hague@acm.org> |
---|---|
date | Tue, 18 Feb 2020 15:13:38 +0000 |
parents | fc2b75f6c284 |
children |
comparison
equal
deleted
inserted
replaced
1025:796ef7213ef7 | 1026:e4d31e094d24 |
---|---|
187 # Because we're going through Markdown, character entities must be | 187 # Because we're going through Markdown, character entities must be |
188 # HTML. Pandoc will convert them to UTF-8. | 188 # HTML. Pandoc will convert them to UTF-8. |
189 def getTitleLink(m): | 189 def getTitleLink(m): |
190 fname = m.group(1) + ".abc" | 190 fname = m.group(1) + ".abc" |
191 path = pathlib.Path(dir, fname) | 191 path = pathlib.Path(dir, fname) |
192 if not path.exists(): | |
193 path = pathlib.Path(dir, '@' + fname) | |
194 if not path.exists(): | |
195 path = pathlib.Path(dir, '_' + fname) | |
192 with path.open() as f: | 196 with path.open() as f: |
193 lines = f.readlines() | 197 lines = f.readlines() |
194 return "[" + getFullTitle(lines, dir) + "](" + fname + ")" | 198 return "[" + getFullTitle(lines, dir) + "](" + fname + ")" |
195 return re.sub(r'<(.*?).abc>', getTitleLink, t) | 199 return re.sub(r'<(.*?).abc>', getTitleLink, t) |
196 | 200 |