diff --git a/IPython/extensions/cythonmagic.py b/IPython/extensions/cythonmagic.py index 24fe04a..f60d930 100644 --- a/IPython/extensions/cythonmagic.py +++ b/IPython/extensions/cythonmagic.py @@ -20,6 +20,7 @@ from __future__ import print_function import imp import io import os +import re import sys import time @@ -232,7 +233,7 @@ class CythonMagics(Magics): 'source could not be read.', file=sys.stderr) print(e, file=sys.stderr) else: - return display.HTML(annotated_html) + return display.HTML(self.clean_annotated_html(annotated_html)) @property def so_ext(self): @@ -255,6 +256,17 @@ class CythonMagics(Magics): build_extension.finalize_options() return build_extension + @staticmethod + def clean_annotated_html(html): + """Clean up the annotated HTML source. + + Strips the link to the generated C or C++ file, which we do not + present to the user. + """ + r = re.compile('
Raw output: (.*)') + html = '\n'.join(l for l in html.splitlines() if not r.match(l)) + return html + _loaded = False def load_ipython_extension(ip):