From e59ca3a22a5be5dea265e58b67f93973b60f7ed9 Mon Sep 17 00:00:00 2001 From: Egil Moeller Date: Fri, 12 Mar 2010 21:31:50 +0100 Subject: Cleaned up the taglinking code a bit --- trunk/infrastructure/ace/www/ace2_inner.js | 11 +---------- trunk/infrastructure/ace/www/linestylefilter.js | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/trunk/infrastructure/ace/www/ace2_inner.js b/trunk/infrastructure/ace/www/ace2_inner.js index eccb53c..e817c95 100644 --- a/trunk/infrastructure/ace/www/ace2_inner.js +++ b/trunk/infrastructure/ace/www/ace2_inner.js @@ -1139,16 +1139,7 @@ function OUTER(gscope) { } else { var offsetIntoLine = 0; - var filteredFunc = textAndClassFunc; - filteredFunc = linestylefilter.getPadTagFilter(text, filteredFunc); - filteredFunc = linestylefilter.getURLFilter(text, filteredFunc); - if (browser.msie) { - // IE7+ will take an e-mail address like and linkify it to foo@bar.com. - // We then normalize it back to text with no angle brackets. It's weird. So always - // break spans at an "at" sign. - filteredFunc = linestylefilter.getAtSignSplitterFilter( - text, filteredFunc); - } + var filteredFunc = linestylefilter.getFilterStack(text, textAndClassFunc, browser); var lineNum = rep.lines.indexOfEntry(lineEntry); var aline = rep.alines[lineNum]; filteredFunc = linestylefilter.getLineStyleFilter( diff --git a/trunk/infrastructure/ace/www/linestylefilter.js b/trunk/infrastructure/ace/www/linestylefilter.js index 8c7c396..f0f1343 100644 --- a/trunk/infrastructure/ace/www/linestylefilter.js +++ b/trunk/infrastructure/ace/www/linestylefilter.js @@ -275,6 +275,19 @@ linestylefilter.textAndClassFuncSplitter = function(func, splitPointsOpt) { return spanHandler; }; +linestylefilter.getFilterStack = function(lineText, textAndClassFunc, browser) { + var func = linestylefilter.getURLFilter(lineText, textAndClassFunc); + func = linestylefilter.getPadTagFilter(lineText, func); + if (browser !== undefined && browser.msie) { + // IE7+ will take an e-mail address like and linkify it to foo@bar.com. + // We then normalize it back to text with no angle brackets. It's weird. So always + // break spans at an "at" sign. + func = linestylefilter.getAtSignSplitterFilter( + lineText, func); + } + return func; +}; + // domLineObj is like that returned by domline.createDomLine linestylefilter.populateDomLine = function(textLine, aline, apool, domLineObj) { @@ -288,9 +301,7 @@ linestylefilter.populateDomLine = function(textLine, aline, apool, domLineObj.appendSpan(tokenText, tokenClass); } - var func = textAndClassFunc; - func = linestylefilter.getURLFilter(text, func); - func = linestylefilter.getPadTagFilter(text, func); + var func = linestylefilter.getFilterStack(text, textAndClassFunc); func = linestylefilter.getLineStyleFilter(text.length, aline, func, apool); func(text, ''); -- cgit v1.2.3-1-g7c22