MCPcopy Create free account
hub / github.com/unconed/TermKit / processUrls

Function processUrls

HTML/external/syntaxhighlighter_3.0.83/src/shCore.js:1044–1066  ·  view source on GitHub ↗

* Turns all URLs in the code into tags. * @param {String} code Input code. * @return {String} Returns code with tags.

(code)

Source from the content-addressed store, hash-verified

1042 * @return {String} Returns code with </a> tags.
1043 */
1044function processUrls(code)
1045{
1046 var gt = /(.*)((&gt;|&lt;).*)/;
1047
1048 return code.replace(sh.regexLib.url, function(m)
1049 {
1050 var suffix = '',
1051 match = null
1052 ;
1053
1054 // We include &lt; and &gt; in the URL for the common cases like <http://google.com>
1055 // The problem is that they get transformed into &lt;http://google.com&gt;
1056 // Where as &gt; easily looks like part of the URL string.
1057
1058 if (match = gt.exec(m))
1059 {
1060 m = match[1];
1061 suffix = match[2];
1062 }
1063
1064 return '<a href="' + m + '">' + m + '</a>' + suffix;
1065 });
1066};
1067
1068/**
1069 * Finds all <SCRIPT TYPE="syntaxhighlighter" /> elementss.

Callers 1

shCore.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected