Commit Graph

284 Commits

Author SHA1 Message Date
pantor
773005b0f6 add check for single include 2020-03-18 11:58:07 +01:00
pantor
3f624db81a badges to github action 2020-03-18 11:49:02 +01:00
pantor
92afd50ace test ci 2020-03-18 09:57:45 +01:00
pantor
18b2e538b6 fix ci 2020-03-18 09:51:32 +01:00
pantor
9f6a57439d fix ci 2020-03-18 09:44:09 +01:00
pantor
0386008078 test ci 2020-03-18 09:40:44 +01:00
pantor
b89cbd9847 fix ci 2020-03-18 09:24:09 +01:00
pantor
54f9ccb196 check ci 2020-03-18 09:20:05 +01:00
pantor
46b1e81952 use default compiler 2020-03-18 09:09:27 +01:00
pantor
23b5eddac8 github ci windows, mac 2020-03-18 09:03:28 +01:00
pantor
225a468032 center badges in readme 2020-03-18 08:47:51 +01:00
pantor
f41feb69d2 update single include from every directory 2020-03-18 08:43:55 +01:00
Chuan Ji
cb0b852e23 Add CMake flag to control Inja's unit tests. (#135)
Currently Inja's CMake config will build unit tests as long as `BUILD_TESTING` is enabled. As a result, when including Inja in another CMake project, it is not possible to build the latter's unit tests without also enabling Inja's own unit tests.

It's common for libraries to include a separate option for controlling its own unit test targets, in addition to observing the global `BUILD_TESTING` option. For instance, nlohmann/json has a `JSON_BuildTests` option: 973c52dd4a/CMakeLists.txt (L18)

Also see https://cliutils.gitlab.io/modern-cmake/chapters/testing.html .

