DocBuilder Class
Takes the JSON
data from the DocParser
class, creates and parses markdown and handlebars
based templates to generate static HTML content
Item Index
Methods
- _addHelpers
- _inlineCode
- _mixExternal
- _parseCode
- _parseCrossLink
- addFoundAt
- augmentData
- compile
- filterFileName
- getProjectMeta
- hasProperty
- makeDirs
- markdown
- mergeExtends
- mixExternal
- nameSort
- NATIVES_LINKER
- populateClasses
- populateFiles
- populateModules
- render
- renderAPIMeta
- renderClass
- renderFile
- renderIndex
- renderModule
- writeAPIMeta
- writeClasses
- writeFiles
- writeIndex
- writeModules
Properties
Methods
_addHelpers
-
helpers
Register a Y.Handlebars
helper method
Parameters:
-
helpers
ObjectObject containing a hash of names and functions
_inlineCode
-
html
Ported from Selleck, this handles `
's in fields
that are not parsed by the Markdown parser.
Parameters:
-
html
HTMLThe HTML to parse
Returns:
The parsed HTML
_mixExternal
()
private
Mixes the various external data soures together into the local data, augmenting it with flags.
_parseCode
-
html
Parses <pre><code>
tags and adds the prettyprint className
to them
Parameters:
-
html
HTMLThe HTML to parse
Returns:
The parsed HTML
_parseCrossLink
-
item
-
[raw=false]
-
[content]
Parse the item to be cross linked and return an HREF linked to the item
Parameters:
-
item
StringThe item to crossLink
-
[raw=false]
Boolean optionalDo not wrap it in HTML
-
[content]
String optionalcrossLink helper content
addFoundAt
-
a
Parses file and line number from an item object and build's an HREF
Parameters:
-
a
ObjectThe item to parse
Returns:
The parsed HREF
augmentData
-
o
Augments the DocParser meta data to provide default values for certain keys as well as parses all descriptions
with the Markdown Parser
Parameters:
-
o
ObjectThe object to recurse and augment
Returns:
The augmented object
compile
-
cb
Compiles the templates from the meta-data provided by DocParser
Parameters:
-
cb
CallbackThe callback to execute after it's completed
filterFileName
-
f
Normalizes a file path to a writable filename:
var path = 'lib/file.js'; returns 'lib_file.js';
Parameters:
-
f
StringThe filename to normalize
Returns:
The filtered file path
getProjectMeta
()
Object
Prep the meta data to be fed to Selleck
Returns:
The project metadata
hasProperty
-
a
-
b
Checks an array of items (class items) to see if an item is in that list
Parameters:
-
a
ArrayThe Array of items to check
-
b
ObjectThe object to find
Returns:
Boolean
makeDirs
-
cb
Makes the default directories needed
Parameters:
-
cb
CallbackThe callback to execute after it's completed
markdown
-
md
Wrapper around the Markdown parser so it can be normalized or even side stepped
Parameters:
-
md
StringThe Markdown string to parse
Returns:
The rendered HTML
mergeExtends
-
info
-
classItems
-
first
Merge superclass data into a child class
Parameters:
-
info
ObjectThe item to extend
-
classItems
ArrayThe list of items to merge in
-
first
BooleanSet for the first call
mixExternal
-
cb
Fetches the remote data and fires the callback when it's all complete
Parameters:
-
cb
CallbackThe callback to execute when complete
nameSort
-
a
-
b
Sort method of array of objects with a property called name
Parameters:
-
a
ObjectFirst object to compare
-
b
ObjectSecond object to compare
Returns:
1, -1 or 0 for sorting.
NATIVES_LINKER
-
name
Function to link an external type uses NATIVES
object
Parameters:
-
name
StringThe name of the type to link
Returns:
The combined URL
populateClasses
-
opts
Populate the meta data for classes
Parameters:
-
opts
ObjectThe original options
Returns:
The modified options
populateFiles
-
opts
Populate the meta data for files
Parameters:
-
opts
ObjectThe original options
Returns:
The modified options
populateModules
-
opts
Populate the meta data for modules
Parameters:
-
opts
ObjectThe original options
Returns:
The modified options
render
-
source
-
view
-
[layout=null]
-
[partials={}]
-
callback
Ported from Selleck Renders the handlebars templates with the default View class.
Parameters:
-
source
HTMLThe default template to parse
-
view
ClassThe default view handler
-
[layout=null]
HTML optionalThe HTML from the layout to use.
-
[partials={}]
Object optionalList of partials to include in this template
-
callback
Callback-
err
Error -
html
HTMLThe assembled template markup
-
renderAPIMeta
-
cb
Render the API meta and return the Javascript
Parameters:
-
cb
CallbackThe callback
renderClass
-
cb
-
cv.view
Render the class file
Parameters:
-
cb
FunctionThe callback fired when complete
-
html
StringThe HTML to render this view
-
-
cv.view
ObjectThe View Data
renderFile
-
cb
-
cv.view
Render the source file
Parameters:
-
cb
FunctionThe callback fired when complete
-
html
StringThe HTML to render this view
-
-
cv.view
ObjectThe View Data
renderIndex
-
cb
-
cv.view
Render the index file
Parameters:
-
cb
FunctionThe callback fired when complete
-
html
StringThe HTML to render this view
-
-
cv.view
ObjectThe View Data
renderModule
-
cb
-
cv.view
Render a module
Parameters:
-
cb
FunctionThe callback fired when complete
-
html
StringThe HTML to render this view
-
-
cv.view
ObjectThe View Data
writeAPIMeta
-
cb
Write the API meta data used for the AutoComplete widget
Parameters:
-
cb
CallbackThe callback to execute when complete
writeClasses
-
cb
Generates the class files under "out"/classes/
Parameters:
-
cb
CallbackThe callback to execute after it's completed
writeFiles
-
cb
Generates the syntax files under "out"/files/
Parameters:
-
cb
CallbackThe callback to execute after it's completed
writeIndex
-
cb
Generates the index.html file
Parameters:
-
cb
CallbackThe callback to execute after it's completed
writeModules
-
cb
Generates the module files under "out"/modules/
Parameters:
-
cb
CallbackThe callback to execute after it's completed
Properties
_mergeCounter
Number
private
Counter for stepping into merges
_meta
Object
private
Holder for project meta data
files
Number
File counter
NATIVES
Object
List of native types to cross link to MDN