Commit d949dfd4 authored by Alain St-Denis's avatar Alain St-Denis
Browse files

Keep height for oembeds if widht is already 100%

parent 5969ba66
Pipeline #6440 passed with stages
in 14 minutes and 6 seconds
......@@ -125,10 +125,15 @@ def fetch_oembed_preview(content, urls):
if not oembed:
# Keep height if width = 100%
if not'\s+width="100%"', oembed):
oembed = re.sub(r'\s+height="[0-9]+"', " ", oembed)
# Ensure width is 100% not fixed
oembed = re.sub(r'\s+width="[0-9]*"', ' width="100%"', oembed)
oembed = re.sub(r'\s+height="[0-9]*"', " ", oembed)
#if url.startswith(""):
oembed = re.sub(r'\s+width="[0-9]+"', ' width="100%"', oembed)
# Wordpress sites use a random token and message events to identify the right iframe in order
# to set the rendered height. For this to work within a masonry grid, the parent script
# must already be loaded. Since in that context the parent script which updates the iframe
# tag with the token is not called, we add it here.
if "wp-embedded-content" in oembed:
oembed = re.sub(r'<script.*</script>', '', oembed, flags=re.S)
oembed = re.sub(r'<blockquote.*</blockquote>', '', oembed)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment