Skip to content

Commit

Permalink
update single include
Browse files Browse the repository at this point in the history
  • Loading branch information
jbohanon committed Jul 20, 2023
1 parent 6bfec7e commit 06f201a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions single_include/inja/inja.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2127,7 +2127,11 @@ class Renderer : public NodeVisitor {
if (value->is_string()) {
std::string val;
if (config.escape_strings) {
// get the value as a dump() to properly escape values
val = value->dump();

// strip the leading and trailing " characters that are added by dump()
// if C++20 is adopted, val.starts_with and val.ends_with would clean this up a bit
val = val.substr(0,1) == "\"" && val.substr(val.length()-1,1) == "\""
? val.substr(1, val.length()-2)
: val;
Expand Down

0 comments on commit 06f201a

Please sign in to comment.