DocParser Class
The doc parser accepts a map of files to file content.
Once parse()
is called, various properties will be populated
with the parsers data (aggregated in the 'data'
property).
Constructor
Item Index
Properties
Methods
_resolveFor
-
value
Takes a non-namespaced classname and resolves it to a namespace (to support @for
)
Parameters:
-
value
StringThe classname to resolve
Returns:
extract
-
filemap
-
dirmap
Accepts a map of filenames to file content. Returns a map of filenames to an array of API comment block text. This expects the comment to start with / ** on its own line, and end with * / on its own line. Override this function to provide an alternative comment parser.
Parameters:
Returns:
fixType
-
t
Takes a type string and converts it to a "First letter upper cased" type. e.g. (string -> String, object -> Object)
Parameters:
-
t
StringThe type string to convert
Returns:
handlecomment
-
comment
-
file
-
line
Transforms a JavaDoc style comment block (less the start and end of it) into a list of tag/text pairs. The leading space and '*' are removed, but the remaining whitespace is preserved so that the output should be friendly for both markdown and html parsers.
parse
-
filemap
-
dirmap
Extracts and transforms the filemap provided to constructor
Parameters:
Returns:
processblock
-
an
Processes all the tags in a single comment block
Parameters:
-
an
Arrayarray of the tag/text pairs
stringlog
-
data
Parses the JSON data and formats it into a nice log string for filename and line number:
/file/name.js:123
Parameters:
-
data
ObjectThe data block from the parser
Returns:
transform
-
commentmap
Transforms a map of filenames to arrays of comment blocks into a JSON structure that represents the entire processed API doc info and relationships between elements for the entire project.
Parameters:
-
commentmap
ObjectThe hash of files and parsed comment blocks
Returns:
unindent
-
content
Normalizes the initial indentation of the given content so that the first line is unindented, and all other lines are unindented to the same degree as the first line. So if the first line has four spaces at the beginning, then all lines will be unindented four spaces. Ported from Selleck
Parameters:
-
content
StringText to unindent.
Returns:
Properties
DIGESTERS
Object
final
A map of the default tag processors, keyed by the tag name. Multiple tags can use the same digester by supplying the string name that points to the implementation rather than a function.
TAGLIST
Array
final
A list of known tags. This populates a member variable during initialization, and will be updated if additional digesters are added.
Attributes
currentclass
String
The class currently being parsed
Fires event currentclassChange
Fires when the value for the configuration attribute currentclass
is
changed. You can listen for the event using the on
method if you
wish to be notified before the attribute's value has changed, or
using the after
method if you wish to be notified after the
attribute's value has changed.
Parameters:
-
e
EventFacadeAn Event Facade object with the following attribute-specific properties added:
currentfile
String
The file currently being parsed
Fires event currentfileChange
Fires when the value for the configuration attribute currentfile
is
changed. You can listen for the event using the on
method if you
wish to be notified before the attribute's value has changed, or
using the after
method if you wish to be notified after the
attribute's value has changed.
Parameters:
-
e
EventFacadeAn Event Facade object with the following attribute-specific properties added:
currentmodule
String
The module currently being parsed
Fires event currentmoduleChange
Fires when the value for the configuration attribute currentmodule
is
changed. You can listen for the event using the on
method if you
wish to be notified before the attribute's value has changed, or
using the after
method if you wish to be notified after the
attribute's value has changed.
Parameters:
-
e
EventFacadeAn Event Facade object with the following attribute-specific properties added:
currentsubmodule
String
The submodule currently being parsed
Fires event currentsubmoduleChange
Fires when the value for the configuration attribute currentsubmodule
is
changed. You can listen for the event using the on
method if you
wish to be notified before the attribute's value has changed, or
using the after
method if you wish to be notified after the
attribute's value has changed.
Parameters:
-
e
EventFacadeAn Event Facade object with the following attribute-specific properties added:
digesters
Digesters process the tag/text pairs found in a comment block. They are looked up by tag name. The digester gets the tagname, the value, the target object to apply values to, and the full block that is being processed. Digesters can be declared as strings instead of a function -- in that case, the program will try to look up the key listed and use the function there instead (it is an alias). Digesters can return a host object in the case the tag defines a new key block type (modules/classes/methods/events/properties)
Fires event digestersChange
Fires when the value for the configuration attribute digesters
is
changed. You can listen for the event using the on
method if you
wish to be notified before the attribute's value has changed, or
using the after
method if you wish to be notified after the
attribute's value has changed.
Parameters:
-
e
EventFacadeAn Event Facade object with the following attribute-specific properties added:
dirmap
A map of file names to directory name. Provided in case this needs to be used to reset the module name appropriately -- currently not used
Fires event dirmapChange
Fires when the value for the configuration attribute dirmap
is
changed. You can listen for the event using the on
method if you
wish to be notified before the attribute's value has changed, or
using the after
method if you wish to be notified after the
attribute's value has changed.
Parameters:
-
e
EventFacadeAn Event Facade object with the following attribute-specific properties added:
emitters
Emitters will be schemas for the types of payloads the parser will emit. Not implemented.
Fires event emittersChange
Fires when the value for the configuration attribute emitters
is
changed. You can listen for the event using the on
method if you
wish to be notified before the attribute's value has changed, or
using the after
method if you wish to be notified after the
attribute's value has changed.
Parameters:
-
e
EventFacadeAn Event Facade object with the following attribute-specific properties added:
filemap
The map of file names to file content.
Fires event filemapChange
Fires when the value for the configuration attribute filemap
is
changed. You can listen for the event using the on
method if you
wish to be notified before the attribute's value has changed, or
using the after
method if you wish to be notified after the
attribute's value has changed.
Parameters:
-
e
EventFacadeAn Event Facade object with the following attribute-specific properties added:
mainmodule
String
The main documentation block for the module itself.
Fires event mainmoduleChange
Fires when the value for the configuration attribute mainmodule
is
changed. You can listen for the event using the on
method if you
wish to be notified before the attribute's value has changed, or
using the after
method if you wish to be notified after the
attribute's value has changed.
Parameters:
-
e
EventFacadeAn Event Facade object with the following attribute-specific properties added: