* Turns all URLs in the code into tags. * @param {String} code Input code. * @return {String} Returns code with tags.
(code)
| 1042 | * @return {String} Returns code with </a> tags. |
| 1043 | */ |
| 1044 | function processUrls(code) |
| 1045 | { |
| 1046 | var gt = /(.*)((>|<).*)/; |
| 1047 | |
| 1048 | return code.replace(sh.regexLib.url, function(m) |
| 1049 | { |
| 1050 | var suffix = '', |
| 1051 | match = null |
| 1052 | ; |
| 1053 | |
| 1054 | // We include < and > in the URL for the common cases like <http://google.com> |
| 1055 | // The problem is that they get transformed into <http://google.com> |
| 1056 | // Where as > 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. |