Reconcile with Markdown 2.6

Updated the initialization of OEmbedExtension to be compatible with
Markdown 2.6. See https://pythonhosted.org/Markdown/release-2.6.html
This commit is contained in:
Sami Turcotte 2015-04-02 03:47:33 -04:00
parent 469e696a95
commit c3a4466eca
2 changed files with 12 additions and 12 deletions

View file

@ -2,10 +2,8 @@
from mdx_oembed.extension import OEmbedExtension from mdx_oembed.extension import OEmbedExtension
VERSION = '0.1.4' VERSION = '0.1.5'
def makeExtension(configs=None): def makeExtension(**kwargs):
if isinstance(configs, list): return OEmbedExtension(**kwargs)
configs = dict(configs)
return OEmbedExtension(configs=configs)

View file

@ -10,13 +10,15 @@ AVAILABLE_ENDPOINTS = ENDPOINTS.keys()
class OEmbedExtension(Extension): class OEmbedExtension(Extension):
config = { def __init__(self, **kwargs):
'allowed_endpoints': [ self.config = {
AVAILABLE_ENDPOINTS, 'allowed_endpoints': [
"A list of oEmbed endpoints to allow. Possible values are " AVAILABLE_ENDPOINTS,
"{}.".format(', '.join(AVAILABLE_ENDPOINTS)), "A list of oEmbed endpoints to allow. Possible values are "
], "{}.".format(', '.join(AVAILABLE_ENDPOINTS)),
} ],
}
super(OEmbedExtension, self).__init__(**kwargs)
def extendMarkdown(self, md, md_globals): def extendMarkdown(self, md, md_globals):
self.oembed_consumer = self.prepare_oembed_consumer() self.oembed_consumer = self.prepare_oembed_consumer()