Attributes
The following are attributes used to represent the metadata on an element.
#Attribute
A static attribute which explicitly states the value of the attribute.
#Example output
<img src="goose.png">
#AST
{
"type": "element",
"name": "img",
"attrs": {
"src": {
"type": "attribute",
"name": "src",
"value": "goose.png"
}
},
"children": []
}
#Variable Attribute
A variable attribute which references a data value.
#Example output
<img src="{{ image }}">
#AST
{
"type": "element",
"name": "img",
"attrs": {
"src": {
"type": "variable-attribute",
"name": "src",
"reference": ["image"]
}
},
"children": []
}
#Conditional Attribute
Similar to a variable attribute except the attributes existance is also variable. Only used for boolean attributes.
#Example output
<img {% if image %}src="{{ image }}"{% end %}>
#AST
{
"type": "element",
"name": "img",
"attrs": {
"src": {
"type": "conditional-attribute",
"name": "src",
"reference": ["image"]
}
},
"children": []
}