Members
(private, static, readonly) templates :Object
Contains loaded templates
- Source:
- See:
Methods
(private, static) ._appendToAttribute(el, attr, val) → {string}
Appends value to attribute
Parameters:
el
(
cheerio
)
attr
(
string
)
val
(
any
)
- Source:
(private, static) ._concatAttributes(…attributes) → {object}
Parameters:
attributes
(
object
|
cheerio
)
<repeatable>Attribute sources which should be concatenated
- Source:
(private, static) ._ensureArray(arr) → {Array.<string>}
Makes sure, given variable is an array. If not, it will be splitted into an array
Parameters:
arr
(
string
|
Array.<string>
)
- Source:
(static) .addClass(el, classname)
Adds class to element and sets data-attributes for debugging reasons
Parameters:
el
(
cheerio
)
classname
(
string
)
- Source:
(static) .removeClass(el, classname)
Removes class to element and sets data-attributes for debugging reasons
Parameters:
el
(
cheerio
)
classname
(
string
)
- Source:
(private, static) .replace(el, tplName, variablesopt)
Replaces one element with given template
Parameters:
el
(
cheerio
)
Element to be replaced
tplName
(
string
)
Name of the template to use
variables
(
object
)
<optional>Additional variables which will be passed to the template
- Source:
(private, static) .wrap(el, tplName, assetsopt, transcludeClassesopt)
Wraps given element with given template
Parameters:
el
(
cheerio
)
Element to be replaced
tplName
(
string
)
Name of the template to use
assets
(
object
)
<optional>Additional options for replacing elements
Properties
classes
(
string
|
Array.<string>
)
<optional>Add additional classes to template
attributes
(
object
)
<optional>Add additional attributes which will be added to template
variables
(
object
)
<optional>Additional variables which will be passed to the template
transcludeClasses
(
boolean
)
<optional>Should be classes moved from source element to template
- Source:
(private, static) .wrapContent(el, tplName, assetsopt)
Wraps the content of given element with given template
Parameters:
el
(
cheerio
)
Element to be replaced
tplName
(
string
)
Name of the template to use
assets
(
object
)
<optional>Additional options for replacing elements
Properties
classes
(
string
|
Array.<string>
)
<optional>Add additional classes to template
attributes
(
object
)
<optional>Add additional attributes which will be added to template
variables
(
object
)
<optional>Additional variables which will be passed to the template
- Source: