API Docs for: 0.1.0

Class utils

Class defined in: lib/utils.js:6

Utilities Class

String escapeHTML ( html )
lib/utils.js:24

Escapes HTML characters in html.

Parameters:
  • html <String> String to escape.

Returns: <String> Escaped string.
Object getLayouts ( dir )
lib/utils.js:58

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

Parameters:
  • dir <String> Directory path.

Returns: <Object> Mapping of layout names to layout content.
String | null getPage ( pagePath )
lib/utils.js:71

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.
Object getPages ( dir )
lib/utils.js:84

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:
  • dir <String> Directory path.

Returns: <Object> Mapping of page names to page content.
Object getPartials ( dir )
lib/utils.js:115

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

Parameters:
  • dir <String> Directory path.

Returns: <Object> Mapping of partial names to partial content.
getProjectData ( [dir=process.cwd()] )
lib/utils.js:214

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

Parameters:
  • [dir=process.cwd()] <Path> The directory to start from
prepare ( inDir, options, callback )
lib/utils.js:129

Mix/merge/munge data into the template.

Parameters:
  • inDir <String> The starting directory
  • options <Object> The options for the meta data.
  • callback <Callback>
String unindent ( content ) /* private method */
lib/utils.js:37

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] )
lib/utils.js:244

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> A string to call .indexOf on a path to determine if it should be ignored