百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
I

inja

> 编程语言
开源

一个适用于现代 C++ 的模板引擎

2.0K stars0 点赞1 次浏览
访问官网GitHub

工具介绍

一个适用于现代 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· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C++header-onlyinjajinjajson

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言