Mercurial > dottes
comparison abcfield.py @ 846:6bd946700312
Only the first title should be converted to from sort to display order.
Subtitles don't influence display order, so don't need to be touched.
OK, I now have a subtitle with a comma ('Ring the Bell, Watchman').
If it was the main title I'd have to do something else, but it isn't,
so for now...
author | Jim Hague <jim.hague@acm.org> |
---|---|
date | Sat, 23 Mar 2019 06:59:37 +0000 |
parents | 68f926e61d16 |
children | d6e2a281cceb |
comparison
equal
deleted
inserted
replaced
844:a9b44500bd8c | 846:6bd946700312 |
---|---|
134 else: | 134 else: |
135 res += "\\" + abc | 135 res += "\\" + abc |
136 return res | 136 return res |
137 | 137 |
138 # Convert Title fields from sort to display, so Bat, The->The Bat. | 138 # Convert Title fields from sort to display, so Bat, The->The Bat. |
139 # This only happens for the main title, i.e. the first title in a tune. | |
140 # Subtitles are not affected, as they don't influence sort order. | |
139 def convertTitleToDisplay(t): | 141 def convertTitleToDisplay(t): |
140 p = t.rpartition(',') | 142 p = t.rpartition(',') |
141 if p[1] == "": | 143 if p[1] == "": |
142 return t | 144 return t |
143 else: | 145 else: |
226 res = getFieldText(lines, field, n, starts) | 228 res = getFieldText(lines, field, n, starts) |
227 if res: | 229 if res: |
228 # Fields that go through Markdown must have HTML entities. | 230 # Fields that go through Markdown must have HTML entities. |
229 mdfield = field.upper() in ['H', 'N']; | 231 mdfield = field.upper() in ['H', 'N']; |
230 res = convertAccents(res, False if mdfield else latex) | 232 res = convertAccents(res, False if mdfield else latex) |
231 if field.upper() == "T": | 233 if field.upper() == "T" and n == 1: |
232 res = convertTitleToDisplay(res) | 234 res = convertTitleToDisplay(res) |
233 elif field.upper() == "K": | 235 elif field.upper() == "K": |
234 res = convertKeyToDisplay(res) | 236 res = convertKeyToDisplay(res) |
235 elif mdfield: | 237 elif mdfield: |
236 res = convertMarkdown(expandCustomMarkdown(res, dir), latex) | 238 res = convertMarkdown(expandCustomMarkdown(res, dir), latex) |