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 And finally, this is how everything gets parsed and displayed, in less than 30
code. Note that it would be more efficient to parse the source once lines of code. Note that it would be more efficient to parse the source once
``` ```
var doc = Ox.doc(source); var doc = Ox.doc(source);
``` ```
@ -432,7 +432,8 @@ Ox.DocPanel({
expanded: true, expanded: true,
items: doc, items: doc,
getModule: function() { return 'My'; }, 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 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, expanded: true,
files: [file], files: [file],
getModule: function() { return 'My'; }, getModule: function() { return 'My'; },
path: path path: path,
stripComments: true
}); });
}, },
tabs: [ tabs: [

View file

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

View file

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