* add function to get position of current token
* new exception parser_error with error location
* parser throws parser_error with error location
* update single include
* get error position in text
* bump to 2.3
* subclass exceptions
* update single include from every directory
* center badges in readme
* github ci windows, mac
* use default compiler
* check ci
* fix ci
* test ci
* fix ci
* fix ci
* test ci
* badges to github action
* add check for single include
* fix check
* check (should fail)
* fix all ci
* add artifact in single include ci
* update to newest nlohmann/json
* move unit tests to doctest
* move to json v3.6.1
* add function to get position of current token
* new exception parser_error with error location
* parser throws parser_error with error location
* update single include
* get error position in text
* bump to 2.3
* subclass exceptions
Co-authored-by: pantor <lars.berscheid@online.de>
* resync single_include
* Undo PIMPL pattern in Environment
* Environment now supports copy construction and assignment
* Add test for copying Environment
Closes#126
* 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
* 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
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.
* 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
* Add exists() function that checks existence of key
Adds an exists() function that checks whether a given key exists in the
data. If only one argument is provided to exists(), the global data is
queried for the item. If two arguments are given, the first argument
specifies the object to query for the key given as second argument.
Also adds corresponding unit tests and updates README for
documentation.
* Split exists() into exists() and existsIn()
Splits the exists() function, which previously took both one or two
arguments, into an exists() function accepting one and an existsIn()
function accepting two arguments.