Jinja2Cpp icon indicating copy to clipboard operation
Jinja2Cpp copied to clipboard

Render error when single quotation mark meets right curvly bracket

Open starrynight opened this issue 1 year ago • 1 comments

A single example like this will cause a render error ( tested on Release 1.3.1)

void minimum_example() {
    
    jinja2::Template tpl;
    
    tpl.Load("{{ 'Hello World!' + '\n'}}");
    
    std::cout << tpl.RenderAsString({}).value() << std::endl;
    
}

I found the issue could be avoided if a space is inserted:

tpl.Load("{{ 'Hello World!' + '\n' }}");

But considering template file is usually not so space sensitive and accurate, I wonder if this is something that can be fixed?

starrynight avatar Mar 12 '24 04:03 starrynight

A possible workaround is to replace ' with \".

Wovchena avatar May 31 '24 16:05 Wovchena