Utils Class
Utilities Class
Item Index
Methods
escapeHTML
-
html
Escapes HTML characters in html.
Parameters:
-
html
StringString to escape.
Returns:
fixType
-
t
Takes a type string and converts it to a "First letter upper cased" type. e.g. (string -> String, object -> Object)
Parameters:
-
t
StringThe type string to convert
Returns:
getDirs
-
dir
Walks the tree from this dir and returns all the subdirs
Parameters:
-
dir
StringThe dir to begin at
Returns:
getLayouts
-
dir
Like getPages()
, but returns only the files under the layout/
subdirectory
of the specified dir.
Parameters:
-
dir
StringDirectory path.
Returns:
getPage
-
pagePath
Loads and returns the content of the specified page file.
Parameters:
-
pagePath
StringPath to a single
.handlebars
page.
Returns:
null
if not found.
getPages
-
dir
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
StringDirectory path.
Returns:
getPartials
-
dir
Like getPages()
, but returns only the files under the partial/
subdirectory
of the specified dir.
Parameters:
-
dir
StringDirectory path.
Returns:
getProjectData
-
[dir=process.cwd()]
Walk the directory tree to locate the yuidoc.json file.
Parameters:
-
[dir=process.cwd()]
Path optionalThe directory to start from
prepare
-
inDir
-
options
-
callback
Mix/merge/munge data into the template.
unindent
-
content
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
StringText to unindent.