leave doc comments in the source code
This commit is contained in:
parent
6c44f683d6
commit
9c20602324
1 changed files with 6 additions and 4 deletions
|
@ -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))
|
||||||
|
|
Loading…
Reference in a new issue