Syntax
Table of Contents
Introduction
All the code related to Rockplate start with [
and ends with ]
. To separate keywords and identifers space
is used as a delimiter.
You can have [rockplate syntax] in between
an HTML, CSS, XML, plain text
or ANY text content
a complex example:
<div class="[container classname]">
<a href="[home link]">Go home</a>
<p>This is awesome</p>
<ul>
[repeat items]
<li>
<h3>[item name]</h3>
<p>
[item description]
[if item is free]
<span class="highlight">FREE</span>
[end if]
</p>
</li>
[end repeat]
</ul>
</div>
<style>
.[container classname] {
max-width: [container width];
}
</style>
Comments start with [--
and ends with --]
. In between it can have any text.
Syntax notation:
[
--
zero or more characters
--
]
This is [-- a comment --] among other text
Comments can have
[--
multiple
lines
--]
Other expressions [-- within the comment block
have no [special meaning] --]
Expressions - Identifers
Expressions can be used to print Identifiers
Syntax notation:
[
OBJECT
space
IDENTIFIER_PROPERTY
]
{
"order": {
"ref": "210045-674558-981560"
}
}
Dear customer,
Your order [order ref] is on the way.
Thank you.
If blocks - Booleans
If blocks can be used to make use of Booleans
Syntax notation:
[
if
space
OBJECT
space
operator
space
BOOLEAN_PROPERTY
]
True Content
[
else
]
False Content (optional)
[
end
space
if
]
Operators
is
| are
| is not
| are not
{
"order": {
"paid": true
},
"vegetables": {
"fresh": true
}
}
[if order is paid]
Paid
[else]
Unpaid
[end if]
I eat
[if vegetables are fresh]
healthy
[end if]
vegetables π₯π₯¦π
ππ₯π₯¬π₯πΆ
Repeat blocks - Arrays
Repeat blocks can be used to loop through Arrays
Syntax notation:
[
repeat
space
ARRAY
]
Inner Content
[
end
space
repeat
]
{
"orders": [
{
"order": {
"status": "Paid",
"ref": "210045-674558-981560"
},
"discount": {
"available": false,
"amount": "5%"
}
}
]
}
Your orders:
[repeat orders]
Ref: [order ref]
Status: [order status]
[if discount is available]
Discount: [discount amount]
[end if]
[end repeat]