master
md 34 lines 1.61 KB
Rendered Raw
1 This directory contains templates used to generate the `integrations.js` file.
2
3 Templating is done using Jinja2 as a templating engine. Full documentation
4 can be found at https://jinja.palletsprojects.com/en/ (the ‘Template
5 Designer Documentation’ is the relevant part for people looking to
6 edit the templates, it’s not linked directly here to avoid embedding
7 version numbers in the links).
8
9 The particular instance of Jinja2 used has the following configuration
10 differences from the defaults:
11
12 - Any instances of curly braces in are replaced with square brackets
13 (so instead of `{{ variable }}`, the syntax used here is `[[ variable
14 ]]`. This is done so that templating commands for the frontend can be
15 included without having to do any special escaping for them.
16 - `trim_blocks` and `lstrip_blocks` are both enabled, meaning that
17 the first newline after a block will be _removed_, as will any leading
18 whitespace on the same line as a block.
19
20 Most markdown templates correspond to the key of the same name in the
21 integrations objects in that file. Those templates get passed the
22 integration data using the name `entry`, plus the composed related
23 resource data using the name `rel_res`.
24
25 The `setup` section is a special case and is selected by integration
26 type in `gen_integrations.py`:
27
28 - `setup-generic.md` for the generic integration path
29 - `setup-logs.md` for logs integrations
30 - `setup-secretstore.md` for secretstore integrations
31
32 The `integrations.js` template is used to compose the final file. It gets
33 passed the JSON-formatted category and integration data using the names
34 `categories` and `integrations` respectively.