From 57ac9b93725cbddcaa7b25719cd01224d0543c07 Mon Sep 17 00:00:00 2001 From: pantor Date: Sun, 28 Jul 2019 14:23:50 +0200 Subject: [PATCH] update readme --- README.md | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 4a1c0eca..81564695 100644 --- a/README.md +++ b/README.md @@ -119,7 +119,7 @@ render("{{ guests.1 }}", data); // "Tom" // Objects render("{{ time.start }} to {{ time.end }}pm", data); // "16 to 22pm" ``` -In general, the variables can be fetched using the [JSON Pointer](https://tools.ietf.org/html/rfc6901) syntax. For convenience, the leading `/` can be ommited. If no variable is found, valid JSON is printed directly, otherwise an error is thrown. +In general, the variables can be fetched using the [JSON Pointer](https://tools.ietf.org/html/rfc6901) syntax. For convenience, the leading `/` can be omitted. If no variable is found, valid JSON is printed directly, otherwise an error is thrown. ### Statements @@ -162,13 +162,14 @@ render("{% if not guest_count %}…{% endif %}", data); // True #### Includes You can either include other template files or already parsed templates. -``` +```c++ // Other template files are included relative from the current file location -render({% include "footer.html" %}, data); +render("{% include \"footer.html\" %}", data); // To include in-memory templates, add them to the environment first -env.include_template("footer", temp); -render({% include "footer" %}, data); +inja::Template content_template = env.parse("Hello {{ neighbour }}!"); +env.include_template("content", content_template); +render("Content: {% include \"content\" %}", data); // "Content: Hello Peter!" ``` ### Functions