@@ -230,14 +230,14 @@ def to_html(
230230 # Serialize config dict to JSON
231231 jconfig = json .dumps (config )
232232
233- script = """
234- if (document.getElementById("{id}")) {{
235- Plotly.newPlot(
236- ' {id}',
237- {data},
238- {layout},
239- {config}
240- ){then_addframes}{then_animate}{then_post_script}
233+ script = """\
234+ if (document.getElementById("{id}")) {{\
235+ Plotly.newPlot(\
236+ " {id}", \
237+ {data},\
238+ {layout},\
239+ {config}\
240+ ){then_addframes}{then_animate}{then_post_script}\
241241 }}""" .format (
242242 id = plotdivid ,
243243 data = jdata ,
@@ -333,25 +333,24 @@ def to_html(
333333 Invalid value of type {typ} received as the include_mathjax argument
334334 Received value: {val}
335335
336- include_mathjax may be specified as False, 'cdn', or a string ending with '.js'
336+ include_mathjax may be specified as False, 'cdn', or a string ending with '.js'
337337 """ .format (
338338 typ = type (include_mathjax ), val = repr (include_mathjax )
339339 )
340340 )
341341
342342 plotly_html_div = """\
343- <div>
344- {mathjax_script}
345- {load_plotlyjs}
346- <div id="{id}" class="plotly-graph-div" \
347- style="height:{height}; width:{width};"></div>
348- <script type="text/javascript">
349- {require_start}
350- window.PLOTLYENV=window.PLOTLYENV || {{}};{base_url_line}
351- {script};
352- {require_end}
353- </script>
354- </div>""" .format (
343+ <div>\
344+ {mathjax_script}\
345+ {load_plotlyjs}\
346+ <div id="{id}" class="plotly-graph-div" \
347+ style="height:{height}; width:{width};">\
348+ </div>\
349+ <script type="text/javascript">\
350+ {require_start}window.PLOTLYENV=window.PLOTLYENV || {{}};{base_url_line}{script};{require_end}\
351+ </script>\
352+ </div>\
353+ """ .format (
355354 mathjax_script = mathjax_script ,
356355 load_plotlyjs = load_plotlyjs ,
357356 id = plotdivid ,
@@ -361,7 +360,7 @@ def to_html(
361360 require_start = require_start ,
362361 script = script ,
363362 require_end = require_end ,
364- )
363+ ). strip ()
365364
366365 if full_html :
367366 return """\
0 commit comments