diff --git a/folium/map.py b/folium/map.py index d07699320..5dfab8744 100644 --- a/folium/map.py +++ b/folium/map.py @@ -8,7 +8,7 @@ from branca.element import Element, Figure, Html, MacroElement -from folium.utilities import camelize, parse_options, validate_location +from folium.utilities import camelize, parse_options, validate_location, escape_backticks from jinja2 import Template @@ -362,8 +362,7 @@ def __init__(self, html=None, parse_html=False, max_width='100%', if isinstance(html, Element): self.html.add_child(html) elif isinstance(html, str): - # escape backticks because we use those in the JS template - html = re.sub(r"(?back\\`tick`)[0]; + var {html_name} = $(`
back\\`tick\\`tick
`)[0]; {popup_name}.setContent({html_name}); {map_name}.bindPopup({popup_name}); """.format(popup_name=popup.get_name(), html_name=list(popup.html._children.keys())[0], map_name=m.get_name()) - # assert compare_rendered(rendered, expected) assert normalize(rendered) == normalize(expected) @@ -117,7 +116,6 @@ def test_popup_backticks_already_escaped(): """.format(popup_name=popup.get_name(), html_name=list(popup.html._children.keys())[0], map_name=m.get_name()) - # assert compare_rendered(rendered, expected) assert normalize(rendered) == normalize(expected)