Tag
- typedef
{Object}
The interface that tags implement for documentjs.process.comment and documentjs.process.code to call. This is very likely to change to something better.
Object
Properties
-
codeMatch
{function(codeLine)}
Returns
true
if this tag should process this line of code.documentjs.process.code passes the line of code after a comment block to each tag's
codeMatch
function. The first tag whosecodeMatch
returns true will have itscode
method called with the same line.-
codeLine
{String}
-
-
code
{function(codeLine, scope, docMap)}
Returns properties that should be set on the comment's docObject.
-
codeScope
=false
{Boolean}
OptionalIf
code(codeLine)
returns a DocObject, set this object as the new scope. -
add
{function(line, curData, scope, docMap, currentWrite, options)}
add
is called when a comment line starts with@
followed by the tag name. This function can:- add directly to the docObject
- push something onto the stack
['push', data]
- pop some data off the stack
['pop', String]
- change the default property lines are written to
['default',propName]
- add to docMap
['add', docObject]
. - change the scope
['scope', scopeDocObject]
or the scope and the docObject being added to['scope',scopeDocObject, docObject]
The stack is used to handle tags that might be nested, for example
@codestart
and@codeend
. It provides something to collect data until the closing tag, and have the compiled data "popped" to the parent.-
line
{String}
-
curData
{Object}
-
scope
{docObject}
-
docMap
{docMap}
-
currentWrite
{String}
-
options
{siteConfig}
-
addMore
{function(line, curData, scope, docMap)}
addMore
is called ifadd
returns an object. -
end
{function(line, curData, scope, docMap)}
end
is called on a tag when the comment switches to another tag.