Rockplate
Templating language for sensible humans
Documentation and Demo
Click here for full documentation with demo and examples.
Quick Docs for the curious cats
Installation
npm install rockplate
Usage
TypeScript/JavaScript
; const template = 'My name is [my name]';const schema = my: name: 'My Name' ;const rpl = template schema;const output = rpl;console; // My name is Safraz Razik
Syntax and Schema/Data structure
Limitations are good - for a templating language
Booleans
Values: true
| false
"order" : "paid": true "vegetables": "fresh": true // example for " are " operator
Syntax: [if order is paid] .... [end if]
Operators: is
| are
| is not
| are not
[if order is paid] Paid[else] Unpaid[end if]
I eat[if vegetables are fresh] healthy[end if]vegetables 🥕🥦🍅🍆🥝🥬🥒🌶
Identifers
Values: string
| number
or any
printable value
"order" : "ref": "210045-674558-981560"
Syntax: [order ref]
Thank you for your order [order ref]
Arrays
Value: Collection of Booleans
or Identifers
"orders" : "order" : "status": "Paid" "ref": "210045-674558-981560" "discount" : "available": false "amount": "5%"
Syntax: [repeat orders] .... [end repeat]
Your orders:[repeat orders] Ref: [order ref] Status: [order status] [if discount is available] Discount: [discount amount] [end if] [end repeat]