API Docs for: 0.2.40
Show:

utils Class

Defined in: lib/utils.js:11
Module: yuidoc

Utilities Class

Methods

escapeHTML

(
  • html
)
String

Defined in lib/utils.js:29

Escapes HTML characters in html.

Parameters:

  • html String

    String to escape.

Returns:

String: Escaped string.

getDirs

(
  • dir
)
Array

Defined in lib/utils.js:262

Walks the tree from this dir and returns all the subdirs

Parameters:

  • dir String

    The dir to begin at

Returns:

Array: The array of directories..

getLayouts

(
  • dir
)
Object

Defined in lib/utils.js:63

Like getPages(), but returns only the files under the layout/ subdirectory of the specified dir.

Parameters:

Returns:

Object: Mapping of layout names to layout content.

getPage

(
  • pagePath
)
String | Null

Defined in lib/utils.js:76

Loads and returns the content of the specified page file.

Parameters:

  • pagePath String

    Path to a single .handlebars page.

Returns:

String | Null: Page content, or null if not found.

getPages

(
  • dir
)
Object

Defined in lib/utils.js:89

Loads pages (files with a .handlebars extension) in the specified directory and returns an object containing a mapping of page names (the part of the filename) preceding the .handlebars extension) to page content.

Parameters:

Returns:

Object: Mapping of page names to page content.

getPartials

(
  • dir
)
Object

Defined in lib/utils.js:120

Like getPages(), but returns only the files under the partial/ subdirectory of the specified dir.

Parameters:

Returns:

Object: Mapping of partial names to partial content.

getProjectData

(
  • [dir=process.cwd()]
)

Defined in lib/utils.js:223

Walk the directory tree to locate the yuidoc.json file.

Parameters:

  • [dir=process.cwd()] Path optional

    The directory to start from

prepare

(
  • inDir
  • options
  • callback
)

Defined in lib/utils.js:134

Mix/merge/munge data into the template.

Parameters:

  • inDir String

    The starting directory

  • options Object

    The options for the meta data.

  • callback Callback

    The callback to excecute when complete

unindent

(
  • content
)
String private

Defined in lib/utils.js:42

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.

Parameters:

  • content String

    Text to unindent.

Returns:

String: Unindented text.

validatePaths

(
  • paths
  • [ignore=false]
)

Defined in lib/utils.js:289

Make sure all the paths passed are directories and that they are not in the ignore list.

Parameters:

  • paths Array

    The array of paths to validate

  • [ignore=false] String optional

    A string to call .indexOf on a path to determine if it should be ignored