in source viewer, ignore // comments, fixes #743

This commit is contained in:
rolux 2012-04-14 14:03:35 +02:00
parent 3bfd8be160
commit f7ed392d0f

View file

@ -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 (!/^\/\//.test(text)) {
if (type == 'comment') {
i && sections.push({comment: '', code: ''});
text = /^\/\*/.test(text)
? Ox.sub(text, 2, -2)
: Ox.sub(text, 2);
text = Ox.sub(text, 2, -2);
self.options.replaceComment.forEach(function(replace) {
text = text.replace(replace[0], replace[1]);
});
}
Ox.last(sections)[type] += text;
}
});
sections.forEach(function(section) {
var $section = $('<tr>')