270 Commits

Author SHA1 Message Date
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
Mark Hollomon da5bbb1482 Remove unneed linking in update_loop_data (#85)
Commit a5862a0 made the linking step in update_loop_data unecessary
because the loop's copy of the data was made to come from the parent
loop's data rather than the original client's data.

While at it, also add one more nested loop test case.
2019-01-27 19:35:27 +01:00
Mark Hollomon a5862a04dc Fix for issue #82 - Nested loops (#84)
* Fix for issue #82 - Nested loops

I made the following changes in renderer.hpp
- Removed the member LoopLevel::it - it was not being used and was
causing issues.
- Added LoopLevel::loop_type with a matching enum class to mark the loop
as looping on either a Map or an Array. This was to replace the hard to
understand test for key_name.empty().
- Modified update_loop_data to get the correct data for map type loops
when copying in outer loop control data.
- Modified update_loop_data to only copy in the outer loop data during
StartLoop, it does not need to be done at EndLoop and can be expensive
since it can copy a large part of the json tree.

All the tests pass and the test cases from the issue also now work. Both
GCC and Clang will compile and run the tests with no issue. No issue is
seen with address_sanitizer in either compiler.

* Remove forgotten debugging code.
2019-01-27 10:15:40 +01:00
Guillaume Racicot 11d07f5eff Added install target and cmake package exports (#83) 2019-01-26 21:15:25 +01:00
Mark Hollomon 1dfd86fa6f Fix for issue #80 (#81)
* Fix for issue #80

When updating the `opening_chars`, line_statment was forgotten. So, a
change to any of the openers would cause line statements to start being
unrecognized.

I added a unit test to cover this case.

* fix indentation

* add update to single_include
2019-01-23 19:18:47 +01:00
Lars Berscheid 2c98adbcf7 remove appveyor test 2019-01-22 11:04:00 +01:00
pantor e63411568c fix appveyor build 2019-01-21 21:48:11 +01:00
pantor 5553ee7526 add older compilers 2019-01-21 21:42:52 +01:00
pantor dbcd5265fc add string_view polyfill 2019-01-21 21:34:34 +01:00
pantor 5d99c2b703 ignore most warnings in appveyor 2019-01-21 19:01:23 +01:00
pantor 41857c2c83 add line break 2019-01-20 09:51:53 +01:00
pantor 87ab78acf0 add link to documentation 2019-01-20 09:49:52 +01:00
pantor 3221fbef7e fix directory doxygen 2019-01-19 18:32:23 +01:00
pantor 75582236d8 finalize2 travis.yml 2019-01-19 17:56:26 +01:00
pantor fdf1c126a9 finalize travis.yml 2019-01-19 17:51:35 +01:00