Skip to content

Commit 06f201a

Browse files
committed
update single include
1 parent 6bfec7e commit 06f201a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

single_include/inja/inja.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2127,7 +2127,11 @@ class Renderer : public NodeVisitor {
21272127
if (value->is_string()) {
21282128
std::string val;
21292129
if (config.escape_strings) {
2130+
// get the value as a dump() to properly escape values
21302131
val = value->dump();
2132+
2133+
// strip the leading and trailing " characters that are added by dump()
2134+
// if C++20 is adopted, val.starts_with and val.ends_with would clean this up a bit
21312135
val = val.substr(0,1) == "\"" && val.substr(val.length()-1,1) == "\""
21322136
? val.substr(1, val.length()-2)
21332137
: val;

0 commit comments

Comments
 (0)