From f3f09aae985ec2007940698607b1341c5dec40d5 Mon Sep 17 00:00:00 2001 From: Sami Turcotte Date: Sat, 4 Apr 2015 03:33:33 -0400 Subject: [PATCH] Wrap oEmbed html output in a div To keep a constant aspect ratio for the resulting iframe of an oEmbed request in a responsive website, the iframe needs a div wrapper. With this change, html results are wrapped in a "oembed" class div. --- mdx_oembed/inlinepatterns.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mdx_oembed/inlinepatterns.py b/mdx_oembed/inlinepatterns.py index 9f71fd3..1fbb09d 100644 --- a/mdx_oembed/inlinepatterns.py +++ b/mdx_oembed/inlinepatterns.py @@ -21,8 +21,10 @@ class OEmbedLinkPattern(Pattern): html = self.get_oembed_html_for_match(match) if html is None: return None - placeholder = self.markdown.htmlStash.store(html, True) - return placeholder + else: + html = "
%s
" % html + placeholder = self.markdown.htmlStash.store(html, True) + return placeholder def get_oembed_html_for_match(self, match): url = match.group(3).strip()