From 9c20602324494cdaf552afd069bd3c8d4d72354d Mon Sep 17 00:00:00 2001 From: rolux Date: Wed, 30 May 2012 15:20:00 +0200 Subject: [PATCH] leave doc comments in the source code --- source/Ox.UI/js/Code/SourceViewer.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/source/Ox.UI/js/Code/SourceViewer.js b/source/Ox.UI/js/Code/SourceViewer.js index e1aa1fe5..09b3c882 100644 --- a/source/Ox.UI/js/Code/SourceViewer.js +++ b/source/Ox.UI/js/Code/SourceViewer.js @@ -41,10 +41,12 @@ Ox.SourceViewer = function(options, self) { Ox.get(self.options.file, function(source) { var sections = [{comment: '', code: ''}]; Ox.tokenize(source).forEach(function(token, i) { - var type = token.type == 'comment' ? 'comment' : 'code'; - // ignore '//' comments - if (!/^\/\//.test(token.value)) { - if (type == 'comment') { + // treat doc comments as code + var type = token.type == 'comment' && token.value[2] != '@' + ? 'comment' : 'code'; + // remove '//' comments + if (!/^\/\/[^@]/.test(token.value)) { + if (type == 'comment' ) { i && sections.push({comment: '', code: ''}); token.value = Ox.parseMarkdown( trim(token.value.slice(2, -2))