@@ -230,14 +230,14 @@ def to_html(
230
230
# Serialize config dict to JSON
231
231
jconfig = json .dumps (config )
232
232
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}\
241
241
}}""" .format (
242
242
id = plotdivid ,
243
243
data = jdata ,
@@ -333,25 +333,24 @@ def to_html(
333
333
Invalid value of type {typ} received as the include_mathjax argument
334
334
Received value: {val}
335
335
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'
337
337
""" .format (
338
338
typ = type (include_mathjax ), val = repr (include_mathjax )
339
339
)
340
340
)
341
341
342
342
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 (
355
354
mathjax_script = mathjax_script ,
356
355
load_plotlyjs = load_plotlyjs ,
357
356
id = plotdivid ,
@@ -361,7 +360,7 @@ def to_html(
361
360
require_start = require_start ,
362
361
script = script ,
363
362
require_end = require_end ,
364
- )
363
+ ). strip ()
365
364
366
365
if full_html :
367
366
return """\
0 commit comments