From 21854f653edd646b1fdc357771b9ef976ec21733 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Fri, 10 Feb 2012 15:22:09 +0530 Subject: [PATCH] do not shorten urls, just turn them into links --- source/Ox/js/HTML.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/source/Ox/js/HTML.js b/source/Ox/js/HTML.js index e151dec1..2e6dda15 100644 --- a/source/Ox/js/HTML.js +++ b/source/Ox/js/HTML.js @@ -15,7 +15,9 @@ Ox.parseEmailAddresses = function(html) { /*@ Ox.parseHTML Takes HTML from an untrusted source and returns something sane > Ox.parseHTML('http://foo.com, bar') - 'foo.com, bar' + 'http://foo.com, bar' + > Ox.parseHTML('http://foo.com/foobar?foo, bar') + 'http://foo.com/foobar?foo, bar' > Ox.parseHTML('(see: www.foo.com)') '(see: www.foo.com)' > Ox.parseHTML('foo@bar.com') @@ -73,8 +75,8 @@ Ox.parseHTML = (function() { }, tab = '\t'; return function(html, tags, wikilinks) { - var matches = [], - tags = tags || defaultTags; + var matches = []; + tags = tags || defaultTags; // html = Ox.clean(html); fixme: can this be a parameter? if (tags.indexOf('[]') > -1) { html = html.replace(/\[(https?:\/\/.+?) (.+?)\]/gi, '$2'); @@ -101,7 +103,7 @@ Ox.parseHTML = (function() { // close extra opening (and remove extra closing) tags // note: this converts '"' to '"' return Ox.element('
').html(html).html(); - } + }; }()); /*@ @@ -153,10 +155,9 @@ Ox.parseURLs = function(html) { function(str, url, pre, end) { url = (pre == 'www.' ? 'http://' : '' ) + url; return Ox.formatString( - '{host}{end}', + '{url}{end}', { end: end, - host: Ox.parseURL(url).hostname, url: url } );