allow for stripping comments in doc panel (which implies hiding line numbers)

This commit is contained in:
rolux 2012-06-23 20:44:13 +02:00
parent 8ab36de816
commit a071d541de
3 changed files with 13 additions and 6 deletions

View file

@ -410,8 +410,8 @@ My.ExtendedBox = function(options, self) {
//@
/*
And finally, this is how everything gets parsed and displayed, in 25 lines of
code. Note that it would be more efficient to parse the source once
And finally, this is how everything gets parsed and displayed, in less than 30
lines of code. Note that it would be more efficient to parse the source once
```
var doc = Ox.doc(source);
```
@ -432,7 +432,8 @@ Ox.DocPanel({
expanded: true,
items: doc,
getModule: function() { return 'My'; },
path: path
path: path,
stripComments: true
});
```
but the thing we want to demonstrate here is that we can just pass files to
@ -453,7 +454,8 @@ Ox.load('UI', function() {
expanded: true,
files: [file],
getModule: function() { return 'My'; },
path: path
path: path,
stripComments: true
});
},
tabs: [

View file

@ -7,6 +7,7 @@ Ox.DocPage <f> DocPage
options <o> Options object
item <o> doc item
replace <[[]]|[]> See Ox.SyntaxHighlighter
stripComments <b|false> If true, strip comments in source code
self <o> Shared private variable
@*/
Ox.DocPage = function(options, self) {
@ -242,8 +243,9 @@ Ox.DocPage = function(options, self) {
$elements.push(
Ox.SyntaxHighlighter({
replace: self.options.replace,
showLineNumbers: true,
showLineNumbers: !self.options.stripComments,
source: item.source,
stripComments: self.options.stripComments,
offset: self.options.item.line
})
.addClass(className)

View file

@ -26,6 +26,7 @@ Ox.DocPanel <f> Documentation Panel
showTests <b|false> If true, show test results in list
showTooltips <b|false> If true, show test result tooltips in list
size <s|256> Default list size
stripComments <b|false> If true, strip comments in source code
self <o> Shared private variable
@*/
@ -58,6 +59,7 @@ Ox.DocPanel = function(options, self) {
showTests: false,
showTooltips: false,
size: 256,
stripComments: false
})
.options(options || {})
.update({
@ -332,7 +334,8 @@ Ox.DocPanel = function(options, self) {
});
self.$page = Ox.DocPage({
item: item,
replace: self.options.replace
replace: self.options.replace,
stripComments: self.options.stripComments
})
.bindEvent({
close: function() {