Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to HTML mime bundle #3574

Merged
merged 5 commits into from
Mar 26, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixed MIME bundle
philippjfr committed Mar 23, 2019
commit aad7bdf68d4f1ee68f80f4419f7221627710f686
10 changes: 6 additions & 4 deletions holoviews/ipython/display_hooks.py
Original file line number Diff line number Diff line change
@@ -142,18 +142,20 @@ def wrapped(element):
mimebundle = fn(element, max_frames=max_frames)
if mimebundle is None:
return {}, {}
html = mimebundle_to_html(mimebundle)
mimebundle = {'text/html': html}, {}
mime_data, mime_metadata = mimebundle
mime_data['text/html'] = mimebundle_to_html(mime_data)
if 'text/javascript' in mime_data:
del mime_data['text/javascript']

# Only want to add to the archive for one display hook...
disabled_suffixes = ['png_display', 'svg_display']
if not any(fn.__name__.endswith(suffix) for suffix in disabled_suffixes):
if type(holoviews.archive) is not FileArchive:
holoviews.archive.add(element, html=html)
holoviews.archive.add(element, html=mime_data['text/html'])
filename = OutputSettings.options['filename']
if filename:
Store.renderers[Store.current_backend].save(element, filename)
return mimebundle
return mime_data, mime_metadata
except SkipRendering as e:
if e.warn:
sys.stderr.write(str(e))