in source viewer, ignore // comments, fixes #743
This commit is contained in:
parent
3bfd8be160
commit
f7ed392d0f
1 changed files with 9 additions and 9 deletions
|
@ -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 = $('<tr>')
|
||||
|
|
Loading…
Reference in a new issue