r105908 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105907‎ | r105908 | r105909 >
Date:17:34, 12 December 2011
Author:maxsem
Status:ok
Tags:
Comment:
ApiSandbox: linkify URLs in smartEscape()
Modified paths:
  • /trunk/extensions/ApiSandbox/ext.apiSandbox.js (modified) (history)

Diff [purge]

Index: trunk/extensions/ApiSandbox/ext.apiSandbox.js
@@ -398,6 +398,10 @@
399399 s = s.replace( /\n\s+\*?([^\n]*)/g, '\n<li>$1</li>' ); // <li> around bulleted lines
400400 }
401401 s = s.replace( /\n(?!<)/, '\n<br/>' );
 402+ s = s.replace( /(?:https?:)?\/\/[^\s<>]+/g, function( s ) {
 403+ // linkify URLs, input is already HTML-escaped above
 404+ return '<a href="' + s + '">' + s + '</a>';
 405+ } );
402406 return s;
403407 }
404408

Follow-up revisions

RevisionCommit summaryAuthorDate
r108623MFT r95614, r104865, r105908, r107050reedy15:16, 11 January 2012

Status & tagging log