Update footnotes for new Python-Markdown
This commit is contained in:
parent
d9e8e02831
commit
84493063fd
@ -15,7 +15,7 @@
|
|||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import markdown
|
import markdown
|
||||||
import markdown.extensions.admonition, markdown.extensions.extra, markdown.extensions.footnotes, markdown.extensions.attr_list
|
import markdown.extensions.admonition, markdown.extensions.md_in_html, markdown.extensions.footnotes, markdown.extensions.attr_list
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import xml.etree.ElementTree as ET
|
import xml.etree.ElementTree as ET
|
||||||
@ -33,7 +33,7 @@ class WNMarkdown(markdown.Markdown):
|
|||||||
|
|
||||||
# Markdown in HTML
|
# Markdown in HTML
|
||||||
self.preprocessors['html_block'].markdown_in_raw = True
|
self.preprocessors['html_block'].markdown_in_raw = True
|
||||||
self.parser.blockprocessors.register(markdown.extensions.extra.MarkdownInHtmlProcessor(self.parser), 'markdown_block', 105)
|
self.parser.blockprocessors.register(markdown.extensions.md_in_html.MarkdownInHtmlProcessor(self.parser), 'markdown_block', 105)
|
||||||
self.parser.blockprocessors.tag_counter = -1
|
self.parser.blockprocessors.tag_counter = -1
|
||||||
self.parser.blockprocessors.contain_span_tags = re.compile(r'^(p|h[1-6]|li|dd|dt|td|th|legend|address)$', re.IGNORECASE)
|
self.parser.blockprocessors.contain_span_tags = re.compile(r'^(p|h[1-6]|li|dd|dt|td|th|legend|address)$', re.IGNORECASE)
|
||||||
|
|
||||||
@ -397,7 +397,7 @@ class FootnoteExtension(markdown.extensions.footnotes.FootnoteExtension):
|
|||||||
md.registerExtension(self)
|
md.registerExtension(self)
|
||||||
self.parser = md.parser
|
self.parser = md.parser
|
||||||
self.md = md
|
self.md = md
|
||||||
md.preprocessors.register(markdown.extensions.footnotes.FootnotePreprocessor(self), 'footnote', 15)
|
md.parser.blockprocessors.register(markdown.extensions.footnotes.FootnoteBlockProcessor(self), 'footnote', 17)
|
||||||
FOOTNOTE_RE = r'\[\^([^\]]*)\]' # blah blah [^1] blah
|
FOOTNOTE_RE = r'\[\^([^\]]*)\]' # blah blah [^1] blah
|
||||||
md.inlinePatterns.register(FootnoteInlineProcessor(FOOTNOTE_RE, self), 'footnote', 175)
|
md.inlinePatterns.register(FootnoteInlineProcessor(FOOTNOTE_RE, self), 'footnote', 175)
|
||||||
md.treeprocessors.register(markdown.extensions.footnotes.FootnoteTreeprocessor(self), 'footnote', 50)
|
md.treeprocessors.register(markdown.extensions.footnotes.FootnoteTreeprocessor(self), 'footnote', 50)
|
||||||
|
Reference in New Issue
Block a user