From f7ed392d0feabd97d75d02edaaaa63851e54ad7d Mon Sep 17 00:00:00 2001 From: rolux Date: Sat, 14 Apr 2012 14:03:35 +0200 Subject: [PATCH] in source viewer, ignore // comments, fixes #743 --- source/Ox.UI/js/Code/Ox.SourceViewer.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/source/Ox.UI/js/Code/Ox.SourceViewer.js b/source/Ox.UI/js/Code/Ox.SourceViewer.js index d9f0cfbc..fc1b9797 100644 --- a/source/Ox.UI/js/Code/Ox.SourceViewer.js +++ b/source/Ox.UI/js/Code/Ox.SourceViewer.js @@ -36,16 +36,16 @@ Ox.SourceViewer = function(options, self) { Ox.tokenize(source).forEach(function(token, i) { var text = source.substr(token.offset, token.length), type = token.type == 'comment' ? 'comment' : 'code'; - if (type == 'comment') { - i && sections.push({comment: '', code: ''}); - text = /^\/\*/.test(text) - ? Ox.sub(text, 2, -2) - : Ox.sub(text, 2); - self.options.replaceComment.forEach(function(replace) { - text = text.replace(replace[0], replace[1]); - }); + if (!/^\/\//.test(text)) { + if (type == 'comment') { + i && sections.push({comment: '', code: ''}); + text = Ox.sub(text, 2, -2); + self.options.replaceComment.forEach(function(replace) { + text = text.replace(replace[0], replace[1]); + }); + } + Ox.last(sections)[type] += text; } - Ox.last(sections)[type] += text; }); sections.forEach(function(section) { var $section = $('')