|
ticket id 000070 |
status resolved |
priority high ★★★ |
assigned to Waylan |
Reported by: Benjamin Bach Component: |
The footnotes extension does not like it if a footnote is not a matching pair.
This works:
Some text[^Footnote]
[^Footnote]: Test
This creates an exception:
Some text[^Footnote]
The exception is:
Traceback:
File "/usr/lib/pymodules/python2.6/markdown/__init__.py" in markdown
598. return md.convert(text)
File "/usr/lib/pymodules/python2.6/markdown/__init__.py" in convert
395. newRoot = treeprocessor.run(root)
File "/usr/lib/pymodules/python2.6/markdown/treeprocessors.py" in run
271. text), child)
File "/usr/lib/pymodules/python2.6/markdown/treeprocessors.py" in __handleInline
95. data, patternIndex, startIndex)
File "/usr/lib/pymodules/python2.6/markdown/treeprocessors.py" in __applyPattern
219. node = pattern.handleMatch(match)
File "/usr/lib/pymodules/python2.6/markdown/extensions/footnotes.py" in handleMatch
269. a.text = str(self.footnotes.footnotes.index(id) + 1)
File "/usr/lib/pymodules/python2.6/markdown/odict.py" in index
120. return self.keyOrder.index(key)
Exception Type: ValueError at /wiki/forside/brygmetoder/_edit/
Exception Value: list.index(x): x not in list
This fixes it (in footnotes.py)
def handleMatch(self, m):
sup = etree.Element("sup")
a = etree.SubElement(sup, "a")
id = m.group(2)
sup.set('id', self.footnotes.makeFootnoteRefId(id))
a.set('href', '#' + self.footnotes.makeFootnoteId(id))
a.set('rel', 'footnote')
try:
a.text = str(self.footnotes.footnotes.index(id) + 1)
return sup
except ValueError:
return None
Resolution
fixed