Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Remove link to generated C/C++ file (since it would be a 404 error an…

…yway).
  • Loading branch information...
commit 0059bd8c91172210e6a559f86657086322c3aa9e 1 parent af2449a
Bradley M. Froehle authored August 09, 2012

Showing 1 changed file with 13 additions and 1 deletion. Show diff stats Hide diff stats

  1. 14  IPython/extensions/cythonmagic.py
14  IPython/extensions/cythonmagic.py
@@ -20,6 +20,7 @@
20 20
 import imp
21 21
 import io
22 22
 import os
  23
+import re
23 24
 import sys
24 25
 import time
25 26
 
@@ -232,7 +233,7 @@ def f(x):
232 233
                       'source could not be read.', file=sys.stderr)
233 234
                 print(e, file=sys.stderr)
234 235
             else:
235  
-                return display.HTML(annotated_html)
  236
+                return display.HTML(self.clean_annotated_html(annotated_html))
236 237
 
237 238
     @property
238 239
     def so_ext(self):
@@ -255,6 +256,17 @@ def _get_build_extension(self):
255 256
         build_extension.finalize_options()
256 257
         return build_extension
257 258
 
  259
+    @staticmethod
  260
+    def clean_annotated_html(html):
  261
+        """Clean up the annotated HTML source.
  262
+
  263
+        Strips the link to the generated C or C++ file, which we do not
  264
+        present to the user.
  265
+        """
  266
+        r = re.compile('<p>Raw output: <a href="(.*)">(.*)</a>')
  267
+        html = '\n'.join(l for l in html.splitlines() if not r.match(l))
  268
+        return html
  269
+
258 270
 _loaded = False
259 271
 
260 272
 def load_ipython_extension(ip):

0 notes on commit 0059bd8

Please sign in to comment.
Something went wrong with that request. Please try again.