-
-
Notifications
You must be signed in to change notification settings - Fork 0
Temme options
Options are what give a hierarchy its identity, and tells Temme what to do with the hierarchy on the parsing process. The following is a fully sanitized and valid hierarchy object.
{
temmeIds: [],
ref: "",
id: "",
name: "div",
classes: [],
childNodes: [],
templates: [],
attributes: {},
dataset: {},
content:{
type: "text",
value: ""
},
from:{
ref: "",
mode: "append",
include:["name", "id", "classes", "attributes", "dataset", "content", "childNodes"],
exclude:[],
children: {
allow: false,
placement: "after"
}
}
}
Note that all options and sub-options are case sensitive and their value types are absolute, any invalid inputs will have Temme throw an error and call off the whole process. You could, of course, populate each one of your hierarchy manually, but as you can see, that would be time-consuming on its own, and the massive size of only one of them (shown above) is pretty intimidating by itself. You only give primitive values for the options you're interested in, and Temme populates the rest with default values.
A unique (6 for non-templates or 4 for templates) characters alphanumeric string assigned by Temme internally that you can't assign to a hierarchy yourself. It helps Temme identify which hierarchy object is which and distinguishes between a template and a non-template object.
Data type | Default value | Accepted value(s) |
---|---|---|
string |
Empty string. | Any valid string that doesn't start with @ because that's a reserved symbol. |
A reference string that's given to a hierarchy object so that other hierarchy objects/templates can reference it by.
Data type | Default value | Accepted value(s) |
---|---|---|
string |
Empty string. | Any valid string that doesn't break the HTML element id rules. |
The id you wish the element that will be parsed from the hierarchy object to have.
Data type | Default value | Accepted value(s) |
---|---|---|
string |
div |
Any valid string. |
The HTML tag name (ex; h1, div, button, input, table, some-custom-tag...).
Data type | Default value | Accepted value(s) |
---|---|---|
Array<string> |
[] |
Any valid array of strings that doesn't break the HTML element classes rules. |
The HTML classes that the parsed element will have.
Data type | Default value | Accepted value(s) |
---|---|---|
Object |
{} |
Any valid object of key/pair values that doesn't break the HTML element attributes rules. |
The HTML attributes that the parsed element will have.
Data type | Default value | Accepted value(s) |
---|---|---|
Object |
{} |
Any valid object of key/pair values that doesn't break the HTML element dataset rules. |
The HTML data attributes that the parsed element will have.
Data type | Default value | Accepted value(s) |
---|---|---|
Array<Object> |
[] |
Any valid array of hierarchy obejcts. |
The children nodes of the parsed HTML element.
Data type | Default value | Accepted value(s) |
---|---|---|
Array<Object> |
[] |
Any valid array of template obejcts. |
The template objects of a hierarchy element.
Data type | Default value | Accepted value(s) |
---|---|---|
Object |
{ type: "text", value: "" } |
The type sub-option must either be text or html indicating textContent and innerHTML respectively. |
The HTML content (textContent or innerHTML) that the parsed element will have.
Data type | Default value | Accepted value(s) |
---|---|---|
string |
text |
text or html
|
The type of the HTML's content corresponds to textContent
and innerHTML
respectively.
Data type | Default value | Accepted value(s) |
---|---|---|
string |
Empty string. | Any valid array. |
The content of the HTML element.
Data type | Default value | Accepted value(s) |
---|---|---|
Object |
from:{ ref: "", mode: "append", include:["name", "id", "classes", "attributes", "dataset", "content", "childNodes"], exclude:[], children: { allow: false, placement: "after" } } |
- |
The referencing configuration used to inherit options from another hierarchy object/template.
Data type | Default value | Accepted value(s) |
---|---|---|
string |
Empty string. | An existing reference of some other hierarchy/template object that's on the same level of depth or lowers that the said hierarchy object. |
The reference of the hierarchy object you want to inherit the options from.
Data type | Default value | Accepted value(s) |
---|---|---|
string |
append or override . |
The mode of the inheritance. |
How the options should be inherited, append
is the default, and it inherits the options that are not populated by the end-user. override
overrides all of the options upon inheritance.
Data type | Default value | Accepted value(s) |
---|---|---|
Array<string> |
["name", "id", "classes", "attributes", "dataset", "content", "childNodes"]. | Specifies what options to inherit. |
Tells Temme what options to inherit, anything that's not inside of the array is immediately ignored. You can only have valid option names in the array.
If no include
sub-option is manually added, Temme will automatically inherit everything from the referenced hierarchy object.
Data type | Default value | Accepted value(s) |
---|---|---|
Array<string> |
[]. | Specifies what options to not inherit. |
Tells Temme what options to not inherit, anything that's inside of the array is immediately ignored. You can only have valid option names in the array.
If no exclude
sub-option is manually added, Temme will automatically inherit everything from the referenced hierarchy object.
Data type | Default value | Accepted value(s) |
---|---|---|
Object |
{ allow: false, placement: "after" } . |
How Temme goes around inheriting childNodes. |
Tells Temme how to process the inheritance of children nodes.
Data type | Default value | Accepted value(s) |
---|---|---|
boolean |
false |
true or false
|
If set to true
, the referencing hierarchy object will inherit the referenced hierarchy object's childNodes option and vice versa.
Data type | Default value | Accepted value(s) |
---|---|---|
string |
after |
after or before
|
The placement of the inherited childNodes, after or before the inheriting hierarchy object's childNodes.