Skip to content

Commit

Permalink
Display warning for unsupported data types
Browse files Browse the repository at this point in the history
This fixes #50.
  • Loading branch information
mgeier committed May 25, 2016
1 parent 9404e3e commit c6d5b2d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
24 changes: 24 additions & 0 deletions doc/code-cells.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,30 @@
"YouTubeVideo('WAikxUGbomY')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Unsupported Output Types\n",
"\n",
"If a code cell produces data with an unsupported MIME type, the Jupyter Notebook doesn't generate any output.\n",
"`nbsphinx`, however, shows a warning message."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"display({\n",
" 'text/x-python': 'print(\"Hello, world!\")',\n",
" 'text/x-haskell': 'main = putStrLn \"Hello, world!\"',\n",
"}, raw=True)"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down
6 changes: 5 additions & 1 deletion nbsphinx.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
\\end{OriginalVerbatim}
{% else %}
WARNING! Data type not implemented: {{ datatype }}
.. nbwarning:: Data type cannot be displayed: {{ datatype }}
{%- endif %}
{% endmacro %}
Expand Down Expand Up @@ -797,10 +797,14 @@ def _get_output_type(output):
if datatype in output.data:
html_datatype = datatype
break
else:
html_datatype = ', '.join(output.data.keys())
for datatype in DISPLAY_DATA_PRIORITY_LATEX:
if datatype in output.data:
latex_datatype = datatype
break
else:
latex_datatype = ', '.join(output.data.keys())
return html_datatype, latex_datatype


Expand Down

0 comments on commit c6d5b2d

Please sign in to comment.