Show More
@@ -378,7 +378,6 b' var IPython = (function (IPython) {' | |||||
378 | OutputArea.prototype.append_text = function (data, element, extra_class) { |
|
378 | OutputArea.prototype.append_text = function (data, element, extra_class) { | |
379 | var toinsert = $("<div/>").addClass("box-flex1 output_subarea output_text"); |
|
379 | var toinsert = $("<div/>").addClass("box-flex1 output_subarea output_text"); | |
380 | // escape ANSI & HTML specials in plaintext: |
|
380 | // escape ANSI & HTML specials in plaintext: | |
381 | data = utils.wrapUrls(data); |
|
|||
382 | data = utils.fixConsole(data); |
|
381 | data = utils.fixConsole(data); | |
383 | data = utils.fixCarriageReturn(data); |
|
382 | data = utils.fixCarriageReturn(data); | |
384 | data = utils.autoLinkUrls(data); |
|
383 | data = utils.autoLinkUrls(data); |
@@ -201,22 +201,10 b' IPython.utils = (function (IPython) {' | |||||
201 | return txt; |
|
201 | return txt; | |
202 | } |
|
202 | } | |
203 |
|
203 | |||
204 | // Locate URLs in plain text and wrap them in spaces so that they can be |
|
204 | // Locate any URLs and convert them to a anchor tag | |
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 |
|
|||
217 | function autoLinkUrls(txt) { |
|
205 | function autoLinkUrls(txt) { | |
218 |
return txt.replace(/ |
|
206 | return txt.replace(/(^|\s)(https?|ftp)(:[^'">\s]+)/gi, | |
219 |
"<a target=\"_blank\" href=\"$ |
|
207 | "$1<a target=\"_blank\" href=\"$2$3\">$2$3</a>"); | |
220 | } |
|
208 | } | |
221 |
|
209 | |||
222 | grow = function(element) { |
|
210 | grow = function(element) { | |
@@ -289,7 +277,6 b' IPython.utils = (function (IPython) {' | |||||
289 | keycodes : keycodes, |
|
277 | keycodes : keycodes, | |
290 | grow : grow, |
|
278 | grow : grow, | |
291 | fixCarriageReturn : fixCarriageReturn, |
|
279 | fixCarriageReturn : fixCarriageReturn, | |
292 | wrapUrls : wrapUrls, |
|
|||
293 | autoLinkUrls : autoLinkUrls, |
|
280 | autoLinkUrls : autoLinkUrls, | |
294 | points_to_pixels : points_to_pixels, |
|
281 | points_to_pixels : points_to_pixels, | |
295 | browser : browser |
|
282 | browser : browser |
General Comments 0
You need to be logged in to leave comments.
Login now