README.md

template-render-wizard

Application for rendering from template files, providing with values in yaml-files or by pass key-value for template with argument --set key=value.

template language

render value

simple insert variable from yaml or argument passed

{{ variable_name }}

calculated value:

{% (variable_name + 5) * (variable_name - 5) %}

extract value from object:

{{ user.name }}

conditions

simple conditions

{% if expr %}
  ... < some code > ...
{% endif %}

conditions with else block

{% if expr %}
  ... < some code > ...
{% else %}
  ... <some code > ...
{% endif %}

expressions in if

simple check exists variable:

{% if some_variable %}

complex calculated conditions:

{% if x > y and y * (x - 1) < 50 %}

loops

simple:

{% for item in items %}
  ... <some code > ...
{% endfor %}

loop with key-value:

{% for key, val in items %}
  ... <some code > ...
{% endfor %}

include

simple:

<div class="articles">
    {% include template.file.tpl %}
</div>

or include with context:

<div class="articles">
    {% include template.file.tpl with { value: a + b * 2 } %}
</div>

and include with isolated context from parent/root:

<div class="articles">
    {% include template.file.tpl with { value: a + b * 2 } only %}
</div>

project dependencies

Static libraries:

how it build?

cmake .
make

examples

For example content of values file:

# data for tests (fixtures/003-values.yaml)
name: test-data

Template file:

Hello world!
My name is {{ name }}!

Run application and his output:

./template-render-wizard --values fixtures/003-values.yaml fixtures/003-simple-text.txt
Hello world!
My name is test-data!

Конвейеры
0 успешных
0 с ошибкой