JinjaFx - Jinja2 Templating Tool

D
A
T
A
.
C
S
V
G
L
O
B
A
L
.
Y
M
L
V
A
R
S
.
Y
M
L
T
E
M
P
L
A
T
E
.
J
2

Outputs


JinjaFx can create different outputs from the same template using the following syntax:

<output "Output 1">
...
</output>

<output "Output 2">
...
</output>

By default an output is rendered as text, but you can also tell JinjaFx to render it as HTML or Markdown (GFM), e.g:

<output:html "Output 1">
...
</output>

<output:markdown "Output 2">
...
</output>

Dynamic CSV


Within the "data.csv" pane you can specify regular CSV where each row will be treated as a data set using the header row for variable names. However, it also supports something which I call Dynamic CSV where you can use regular expression based static character classes or static groups as values within the data rows using (value1|value2|value3) or [a-f]. These will then be expanded into multiple rows, e.g:

DEVICE, TYPE
us(ma|n[yh]|tx)-pe-1[ab], pe

The above would be expanded to the following, which JinjaFx would then loop through like normal rows (be careful as you can easily create huge data sets) - if you do wish to use literal brackets then they would need to be escaped (e.g. "\[" or "\(").

DEVICE, TYPE
usma-pe-1a, pe
usma-pe-1b, pe
ustx-pe-1a, pe
ustx-pe-1b, pe
usny-pe-1a, pe
usny-pe-1b, pe
usnh-pe-1a, pe
usnh-pe-1b, pe

We also support the ability to expand rows based on numerical counters using the { start[-end]:step } syntax, e.g:

INTERFACE
et-0/0/{0-9:1}

The above syntax would convert one row into ten rows using the values 0 to 9. If the end value is omitted then it is a passive counter and will only increment if something else is expanding the rows.


Inputs


Normally data is provided to JinjaFx via CSV or YAML using the above panes, but JinjaFx can also prompt the user for input using the "jinjafx_input" variable in "vars.yml", e.g:

jinjafx_input:
  prompt:
    name:
      text: "Name"
      required: True
    age:
      text: "Age"
      required: True
      pattern: "[1-9]+[0-9]*"

These inputs can then be used in your template using the following Jinja2 syntax:

{{ jinjafx_input['name'] }} is {{ jinjafx_input['age'] }} years old

For more advanced syntax that allows you to specify the format of the input dialog please see README.md on GitHub.