aboutsummaryrefslogtreecommitdiffstats
path: root/markdown/extensions/footnotes.py
diff options
context:
space:
mode:
authorWaylan Limberg <waylan@gmail.com>2014-07-31 22:40:33 -0400
committerWaylan Limberg <waylan@gmail.com>2014-07-31 22:40:33 -0400
commit47372051cf9724f1355b1c07c63c4beff9a5f626 (patch)
tree82130393bfa7118cab45a80579fbed2eeed05261 /markdown/extensions/footnotes.py
parentaae373860b5c5cbb40f126bf5acb9693dc577c4a (diff)
downloadmarkdown-47372051cf9724f1355b1c07c63c4beff9a5f626.tar.gz
markdown-47372051cf9724f1355b1c07c63c4beff9a5f626.tar.bz2
markdown-47372051cf9724f1355b1c07c63c4beff9a5f626.zip
Update extensions for Extension.__init__ refactor
Fixes #325. All extensions can now accept a dict of configs or **kwargs, not just a list of tuples. Third party extensions may want to follow suite. Extensions may only accept keyword arguments in the future. These changes still need to be documented. A couple things of note: The CodeHilite extension previously issued a DeprecationWarning if the old config key `force_linenos` was used. With thins change, a KeyError will now be raised. The `markdown.util.parseBoolValue` function gained a new argument: `preserve_none` (defaults to False), which when set to True, will pass None through unaltered (will not convert it to False).
Diffstat (limited to 'markdown/extensions/footnotes.py')
-rw-r--r--markdown/extensions/footnotes.py34
1 files changed, 17 insertions, 17 deletions
diff --git a/markdown/extensions/footnotes.py b/markdown/extensions/footnotes.py
index 9f93ad1..cec0d71 100644
--- a/markdown/extensions/footnotes.py
+++ b/markdown/extensions/footnotes.py
@@ -42,23 +42,23 @@ TABBED_RE = re.compile(r'((\t)|( ))(.*)')
class FootnoteExtension(Extension):
""" Footnote Extension. """
- def __init__ (self, configs):
+ def __init__ (self, *args, **kwargs):
""" Setup configs. """
- self.config = {'PLACE_MARKER':
- ["///Footnotes Go Here///",
- "The text string that marks where the footnotes go"],
- 'UNIQUE_IDS':
- [False,
- "Avoid name collisions across "
- "multiple calls to reset()."],
- "BACKLINK_TEXT":
- ["&#8617;",
- "The text string that links from the footnote to the reader's place."]
- }
-
- for key, value in configs:
- self.config[key][0] = value
+ self.config = {
+ 'PLACE_MARKER':
+ ["///Footnotes Go Here///",
+ "The text string that marks where the footnotes go"],
+ 'UNIQUE_IDS':
+ [False,
+ "Avoid name collisions across "
+ "multiple calls to reset()."],
+ "BACKLINK_TEXT":
+ ["&#8617;",
+ "The text string that links from the footnote to the reader's place."]
+ }
+ super(FootnoteExtension, self).__init__(*args, **kwargs)
+
# In multiple invocations, emit links that don't get tangled.
self.unique_prefix = 0
@@ -309,7 +309,7 @@ class FootnotePostprocessor(Postprocessor):
text = text.replace(FN_BACKLINK_TEXT, self.footnotes.getConfig("BACKLINK_TEXT"))
return text.replace(NBSP_PLACEHOLDER, "&#160;")
-def makeExtension(configs=[]):
+def makeExtension(*args, **kwargs):
""" Return an instance of the FootnoteExtension """
- return FootnoteExtension(configs=configs)
+ return FootnoteExtension(*args, **kwargs)