This commit adds a `INJA_BUILD_TESTS` flag to address this.
2020-03-14 18:55:51 +01:00
Christof Krüger
3f071a2aac Fix warnings (VS2017 x64). (#133)
* Fix warnings (VS2017 x64).

* Update single_include/inja.hpp.
2020-01-27 22:52:43 +01:00
pantor
652e378dd9 Merge branch 'master' of https://github.com/pantor/inja v2.2.0 2019-12-27 11:37:01 +01:00
pantor
aad2cc4358 to v2.2 2019-12-27 11:36:57 +01:00
Krzysztof Bieleń
c36cbac39d Fix Visual Studio Debug builds (#125) 2019-12-03 22:23:00 +01:00
Krzysztof Bieleń
d62453d81b Fix VS2015 build (#128) 2019-12-01 13:54:25 +01:00
Tom
8e6a8428fa Undo PIMPL pattern in Environment (#127)
* resync single_include

* Undo PIMPL pattern in Environment

* Environment now supports copy construction and assignment
* Add test for copying Environment

Closes #126
2019-11-22 11:12:28 +01:00
Krzysztof Bieleń
1d419d1940 Add more build configurations to appveyor (#123) 2019-11-13 18:12:35 +01:00
Krzysztof Bieleń
77062f52c7 Fix Travis build (Debug -> Release) (#124) 2019-11-13 18:06:37 +01:00
Tom
1b2212cc69 Fix error in example for included templates (#122)
When using templates from an environment, `inja::env::render`
must be used.

Closes #121
2019-11-09 20:41:32 +08:00
Dodzey
e7d5c5332d Static cast to avoid VS140 C4244 warning (#119) 2019-10-27 18:42:53 +01:00
pantor
258def7bf0 little bit more code style 2019-09-14 12:28:55 +02:00
pantor
fe2ef9ce4e fix tab/spaces 2019-09-14 12:11:53 +02:00
pantor
a6a61586a4 code style (cpplint) 2019-09-14 12:05:51 +02:00
Tom
057075b110 retain scope when including a template (#118)
* apply documentation changes to single_include

* retain scope when including a template

* Use data from current scope when rendering an included template.
  This allows included templates to access loop variables, which
  was not possible before.
* Add test
2019-09-14 11:35:06 +02:00
pantor
b46d92a793 remove coverage 2019-09-10 15:38:47 +02:00
pantor
466caeab63 improve documentation 2019-09-08 17:06:09 +02:00
pantor
d25937a85b add test and readme 2019-09-08 16:19:50 +02:00
JP Cimalando
66196fdd6b Add whitespace control options: trim_blocks, lstrip_blocks (#116) 2019-09-08 16:03:31 +02:00
pantor
ba2aa0477c Update ci.yml 2019-09-08 15:55:06 +02:00
pantor
3705e3e23a Create ci.yml 2019-09-08 15:50:38 +02:00
pantor
04b5fa4979 Merge branch 'master' of https://github.com/pantor/inja 2019-09-08 15:37:32 +02:00
pantor
68ae0cc261 remove doxygen from travis 2019-09-08 15:37:27 +02:00
pantor
f06d844995 Update documentation.yml 2019-09-08 15:31:03 +02:00
pantor
5b450aa89f Update and rename main.yml to documentation.yml 2019-09-08 15:23:39 +02:00
pantor
3b083a8297 Use Github Actions for Doxygen 2019-09-08 15:20:15 +02:00
Tom
419c93c840 Throw exception if a file cannot be opened, fix travis-ci builds (#117)
* throw exception if a file cannot be opened

* Add a new function in utils.hpp: open_file_or_throw: This function
  returns an opened std::ifstream or throws by calling `inja_throw`.
* Use this function in Parser::load_file which previously returned an
  empty string if the file couldn't be opened.
* Use this function in Environment::load_json which previously threw
  a `nlohmann::detail::parse_error` if the file couldn't be opened.
* In Parser::parse_statement: When including files through `include`,
  do not attempt to (re-)parse templates from files that were already
  included. Additionally, this prevents inja from attempting to load
  in-memory templates by their name from disk.
* Add tests that check if an exception is thrown when attempting to
  open files that do not exist.

* cmake: enable C++11

* cmake: require C++11 when depending on single_inja

* code style
2019-09-08 15:05:01 +02:00
pantor
57ac9b9372 update readme 2019-07-28 14:23:50 +02:00
JD
dfc87ef7a4 update the version of nlohmann/json in requirements.txt (#107)
* update the version of json in requirements.txt

* removed C++ 17 requirement
2019-05-31 19:01:50 +02:00
pantor
cd70a4a079 Create FUNDING.yml 2019-05-25 19:31:53 -04:00
pantor
d5532ac26a add at function 2019-04-07 16:15:12 +02:00
pantor
bf071019b9 if target nlohmann_json already exists in cmake, use that library 2019-04-07 13:59:23 +02:00
pantor
85cc5ecc35 change default path to empty string 2019-04-07 13:45:27 +02:00
pantor
67699c2549 fix wrong render_file in readme 2019-04-07 13:32:59 +02:00
pantor
6698e98ea3 calculate length of strings with length function 2019-04-07 13:27:43 +02:00
Oleh
3afc7f30cd Fixed VS2015 error C2678: string_view to std::string comparison (#97)
* Fixed VS2015 error C2678: string_view to std::string comparison

* applied amalgamate.py to produce single header
2019-03-30 10:54:56 +01:00
Paul Fultz II
4c0ee3a46c Improve support for installing with cget (#88)
* Improve support for installing with cget

* add specific version, clean cmake

* fix version to "v2.1.0"
v2.1.0
2019-02-16 12:39:59 +01:00
Mark Hollomon
89652ca321 Add meson target to update single include (#86)
- You can now update the single include file in a meson build by using
the target 'amalg'.
- The meson build also now builds the single include test suite.
- cmake build updated to use the new script to update the single
include.
2019-01-28 19:29:21 +01:00