leave doc comments in the source code

This commit is contained in:
rolux 2012-05-30 15:20:00 +02:00
parent 6c44f683d6
commit 9c20602324

View file

@ -41,10 +41,12 @@ Ox.SourceViewer = function(options, self) {
Ox.get(self.options.file, function(source) { Ox.get(self.options.file, function(source) {
var sections = [{comment: '', code: ''}]; var sections = [{comment: '', code: ''}];
Ox.tokenize(source).forEach(function(token, i) { Ox.tokenize(source).forEach(function(token, i) {
var type = token.type == 'comment' ? 'comment' : 'code'; // treat doc comments as code
// ignore '//' comments var type = token.type == 'comment' && token.value[2] != '@'
if (!/^\/\//.test(token.value)) { ? 'comment' : 'code';
if (type == 'comment') { // remove '//' comments
if (!/^\/\/[^@]/.test(token.value)) {
if (type == 'comment' ) {
i && sections.push({comment: '', code: ''}); i && sections.push({comment: '', code: ''});
token.value = Ox.parseMarkdown( token.value = Ox.parseMarkdown(
trim(token.value.slice(2, -2)) trim(token.value.slice(2, -2))