#

API Docs for: 0.3.17
Show: Inherited Protected Private Deprecated

# DocBuilder Class

Defined in: `lib/builder.js:13`
Module: yuidoc

Takes the `JSON` data from the `DocParser` class, creates and parses markdown and handlebars based templates to generate static HTML content

- Index
- Methods
- Properties

## 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

- _mergeCounter
- _meta
- defaultReturnTags
- defaultTags
- files
- NATIVES

## Methods

### `_addHelpers`

(

- `helpers`

)

Defined in `lib/builder.js:115`

Register a `Y.Handlebars` helper method

#### Parameters:

- `helpers` Object

  Object containing a hash of names and functions

### `_inlineCode`

(

- `html`

)
HTML private

Defined in `lib/builder.js:709`

Ported from Selleck, this handles ```'s in fields that are not parsed by the Markdown parser.

#### Parameters:

- `html` HTML

  The HTML to parse

#### Returns:

HTML: The parsed HTML

### `_mixExternal`

() private

Defined in `lib/builder.js:290`

Mixes the various external data soures together into the local data, augmenting it with flags.

### `_parseCode`

(

- `html`

)
HTML private

Defined in `lib/builder.js:697`

Parses `<pre><code>` tags and adds the prettyprint `className` to them

#### Parameters:

- `html` HTML

  The HTML to parse

#### Returns:

HTML: The parsed HTML

### `_parseCrossLink`

(

- `item`
- `[raw=false]`

)
private

Defined in `lib/builder.js:151`

Parse the item to be cross linked and return an HREF linked to the item

#### Parameters:

- `item` String

  The item to crossLink

- `[raw=false]` Boolean optional

  Do not wrap it in HTML

### `addFoundAt`

(

- `a`

)
String

Defined in `lib/builder.js:574`

Parses file and line number from an item object and build's an HREF

#### Parameters:

- `a` Object

  The item to parse

#### Returns:

String: The parsed HREF

### `augmentData`

(

- `o`

)
Object

Defined in `lib/builder.js:590`

Augments the DocParser meta data to provide default values for certain keys as well as parses all descriptions with the `Markdown Parser`

#### Parameters:

- `o` Object

  The object to recurse and augment

#### Returns:

Object: The augmented object

### `compile`

(

- `cb`

)

Defined in `lib/builder.js:1500`

Compiles the templates from the meta-data provided by DocParser

#### Parameters:

- `cb` Callback

  The callback to execute after it's completed

### `filterFileName`

(

- `f`

)
String

Defined in `lib/builder.js:1487`

Normalizes a file path to a writable filename:

var path = 'lib/file.js'; returns 'lib_file.js';

#### Parameters:

- `f` String

  The filename to normalize

#### Returns:

String: The filtered file path

### `getProjectMeta`

() Object

Defined in `lib/builder.js:430`

Prep the meta data to be fed to Selleck

#### Returns:

Object: The project metadata

### `hasProperty`

(

- `a`
- `b`

)

Defined in `lib/builder.js:944`

Checks an array of items (class items) to see if an item is in that list

#### Parameters:

- `a` Array

  The Array of items to check

- `b` Object

  The object to find

#### Returns:

Boolean

### `makeDirs`

(

- `cb`

)

Defined in `lib/builder.js:656`

Makes the default directories needed

#### Parameters:

- `cb` Callback

  The callback to execute after it's completed

### `markdown`

(

- `md`
- `def`
- `tags`

)
HTML private

Defined in `lib/builder.js:132`

Wrapper around the Markdown parser so it can be normalized or even side stepped

#### Parameters:

- `md` String

  The Markdown string to parse

- `def` Boolean

  Only allow default set of HTML tags

- `tags` Array

  An array of tags to allow

#### Returns:

HTML: The rendered HTML

### `mergeExtends`

(

- `info`
- `classItems`
- `first`

)

Defined in `lib/builder.js:968`

Merge superclass data into a child class

#### Parameters:

- `info` Object

  The item to extend

- `classItems` Array

  The list of items to merge in

- `first` Boolean

  Set for the first call

### `mixExternal`

(

- `cb`

)
async

Defined in `lib/builder.js:338`

Fetches the remote data and fires the callback when it's all complete

#### Parameters:

- `cb` Callback

  The callback to execute when complete

### `nameSort`

(

- `a`
- `b`

)
Number

Defined in `lib/builder.js:1335`

Sort method of array of objects with a property called name

#### Parameters:

- `a` Object

  First object to compare

- `b` Object

  Second object to compare

#### Returns:

Number: 1, -1 or 0 for sorting.

### `NATIVES_LINKER`

(

- `name`

)
String private

Defined in `lib/builder.js:276`

Function to link an external type uses `NATIVES` object

#### Parameters:

- `name` String

  The name of the type to link

#### Returns:

String: The combined URL

### `populateClasses`

(

- `opts`

)
Object

Defined in `lib/builder.js:473`

Populate the meta data for classes

#### Parameters:

- `opts` Object

  The original options

#### Returns:

Object: The modified options

### `populateFiles`

(

- `opts`

)
Object

Defined in `lib/builder.js:525`

Populate the meta data for files

#### Parameters:

- `opts` Object

  The original options

#### Returns:

Object: The modified options

### `populateModules`

(

- `opts`

)
Object

Defined in `lib/builder.js:488`

Populate the meta data for modules

#### Parameters:

- `opts` Object

  The original options

#### Returns:

Object: The modified options

### `render`

(

- `source`
- `view`
- `[layout=null]`
- `[partials={}]`
- `callback`

)

Defined in `lib/builder.js:728`

Ported from Selleck Renders the handlebars templates with the default View class.

#### Parameters:

- `source` HTML

  The default template to parse

- `view` Class

  The default view handler

- `[layout=null]` HTML optional

  The HTML from the layout to use.

- `[partials={}]` Object optional

  List of partials to include in this template

- `callback` Callback
  - `err` Error
  - `html` HTML

    The assembled template markup

### `renderAPIMeta`

(

- `cb`

)
async

Defined in `lib/builder.js:1457`

Render the API meta and return the Javascript

#### Parameters:

- `cb` Callback

  The callback

### `renderClass`

(

- `cb`
- `cv.view`

)

Defined in `lib/builder.js:1019`

Render the class file

#### Parameters:

- `cb` Function

  The callback fired when complete

  - `html` String

    The HTML to render this view

- `cv.view` Object

  The View Data

### `renderFile`

(

- `cb`
- `cv.view`

)

Defined in `lib/builder.js:1396`

Render the source file

#### Parameters:

- `cb` Function

  The callback fired when complete

  - `html` String

    The HTML to render this view

- `cv.view` Object

  The View Data

### `renderIndex`

(

- `cb`
- `cv.view`

)

Defined in `lib/builder.js:782`

Render the index file

#### Parameters:

- `cb` Function

  The callback fired when complete

  - `html` String

    The HTML to render this view

- `cv.view` Object

  The View Data

### `renderModule`

(

- `cb`
- `cv.view`

)

Defined in `lib/builder.js:831`

Render a module

#### Parameters:

- `cb` Function

  The callback fired when complete

  - `html` String

    The HTML to render this view

- `cv.view` Object

  The View Data

### `writeAPIMeta`

(

- `cb`

)
async

Defined in `lib/builder.js:1444`

Write the API meta data used for the AutoComplete widget

#### Parameters:

- `cb` Callback

  The callback to execute when complete

### `writeClasses`

(

- `cb`

)

Defined in `lib/builder.js:1300`

Generates the class files under "out"/classes/

#### Parameters:

- `cb` Callback

  The callback to execute after it's completed

### `writeFiles`

(

- `cb`

)

Defined in `lib/builder.js:1358`

Generates the syntax files under `"out"/files/`

#### Parameters:

- `cb` Callback

  The callback to execute after it's completed

### `writeIndex`

(

- `cb`

)

Defined in `lib/builder.js:807`

Generates the index.html file

#### Parameters:

- `cb` Callback

  The callback to execute after it's completed

### `writeModules`

(

- `cb`

)

Defined in `lib/builder.js:909`

Generates the module files under "out"/modules/

#### Parameters:

- `cb` Callback

  The callback to execute after it's completed

## Properties

### `_mergeCounter`

Number private

Defined in `lib/builder.js:961`

Counter for stepping into merges

### `_meta`

Object private

Defined in `lib/builder.js:423`

Holder for project meta data

### `defaultReturnTags`

String

Defined in `lib/builder.js:405`

The default tags to use in return descriptions (for Markdown).

### `defaultTags`

String

Defined in `lib/builder.js:411`

The default tags to use in params descriptions (for Markdown).

### `files`

Number

Defined in `lib/builder.js:417`

File counter

### `NATIVES`

Object

Defined in `lib/builder.js:237`

List of native types to cross link to MDN