mirror of
https://github.com/pantor/inja.git
synced 2026-02-17 09:03:58 +00:00
add config throw_missing_includes, search_in_files
This commit is contained in:
13
README.md
13
README.md
@@ -178,17 +178,22 @@ render("{% if not guest_count %}…{% endif %}", data); // True
|
||||
|
||||
#### Includes
|
||||
|
||||
You can either include other template files or already parsed templates.
|
||||
You can either include other in-memory templates or from the file system.
|
||||
```.cpp
|
||||
// Other template files are included relative from the current file location
|
||||
render("{% include \"footer.html\" %}", data);
|
||||
|
||||
// To include in-memory templates, add them to the environment first
|
||||
inja::Template content_template = env.parse("Hello {{ neighbour }}!");
|
||||
env.include_template("content", content_template);
|
||||
env.render("Content: {% include \"content\" %}", data); // "Content: Hello Peter!"
|
||||
|
||||
// Other template files are included relative from the current file location
|
||||
render("{% include \"footer.html\" %}", data);
|
||||
|
||||
// You can disable to search for templates in the file system via
|
||||
env.set_search_included_templates_in_files(false);
|
||||
```
|
||||
|
||||
Inja will throw an `inja::RenderError` if an included file is not found.
|
||||
|
||||
### Functions
|
||||
|
||||
A few functions are implemented within the inja template syntax. They can be called with
|
||||
|
||||
Reference in New Issue
Block a user