forked from 0x2620/oxjs
improve performance of DocPanel by returning tokens (not source) from Ox.doc and making Ox.SyntaxHighlighter accept tokens
This commit is contained in:
parent
6b12776ed9
commit
d9c69a0975
2 changed files with 10 additions and 9 deletions
|
|
@ -18,7 +18,11 @@ Ox.doc <f> Generates documentation for annotated JavaScript
|
|||
<code>"event"</code>, <code>"function"</code>
|
||||
or <code>"object"</code>.
|
||||
section <s|u> Section in the file
|
||||
source <s> Source code
|
||||
source <[o]> Source code (array of tokens)
|
||||
column <n> Column
|
||||
line <n> Line
|
||||
type <s> Type (see Ox.tokenize for a list of types)
|
||||
value <s> Value
|
||||
summary <s> One-line summary
|
||||
usage <[o]> Usage (array of doc objects)
|
||||
Present if the <code>type</code> of the item is
|
||||
|
|
@ -156,9 +160,7 @@ Ox.doc = (function() {
|
|||
if (/^[A-Z]/.test(item.name)) {
|
||||
// main item
|
||||
// include leading whitespace
|
||||
item.source = parseTokens(tokens[i]).map(function(token) {
|
||||
return token.value;
|
||||
}).join('');
|
||||
item.source = parseTokens(tokens[i]);
|
||||
item.line = source.slice(0, item.source[0].offset)
|
||||
.split('\n').length;
|
||||
items.push(item);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue