diff --git a/.ipynb_checkpoints/Untitled-checkpoint.ipynb b/.ipynb_checkpoints/Untitled-checkpoint.ipynb index 2fd6442..7b25a5f 100644 --- a/.ipynb_checkpoints/Untitled-checkpoint.ipynb +++ b/.ipynb_checkpoints/Untitled-checkpoint.ipynb @@ -1,6 +1,77 @@ { - "cells": [], - "metadata": {}, + "cells": [ + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "{ { x -> -1 } , { x -> 1 } }" + ] + }, + { + "data": { + "text/html": [ + "{ { x -> -1 } , { x -> 1 } }" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "Solve[x^2-1==0, x]" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "" + ] + }, + { + "data": { + "text/html": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "Plot[x^2, {x, 0, 1}]" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "MathicsKernel", + "language": "Mathematica", + "name": "mathicsnotebook" + }, + "language_info": { + "mimetype": "text/x-mathematica", + "name": "Mathematica", + "version": "1.0" + } + }, "nbformat": 4, "nbformat_minor": 2 } diff --git a/dist/mathicsnotebook-0.1-py2.7.egg b/dist/mathicsnotebook-0.1-py2.7.egg index 4ed0d9d..a2dffc3 100644 Binary files a/dist/mathicsnotebook-0.1-py2.7.egg and b/dist/mathicsnotebook-0.1-py2.7.egg differ diff --git a/mathicsnotebook/kernel.py b/mathicsnotebook/kernel.py index 83418f7..35f4026 100755 --- a/mathicsnotebook/kernel.py +++ b/mathicsnotebook/kernel.py @@ -19,6 +19,14 @@ class MathicsNotebookKernel(Kernel): name = 'MathicsNotebook' + """ + Preprocess output for better support for graphics. + """ + def preprocess_output(self, data): + data = re.sub(r"", "", data, 0) + + return data + """ Handle jupyter connections. """ @@ -49,13 +57,13 @@ def do_execute(self, code, silent, store_history=True, for result in results: result_data = result.get_data() - result_html = result_data['result'] + result_html = self.preprocess_output(result_data['result']) display_data = { 'data' : {'text/html' : result_html}, 'metadata' : {}, } - + self.send_response(self.iopub_socket, 'display_data', display_data) return { diff --git a/Untitled.ipynb b/tests/Untitled.ipynb similarity index 61% rename from Untitled.ipynb rename to tests/Untitled.ipynb index c46b9b0..62bf93e 100644 --- a/Untitled.ipynb +++ b/tests/Untitled.ipynb @@ -6,28 +6,16 @@ "metadata": {}, "outputs": [ { - "data": { - "text/html": [ - "2" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], - "source": [ - "1+1" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": {}, - "outputs": [ + "name": "stdout", + "output_type": "stream", + "text": [ + "{ { x -> 0 } }" + ] + }, { "data": { "text/html": [ - "Plot" + "{ { x -> 0 } }" ] }, "metadata": {}, @@ -35,7 +23,7 @@ } ], "source": [ - "Plot" + "Solve[x^2==0, x]" ] }, { @@ -43,9 +31,7 @@ "execution_count": null, "metadata": {}, "outputs": [], - "source": [ - "Sol" - ] + "source": [] } ], "metadata": { diff --git a/tests/mathicsnotebook.egg-info/PKG-INFO b/tests/mathicsnotebook.egg-info/PKG-INFO new file mode 100644 index 0000000..f4c1fde --- /dev/null +++ b/tests/mathicsnotebook.egg-info/PKG-INFO @@ -0,0 +1,10 @@ +Metadata-Version: 1.0 +Name: mathicsnotebook +Version: 0.1 +Summary: UNKNOWN +Home-page: UNKNOWN +Author: UNKNOWN +Author-email: UNKNOWN +License: UNKNOWN +Description: UNKNOWN +Platform: UNKNOWN diff --git a/tests/mathicsnotebook.egg-info/SOURCES.txt b/tests/mathicsnotebook.egg-info/SOURCES.txt new file mode 100644 index 0000000..e69de29 diff --git a/tests/mathicsnotebook.egg-info/dependency_links.txt b/tests/mathicsnotebook.egg-info/dependency_links.txt new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/tests/mathicsnotebook.egg-info/dependency_links.txt @@ -0,0 +1 @@ + diff --git a/tests/mathicsnotebook.egg-info/requires.txt b/tests/mathicsnotebook.egg-info/requires.txt new file mode 100644 index 0000000..b4a9e9d --- /dev/null +++ b/tests/mathicsnotebook.egg-info/requires.txt @@ -0,0 +1,3 @@ +ipykernel +ipython +mathics>=1.0.dev0 diff --git a/tests/mathicsnotebook.egg-info/top_level.txt b/tests/mathicsnotebook.egg-info/top_level.txt new file mode 100644 index 0000000..07c1d75 --- /dev/null +++ b/tests/mathicsnotebook.egg-info/top_level.txt @@ -0,0 +1 @@ +mathicsnotebook