Implement semicolon for page numbers, etc. in footnotes
This commit is contained in:
parent
205a9a8c82
commit
d9e8e02831
@ -427,9 +427,9 @@ class FootnoteExtension(markdown.extensions.footnotes.FootnoteExtension):
|
||||
return div
|
||||
|
||||
class FootnoteInlineProcessor(markdown.extensions.footnotes.FootnoteInlineProcessor):
|
||||
# Override to handle commas
|
||||
# Override to handle commas and semicolons
|
||||
def handleMatch(self, m, data):
|
||||
id = m.group(1).rstrip(',')
|
||||
id = m.group(1).rstrip(',').split(';')[0]
|
||||
if id in self.footnotes.footnotes.keys():
|
||||
sup = ET.Element("sup")
|
||||
sup.set('class', 'footnote-ref')
|
||||
@ -437,8 +437,13 @@ class FootnoteInlineProcessor(markdown.extensions.footnotes.FootnoteInlineProces
|
||||
sup.set('id', self.footnotes.makeFootnoteRefId(id, found=True))
|
||||
a.set('href', '#' + self.footnotes.makeFootnoteId(id))
|
||||
a.text = str(list(self.footnotes.footnotes.keys()).index(id) + 1)
|
||||
|
||||
a.tail = ''
|
||||
if ';' in m.group(1):
|
||||
a.tail += ' ' + m.group(1).rstrip(',').split(';')[1]
|
||||
if m.group(1).endswith(','):
|
||||
a.tail = ','
|
||||
|
||||
return sup, m.start(0), m.end(0)
|
||||
else:
|
||||
return None, None, None
|
||||
|
Reference in New Issue
Block a user