Description

Mustache-inspired template compiler and interpreter for D

Package Information

Version0.0.30 (2016-Dec-29)
Repositoryhttps://github.com/eBookingServices/vayne
LicenseMIT
CopyrightCopyright © 2016, Márcio Martins
AuthorsMárcio Martins
Registered byMárcio Martins
Dependenciesnone

Installation

To use this package, put the following dependency into your project's dependencies section:

dub.json
dub.sdl

Readme

Vayne - Mustache-inspired template compiler and interpreter for D

Vayne has been written mainly for use with vibe.d but it can be used in any other way. It is the successor to jax, a compile-time solution.

Compiles source text/html into bytecode to be interpreted at run time.

Features

  • HTML compressor
  • Parametrized macros
  • Good and detailed error reporting
  • Supports user defined escaping and translation
Options
-r --print-preparse print preparser result
-a      --print-ast print ast
-i   --print-instrs print generated instructions
-k   --print-consts print generated constant slots
-b --print-bytecode print generated bytecode and instructions
-t           --time display elapsed time
-v        --verbose verbose output
-c       --compress compress HTML in between template tags
-o     --output-dir output directory
-d  --dep-cache-dir dependant-cache directory
-g   --dep-gen-only only generate dependant-cache, do not re-compile dependants
-j         --search search path(s) to look for source files
-e    --default-ext default source file extension (defaults to .html)


Tags
{{& fileName }} - Include external file
{{&& fileName }} - Embed external file as mime-encoded content
{{* key, value; iterable }} {{key}} {{value}} {{/}} - Iterate any iteratable symbol
{{? expr }} true case {{: [expr] }} else case {{/}}
{{@ expr0, expr2 as ident }} - Create symbol scopes or named copy of expressions. For symbol scopes, expression must evalute to an object or associative array.
{{! comment }} - Comment
{{ expr }} - Write expression to output with automatic HTML escaping
{{{ expr }}} - Write expression to output without escaping
{{~ message-id-expr, arg0+ }} - Translate message-id with arguments and output - use triple brackets to disable escaping
{{#def myMacro(arg) }} macro text {{#arg}} {{#/}}
{{#myMacro("mooo") }} - Expand a macro


Check the example directory for a working example.

Available versions

0.0.30 0.0.29 0.0.28 0.0.27 0.0.26 0.0.25 0.0.24 0.0.23 0.0.22 0.0.21 0.0.20 0.0.19 0.0.18 0.0.17 0.0.16 0.0.15 0.0.14 0.0.13 0.0.12 0.0.11 0.0.10 0.0.9 0.0.8 0.0.7 0.0.6 0.0.5 0.0.4 0.0.3 0.0.2 0.0.1 ~master ~index_of_changes