[
Welcome to my blog!
{% endblock %} ``` calls a parent template with the `extends` keyword; it should be the first element in the template. It is possible to render the contents of the parent block by calling `super()`. In the case of multiple levels of `{% extends %}`, super references may be called with an argument (e.g. `super(2)`) to skip levels in the inheritance tree. ### Whitespace Control In the default configuration, no whitespace is removed while rendering the file. To support a more readable template style, you can configure the environment to control whitespaces before and after a statement automatically. While enabling `set_trim_blocks` removes the first newline after a statement, `set_lstrip_blocks` strips tabs and spaces from the beginning of a line to the start of a block. ```.cpp Environment env; env.set_trim_blocks(true); env.set_lstrip_blocks(true); ``` With both `trim_blocks` and `lstrip_blocks` enabled, you can put statements on their own lines. Furthermore, you can also strip whitespaces for both statements and expressions by hand. If you add a minus sign (`-`) to the start or end, the whitespaces before or after that block will be removed: ```.cpp render("Hello {{- name -}} !", data); // "Hello Inja!" render("{% if neighbour in guests -%} I was there{% endif -%} !", data); // Renders without any whitespaces ``` Stripping behind a statement or expression also removes any newlines. ### Comments Comments can be written with the `{# ... #}` syntax. ```.cpp render("Hello{# Todo #}!", data); // "Hello!" ``` ### Exceptions Inja uses exceptions to handle ill-formed template input. However, exceptions can be switched off with either using the compiler flag `-fno-exceptions` or by defining the symbol `INJA_NOEXCEPTION`. In this case, exceptions are replaced by `abort()` calls. ## Supported compilers Inja uses the `string_view` feature of the C++17 STL. Currently, the following compilers are tested: - GCC 7 - 11 (and possibly later) - Clang 5 - 12 (and possibly later) - Microsoft Visual C++ 2017 15.0 - 2022 (and possibly later) A list of supported compiler / os versions can be found in the [CI definition](https://github.com/pantor/inja/blob/master/.github/workflows/ci.yml).