##// END OF EJS Templates
fix regular expression for detecting links in stdout...
MinRK -
Show More
@@ -378,7 +378,6 b' var IPython = (function (IPython) {'
378 378 OutputArea.prototype.append_text = function (data, element, extra_class) {
379 379 var toinsert = $("<div/>").addClass("box-flex1 output_subarea output_text");
380 380 // escape ANSI & HTML specials in plaintext:
381 data = utils.wrapUrls(data);
382 381 data = utils.fixConsole(data);
383 382 data = utils.fixCarriageReturn(data);
384 383 data = utils.autoLinkUrls(data);
@@ -201,22 +201,10 b' IPython.utils = (function (IPython) {'
201 201 return txt;
202 202 }
203 203
204 // Locate URLs in plain text and wrap them in spaces so that they can be
205 // better picked out by autoLinkUrls even after the text has been
206 // converted to HTML
207 function wrapUrls(txt) {
208 // Note this regexp is a modified version of one from
209 // Markdown.Converter For now it only supports http(s) and ftp URLs,
210 // but could easily support others (though file:// should maybe be
211 // avoided)
212 var url_re = /(^|\W)(https?|ftp)(:\/\/[-A-Z0-9+&@#\/%?=~_|\[\]\(\)!:,\.;]*[-A-Z0-9+&@#\/%=~_|\[\]])($|\W)/gi;
213 return txt.replace(url_re, "$1 $2$3 $4");
214 }
215
216 // Locate a URL with spaces around it and convert that to a anchor tag
204 // Locate any URLs and convert them to a anchor tag
217 205 function autoLinkUrls(txt) {
218 return txt.replace(/ ((https?|ftp):[^'">\s]+) /gi,
219 "<a target=\"_blank\" href=\"$1\">$1</a>");
206 return txt.replace(/(^|\s)(https?|ftp)(:[^'">\s]+)/gi,
207 "$1<a target=\"_blank\" href=\"$2$3\">$2$3</a>");
220 208 }
221 209
222 210 grow = function(element) {
@@ -289,7 +277,6 b' IPython.utils = (function (IPython) {'
289 277 keycodes : keycodes,
290 278 grow : grow,
291 279 fixCarriageReturn : fixCarriageReturn,
292 wrapUrls : wrapUrls,
293 280 autoLinkUrls : autoLinkUrls,
294 281 points_to_pixels : points_to_pixels,
295 282 browser : browser
General Comments 0
You need to be logged in to leave comments. Login now