C++ HTML 模板框架、模板化库、HTML 生成器库
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/355650/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
C++ HTML template framework, templatizing library, HTML generator library
提问by Marcin Gil
I am looking for template/generator libraries for C++ that are similar to eg. Ruby's Erb, Haml, PHP's Smarty, etc.
我正在寻找类似于例如的 C++ 模板/生成器库。Ruby 的 Erb、Haml、PHP 的 Smarty 等。
It would be great if I it would sport some basic features like loops, if/else, int conversion to strings, etc.
如果我能使用一些基本功能,比如循环、if/else、int 到字符串的转换等,那就太好了。
Parameter passing to template rendering engine is also important if I could pass all of them in a hash map instead of calling some function for each of parameters.
如果我可以在哈希映射中传递所有参数而不是为每个参数调用某个函数,则传递给模板渲染引擎的参数也很重要。
Do you have any recommendations?
你有什么建议?
I can see also the possibility of embedding languages like Lua, however I haven't found a templatizing library for that either.
我也可以看到嵌入像 Lua 这样的语言的可能性,但是我也没有找到一个模板化库。
采纳答案by Marcin Gil
A quick review of the mentioned project.
对上述项目的快速回顾。
http://rgrz.tumblr.com/post/13808947359/review-of-html-template-engines-in-c-language
http://rgrz.tumblr.com/post/13808947359/review-of-html-template-engines-in-c-language
ClearSilver
清银
- Site: http://www.clearsilver.net
- Project: https://code.google.com/p/clearsilver/
- Group: http://tech.groups.yahoo.com/group/ClearSilver
- License: New BSD License
- Language: C
- Last Update: Nov 28, 2011
- Last Release: 0.10.5 on July 12, 2007
- Document: Rich
- Community: Medium (<10 discussion per month)
- 网站:http: //www.clearsilver.net
- 项目:https: //code.google.com/p/clearsilver/
- 群组:http: //tech.groups.yahoo.com/group/ClearSilver
- 许可证:新的 BSD 许可证
- 语言:C
- 最后更新:2011 年 11 月 28 日
- 最后版本:2007 年 7 月 12 日的 0.10.5
- 文档:丰富
- 社区:中等(每月<10 次讨论)
Teng
腾
- Site: http://teng.sourceforge.net
- Code: http://teng.svn.sourceforge.net/teng/
- Group: http://sourceforge.net/projects/teng/
- License: New BSD License
- Language: C++
- Binding: php, python
- Last Update: Mar 8, 2011
- Last Release: 2.1.1 on Mar 8, 2011
- Document: Rich
- Community: Low (rare discussion since 2010)
- 网站:http: //teng.sourceforge.net
- 代码:http: //teng.svn.sourceforge.net/teng/
- 组:http: //sourceforge.net/projects/teng/
- 许可证:新的 BSD 许可证
- 语言:C++
- 绑定:php、python
- 最后更新:2011 年 3 月 8 日
- 最后版本:2011 年 3 月 8 日的 2.1.1
- 文档:丰富
- 社区:低(自 2010 年以来很少讨论)
Templatizer
模板器
- Site: http://www.lazarusid.com/libtemplate.shtml
- Project: download only
- Group: none
- License: free to use
- Language: C (low level)/C++ (interface) mixed
- Last Update: unknown
- Last Release: unknown
- Document: none
- Community: none
- 网站:http: //www.lazarusid.com/libtemplate.shtml
- 项目:仅下载
- 组:无
- 许可证:免费使用
- 语言:C(低级)/C++(接口)混合
- 最后更新:未知
- 最后发布:未知
- 文件:无
- 社区:无
HTML Template C++
HTML 模板 C++
- Site: http://nulidex.com/code/docs/html_template/
- Project: http://sourceforge.net/projects/htmltemplatec
- Group: http://sourceforge.net/projects/htmltemplatec
- License: GPL
- Language: C++
- Last Update: Mar 27, 2011
- Last Release: Beta 0.7.4, Mar 27, 2011
- Document: Medium
- Community: none
- 网站:http: //nulidex.com/code/docs/html_template/
- 项目:http: //sourceforge.net/projects/htmltemplatec
- 组:http: //sourceforge.net/projects/htmltemplatec
- 许可证: GPL
- 语言:C++
- 最后更新:2011 年 3 月 27 日
- 最后版本:Beta 0.7.4,2011 年 3 月 27 日
- 文档:中
- 社区:无
ctpp
cp
- Site: http://ctpp.havoc.ru/en/
- Project: download only
- Group: none
- License: BSD License
- Language: C++ with C API
- Last Update: Oct 5, 2011
- Last Release: Version 2.7.2 on Oct 5, 2011
- Document: Rich
- Community: none
- 网站:http: //ctpp.havoc.ru/en/
- 项目:仅下载
- 组:无
- 许可证:BSD 许可证
- 语言:C++ 和 C API
- 最后更新:2011 年 10 月 5 日
- 最后版本:2011 年 10 月 5 日发布的 2.7.2 版
- 文档:丰富
- 社区:无
Wt
重量
- Site: http://www.webtoolkit.eu/wt/
- Project: http://www.webtoolkit.eu/wt/
- Group: http://www.webtoolkit.eu/wt/community
- License: GPL and Commercial
- Language: C++
- Last Update: Nov 29, 2011
- Last Release: 3.2.0 on Nov 29, 2011
- Document: Rich
- Community: Low (rare activity)
- 网站:http: //www.webtoolkit.eu/wt/
- 项目:http: //www.webtoolkit.eu/wt/
- 组:http: //www.webtoolkit.eu/wt/community
- 许可证:GPL 和商业
- 语言:C++
- 最后更新:2011 年 11 月 29 日
- 最后发布:2011 年 11 月 29 日的 3.2.0
- 文档:丰富
- 社区:低(罕见活动)
Flate
弗拉特
- Site: http://flate.dead-inside.org/
- Project: none
- Group: none
- License: LGPL v2.1
- Language: C
- Last Update: Sep 4, 2010
- Last Release: 2.0 on Sep 4, 2010
- Document: Poor
- Community: none
- 网站:http: //flatate.dead-inside.org/
- 项目:无
- 组:无
- 许可证:LGPL v2.1
- 语言:C
- 最后更新:2010 年 9 月 4 日
- 最后版本:2010 年 9 月 4 日发布的 2.0
- 文件:差
- 社区:无
Jinja2C++
Jinja2C++
- Site: https://jinja2cpp.dev
- Project: https://github.com/jinja2cpp
- Group: https://gitter.im/Jinja2Cpp/Lobby
- Conan packages: https://bintray.com/beta/#/flexferrum/conan-packages/jinja2cpp:flexferrum?tab=overview
- License: MPL-2.0
- Language: C++14/17
- Last Update: Oct 01, 2019
- Last Release: 1.0.0 on Oct 01, 2019
- Document: Moderate
- Community: none
- 网站:https: //jinja2cpp.dev
- 项目:https: //github.com/jinja2cpp
- 群组:https: //gitter.im/Jinja2Cpp/Lobby
- 柯南包:https://bintray.com/beta/#/flexferrum/conan-packages/jinja2cpp: flexferrum?tab=overview
- 许可证: MPL-2.0
- 语言:C++14/17
- 最后更新:2019 年 10 月 1 日
- 最后版本:2019 年 10 月 1 日发布 1.0.0
- 文档:中等
- 社区:无
回答by Kristian
回答by Tomas Andrle
NLTemplateis a small C++ template library with syntax similar to Django.
NLTemplate是一个小型的 C++ 模板库,其语法类似于 Django。
- Variable replacement
- Repeatable or optional blocks
- File includes
- MIT licensed
- No external dependencies
- Single source file, easy to add to any project
- 变量替换
- 可重复或可选块
- 文件包括
- 麻省理工学院许可
- 没有外部依赖
- 单一源文件,易于添加到任何项目
Disclaimer: I'm the author.
免责声明:我是作者。
回答by yesraaj
回答by yesraaj
回答by wimh
ClearSilveris available for c. Hereis a list of existing websites which use clearsilver. But I don't use it myself.
ClearSilver可用于 c。以下是使用 clearsilver 的现有网站列表。但我自己不使用它。
回答by kirill_igum
回答by Sergei Sadovnikov
Jinja2C++
Jinja2C++
- Site: https://jinja2cpp.dev
- Project: https://github.com/jinja2cpp
- Conan package: https://bintray.com/beta/#/flexferrum/conan-packages/jinja2cpp:flexferrum?tab=overview
- License: MPL-2.0
- Language: C++14/17
- Last Update: Oct 01, 2019
- Last Release: 1.0.0 on Oct 01, 2019
- Document: Moderate
- 网站:https: //jinja2cpp.dev
- 项目:https: //github.com/jinja2cpp
- 柯南包:https://bintray.com/beta/#/flexferrum/conan-packages/jinja2cpp: flexferrum?tab=overview
- 许可证: MPL-2.0
- 语言:C++14/17
- 最后更新:2019 年 10 月 1 日
- 最后版本:2019 年 10 月 1 日发布 1.0.0
- 文档:中等
Description:
描述:
- C++14/17 library
- Supports mainstream compilers (Visual C++, gcc, clang)
- Easy-to-use interface.
- Conformance to Jinja2 specification http://jinja.pocoo.org/docs/2.10/
- Support for both narrow- and wide-character strings both for templates and - parameters.
- Built-in reflection for C++ types and popular json libraries (nlohmann, RapidJson).
- User-defined callables.
- Powerful full-featured Jinja2 expressions with filtering (via ‘|' operator) and ‘if'-expressions.
- Big set of Jinja2 tags include macros and template extensions.
- Rich error reporting.
- C++14/17 库
- 支持主流编译器(Visual C++、gcc、clang)
- 易于使用的界面。
- 符合 Jinja2 规范http://jinja.pocoo.org/docs/2.10/
- 支持模板和 - 参数的窄字符串和宽字符串。
- C++ 类型和流行的 json 库(nlohmann、RapidJson)的内置反射。
- 用户定义的可调用对象。
- 强大的全功能 Jinja2 表达式,带有过滤(通过“|”运算符)和“if”表达式。
- 大量 Jinja2 标签包括宏和模板扩展。
- 丰富的错误报告。
回答by Mark
回答by OJW
ctemplate
模板
https://code.google.com/p/ctemplate/?redir=1
https://code.google.com/p/ctemplate/?redir=1
New BSD License
新的 BSD 许可证