-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PR #780 - will be empty after rebasing
- Loading branch information
1 parent
8167971
commit ca4d17e
Showing
3 changed files
with
33 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import re | ||
|
||
|
||
def wrap_iframe_in_div_tag(text): | ||
# iframe tags must be wrapped in a div tag to be displayed correctly | ||
# add div tag if not present | ||
|
||
iframe_regex = r"((<div>)?<iframe[^>]*>.*?<\/iframe>(<\/div>)?)" | ||
|
||
for match, starts_with, ends_with in re.findall(iframe_regex, text, re.DOTALL): | ||
if not starts_with and not ends_with: | ||
text = text.replace(match, f"<div>{match}</div>") | ||
|
||
return text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters