Compose
Functional templating for Vala
https://github.com/arteymix/compose
Functional templating for Vala.
Using expressions for evaluating templates presents many advantages:
it's fast
it's quite elegant
lazy evaluation using callbacks with native environments
it's reusable since nodes can be isolated in functions
it provides minimal compile-time correctness
HTML5 elements support
Attributes are passed as an null-terminated array of key=value
entries, just like environment variables. There is no need to quote or escape what follows the =
sign.
Also, Compose will automatically escape data where it has to be.
HTML5
Every HTML5 elements can be found within the Compose.HTML5
namespace like shown in the first code example.
To escape values, which is not done by default if HTML is expected, use the e
helper.
Note that all attributes are already escaped.
Support for other format will be included if the project happen to become successful.
Utilities
Compose work like a sink, so it will consume data from various sources through a simple callback API. Lazy evaluation at it's finest!
When
Test some condition and render either the first or second callback result.
Take
Consume a callback until it return null
, using another callback to perform evaluation.
To help keep track of the current index an array is used, a counter is passed as first argument.
Last updated