##// END OF EJS Templates
Merge pull request #8083 from minrk/nbconvert-js-mime...
Min RK -
r20759:e6a5a60c merge
parent child Browse files
Show More
@@ -37,7 +37,7 class HTMLExporter(TemplateExporter):
37 37 def default_config(self):
38 38 c = Config({
39 39 'NbConvertBase': {
40 'display_data_priority' : ['text/javascript', 'text/html', 'text/markdown', 'application/pdf', 'image/svg+xml', 'text/latex', 'image/png', 'image/jpeg', 'text/plain']
40 'display_data_priority' : ['application/javascript', 'text/html', 'text/markdown', 'application/pdf', 'image/svg+xml', 'text/latex', 'image/png', 'image/jpeg', 'text/plain']
41 41 },
42 42 'CSSHTMLHeaderPreprocessor':{
43 43 'enabled':True
@@ -5,6 +5,7
5 5
6 6 from .base import ExportersTestsBase
7 7 from ..html import HTMLExporter
8 from IPython.nbformat import v4
8 9 import re
9 10
10 11
@@ -66,3 +67,19 class TestHTMLExporter(ExportersTestsBase):
66 67 (output, resources) = HTMLExporter(template_file='basic').from_filename(
67 68 self._get_notebook(nb_name="pngmetadata.ipynb"))
68 69 assert len(output) > 0
70
71 def test_javascript_output(self):
72 nb = v4.new_notebook(
73 cells=[
74 v4.new_code_cell(
75 outputs=[v4.new_output(
76 output_type='display_data',
77 data={
78 'application/javascript': "javascript_output();"
79 }
80 )]
81 )
82 ]
83 )
84 (output, resources) = HTMLExporter(template_file='basic').from_notebook_node(nb)
85 self.assertIn('javascript_output', output)
@@ -192,7 +192,7 height={{output.metadata['image/jpeg']['height']}}
192 192 {%- block data_javascript scoped %}
193 193 <div class="output_subarea output_javascript {{extra_class}}">
194 194 <script type="text/javascript">
195 {{ output.data['text/javascript'] }}
195 {{ output.data['application/javascript'] }}
196 196 </script>
197 197 </div>
198 198 {%- endblock -%}
General Comments 0
You need to be logged in to leave comments. Login now