You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
C++ implementation of big subset of Jinja2 template engine features. This library was inspired by [Jinja2CppLight](https://github.com/hughperkins/Jinja2CppLight) project and brings support of mostly all Jinja2 templates features into C++ world.
17
+
C++ implementation of Jinja2 Python template engine. This library was originally inspired by [Jinja2CppLight](https://github.com/hughperkins/Jinja2CppLight) project and brings support of mostly all Jinja2 templates features into C++ world.
18
18
19
-
# Introduction
19
+
##Introduction
20
20
21
-
Main features of Jinja2Cpp:
22
-
- Easy-to-use public interface. Just load templates and render them.
23
-
- Conformance to [Jinja2 specification](http://jinja.pocoo.org/docs/2.10/)
24
-
- Partial support for both narrow- and wide-character strings both for templates and parameters.
25
-
- Built-in reflection for C++ types.
26
-
- Powerful full-featured Jinja2 expressions with filtering (via '|' operator) and 'if'-expressions.
27
-
- Control statements (set, for, if).
28
-
- Templates extention.
29
-
- Macros
30
-
- Rich error reporting.
21
+
Main features of Jinja2C++:
22
+
-Easy-to-use public interface. Just load templates and render them.
23
+
-Conformance to [Jinja2 specification](http://jinja.pocoo.org/docs/2.10/)
24
+
-Partial support for both narrow- and wide-character strings both for templates and parameters.
25
+
-Built-in reflection for C++ types.
26
+
-Powerful full-featured Jinja2 expressions with filtering (via '|' operator) and 'if'-expressions.
27
+
-Control statements (set, for, if).
28
+
-Templates extention.
29
+
-Macros
30
+
-Rich error reporting.
31
31
32
32
For instance, this simple code:
33
33
@@ -56,27 +56,27 @@ Hello; world!!!
56
56
hello; world!!!
57
57
```
58
58
59
-
# Getting started
59
+
##Getting started
60
60
61
61
In order to use Jinja2Cpp in your project you have to:
More detailed examples and features describtion can be found in the documentation: https://jinja2cpp.dev/docs/usage
93
+
More detailed examples and features describtion can be found in the documentation: [https://jinja2cpp.dev/docs/usage](https://jinja2cpp.dev/docs/usage)
94
94
95
-
# Current Jinja2 support
95
+
##Current Jinja2 support
96
96
Currently, Jinja2Cpp supports the limited number of Jinja2 features. By the way, Jinja2Cpp is planned to be full [jinja2 specification](http://jinja.pocoo.org/docs/2.10/templates/)-conformant. The current support is limited to:
97
-
- expressions. You can use almost every style of expressions: simple, filtered, conditional, and so on.
98
-
- big number of filters (**sort, default, first, last, length, max, min, reverse, unique, sum, attr, map, reject, rejectattr, select, selectattr, pprint, dictsort, abs, float, int, list, round, random, trim, title, upper, wordcount, replace, truncate, groupby, urlencode**)
99
-
- big number of testers (**eq, defined, ge, gt, iterable, le, lt, mapping, ne, number, sequence, string, undefined, in, even, odd, lower, upper**)
100
-
- limited number of functions (**range**, **loop.cycle**)
101
-
- 'if' statement (with 'elif' and 'else' branches)
102
-
- 'for' statement (with 'else' branch and 'if' part support)
103
-
- 'extends' statement
104
-
- 'set' statement
105
-
- 'extends'/'block' statements
106
-
- 'macro'/'call' statements
107
-
- recursive loops
108
-
- space control
109
-
110
-
# Supported compilers
97
+
-expressions. You can use almost every style of expressions: simple, filtered, conditional, and so on.
@@ -164,7 +164,7 @@ In simpliest case to compile Jinja2Cpp you need:
164
164
165
165
In this case Jinja2Cpp will be built with internally-shipped dependencies and install them respectively. But Jinja2Cpp supports build with externally-provided deps. Different Jinja2Cpp usage scenarios can be found in this repository: https://github.com/jinja2cpp/examples-build
166
166
167
-
## Usage with conan.io dependency manager
167
+
###Usage with conan.io dependency manager
168
168
Jinja2Cpp can be used as conan.io package. In this case you should do the following steps:
169
169
170
170
1. Install conan.io according to the documentation ( https://docs.conan.io/en/latest/installation.html )
***JINJA2CPP_BUILD_SHARED** (default OFF) - Specify Jinja2Cpp library library link type.
214
-
***MSVC_RUNTIME_TYPE** (default /MD) - MSVC runtime type to link with (if you use Microsoft Visual Studio compiler).
215
-
***JINJA2CPP_DEPS_MODE** (default "internal") - modes for dependencies handling. Following values possible:
216
-
*`internal` In this mode Jinja2Cpp build script uses dependencies (include `boost`) shipped as subprojects. Nothing needs to be provided externally.
217
-
*`external-boost` In this mode Jinja2Cpp build script uses only `boost` as externally-provided dependency. All other dependencies taken from subprojects.
218
-
*`external` In this mode all dependencies should be provided externally. Paths to `boost`, `nonstd-*` libs etc. should be specified via standard CMake variables (like `CMAKE_PREFIX_PATH` or libname_DIR)
219
-
*`conan-build` Special mode for building Jinja2Cpp via conan recipe.
211
+
-**JINJA2CPP_BUILD_TESTS** (default TRUE) - to build or not to Jinja2Cpp tests.
-**JINJA2CPP_BUILD_SHARED** (default OFF) - Specify Jinja2Cpp library library link type.
214
+
-**MSVC_RUNTIME_TYPE** (default /MD) - MSVC runtime type to link with (if you use Microsoft Visual Studio compiler).
215
+
-**JINJA2CPP_DEPS_MODE** (default "internal") - modes for dependencies handling. Following values possible:
216
+
-`internal` In this mode Jinja2Cpp build script uses dependencies (include `boost`) shipped as subprojects. Nothing needs to be provided externally.
217
+
-`external-boost` In this mode Jinja2Cpp build script uses only `boost` as externally-provided dependency. All other dependencies taken from subprojects.
218
+
-`external` In this mode all dependencies should be provided externally. Paths to `boost`, `nonstd-*` libs etc. should be specified via standard CMake variables (like `CMAKE_PREFIX_PATH` or libname_DIR)
219
+
-`conan-build` Special mode for building Jinja2Cpp via conan recipe.
220
220
221
221
222
-
## Build with C++17 standard enabled
222
+
###Build with C++17 standard enabled
223
223
In case of C++17 standard enabled for your project you should define `variant_CONFIG_SELECT_VARIANT=variant_VARIANT_NONSTD` macro in the build settings.
224
224
225
-
# Acknowledgments
225
+
##Acknowledgments
226
226
Thanks to @manu343726 for CMake scripts improvement, bugs hunting and fixing and conan.io packaging.
227
227
228
228
Thanks to @martinmoene for perfectly implemented xxx-lite libraries.
229
229
230
-
# Changelog
231
-
## Version 0.9.1
232
-
*`applymacro` filter added which allows to apply arbitrary macro as a filter
233
-
* dependencies to boost removed from the public interface
234
-
* CMake scripts improved
235
-
* Various bugs fixed
236
-
* Improve reflection
237
-
* Warnings cleanup
238
-
239
-
## Version 0.9
240
-
* Support of 'extents'/'block' statements
241
-
* Support of 'macro'/'call' statements
242
-
* Rich error reporting
243
-
* Support for recursive loops
244
-
* Support for space control before and after control blocks
245
-
* Improve reflection
246
-
247
-
## Version 0.6
248
-
*A lot of filters has been implemented. Full set of supported filters listed here: https://github.com/flexferrum/Jinja2Cpp/issues/7
249
-
*A lot of testers has been implemented. Full set of supported testers listed here: https://github.com/flexferrum/Jinja2Cpp/issues/8
250
-
* 'Contatenate as string' operator ('~') has been implemented
251
-
* For-loop with 'if' condition has been implemented
252
-
* Fixed some bugs in parser
230
+
##Changelog
231
+
###Version 0.9.1
232
+
-`applymacro` filter added which allows to apply arbitrary macro as a filter
233
+
- dependencies to boost removed from the public interface
234
+
- CMake scripts improved
235
+
- Various bugs fixed
236
+
- Improve reflection
237
+
- Warnings cleanup
238
+
239
+
###Version 0.9
240
+
- Support of 'extents'/'block' statements
241
+
- Support of 'macro'/'call' statements
242
+
- Rich error reporting
243
+
- Support for recursive loops
244
+
- Support for space control before and after control blocks
245
+
- Improve reflection
246
+
247
+
###Version 0.6
248
+
-A lot of filters has been implemented. Full set of supported filters listed here: [https://github.com/flexferrum/Jinja2Cpp/issues/7](https://github.com/flexferrum/Jinja2Cpp/issues/7)
249
+
-A lot of testers has been implemented. Full set of supported testers listed here: [https://github.com/flexferrum/Jinja2Cpp/issues/8](https://github.com/flexferrum/Jinja2Cpp/issues/8)
250
+
- 'Contatenate as string' operator ('~') has been implemented
251
+
- For-loop with 'if' condition has been implemented
0 commit comments