一个适用于现代 C++ 的模板引擎
Inja 是一个面向现代 C++ 的模板引擎,灵感来自于 Python 的 [jinja](http://jinja.pocoo.org)。它具有简单而强大的模板语法,包含您需要的所有变量、循环、条件、包含、回调和注释,可以按您喜欢的方式进行嵌套和组合。当然,所有相关编译器上的 CI 都对其进行了测试。以下是其外观: ```.cpp json data; data["name"] = "world";
inja::render("Hello {{ name }}!", data); // Returns "Hello world!"
## 集成
Inja 是一个仅包含头文件的库,可以从 [发行版](https://github.com/pantor/inja/releases) 或直接从 `include/` 或 `single_include/` 文件夹中下载。Inja 使用 `nlohmann/json.hpp` (>= v3.8.0) 作为其唯一依赖项,因此请确保可以从 `inja.hpp` 中包含。json 可以从 [这里](https://github.com/nlohmann/json/releases) 下载。然后集成过程就像这样:
您还可以使用 [Hunter](https://github.com/cpp-pm/hunter) (一个用于 C++ 的包管理器) 在项目中集成 inja。如果您在项目中使用 [vcpkg](https://github.com/Microsoft/vcpkg) 来管理外部依赖项,则可以使用 [inja 包](https://github.com/Microsoft/vcpkg/tree/master/ports/inja)。请参阅 vc
<a href="https://github.com/pantor/inja/actions">
<a href="https://github.com/pantor/inja/actions">
<a href="https://app.codacy.com/gh/pantor/inja/dashboard">
<a href="https://github.com/pantor/inja/releases">
<a href="http://github.com/pantor/inja/issues">
<a href="https://raw.githubusercontent.com/pantor/inja/master/LICENSE">暂无开放 Issues,或尚未同步最近议题。