API Docs for: 0.10.0
Show:

Utils Class

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

Utilities Class

Methods

escapeHTML

(
  • html
)
String

Defined in lib/utils.js:32

Escapes HTML characters in html.

Parameters:

  • html String

    String to escape.

Returns:

String:

Escaped string.

fixType

(
  • t
)
String

Defined in lib/utils.js:459

Takes a type string and converts it to a "First letter upper cased" type. e.g. (string -> String, object -> Object)

Parameters:

  • t String

    The type string to convert

Returns:

String:

The fixed string

getDirs

(
  • baseDir
  • ignore
)
Array

Defined in lib/utils.js:339

Walks the tree from this dir and returns all the subdirs

Parameters:

  • baseDir String

    The dir to begin at

  • ignore Array

    An array of paths to ignore

Returns:

Array:

The array of directories..

getLayouts

(
  • dir
)
Object

Defined in lib/utils.js:66

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:79

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:94

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:127

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

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

Defined in lib/utils.js:227

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

Parameters:

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

    The directory to start from

prepare

(
  • inDir
  • options
  • callback
)

Defined in lib/utils.js:141

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:45

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:384

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

webpath

(
  • url
)
String

Defined in lib/utils.js:481

Produces a normalized web path by joining all the parts and normalizing the filesystem-like path into web compatible url. Supports relative and absolute paths. Courtesy of Mojito's utils

Parameters:

  • url Array | String*

    the list of parts to be joined and normalized

Returns:

String:

The joined and normalized url