mirror of
https://github.com/pantor/inja.git
synced 2026-04-04 15:18:53 +00:00
fix wrong render_file in readme
This commit is contained in:
@@ -66,18 +66,19 @@ Environment env;
|
||||
std::string result = env.render("Hello {{ name }}!", data); // "Hello world!"
|
||||
|
||||
// Or directly read a template file
|
||||
Template temp = env.parse_template("./template.txt");
|
||||
Template temp = env.parse_template("./templates/greeting.txt");
|
||||
std::string result = env.render(temp, data); // "Hello world!"
|
||||
|
||||
data["name"] = "Inja";
|
||||
std::string result = env.render(temp, data); // "Hello Inja!"
|
||||
|
||||
// Or read a json file for data directly from the environment
|
||||
result = env.render_file("./template.txt", "./data.json");
|
||||
// Or read the template file (and/or the json file) directly from the environment
|
||||
result = env.render_file("./templates/greeting.txt", data);
|
||||
result = env.render_file_with_json_file("./templates/greeting.txt", "./data.json");
|
||||
|
||||
// Or write a rendered template file
|
||||
env.write(temp, data, "./result.txt");
|
||||
env.write_with_json_file("./template.txt", "./data.json", "./result.txt");
|
||||
env.write_with_json_file("./templates/greeting.txt", "./data.json", "./result.txt");
|
||||
```
|
||||
|
||||
The environment class can be configured to your needs.
|
||||
|
||||
Reference in New Issue
Block a user