Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Render true and false tags in mustache templates #587

Closed
queenstdev opened this issue Jan 24, 2023 · 2 comments · Fixed by #588
Closed

Render true and false tags in mustache templates #587

queenstdev opened this issue Jan 24, 2023 · 2 comments · Fixed by #588

Comments

@queenstdev
Copy link
Contributor

Render a template with a boolean value e.g.:

auto t = crow::mustache::compile(R"---({{true_value}} and {{false_value}})---");
crow::mustache::context ctx;
ctx["true_value"] = true;
ctx["false_value"] = false;
auto result = t.render_string(ctx);
CHECK("true and false" == result);

results in a std::runtime_error "not implemented tag type..."

The expected boolean rendering can be seen in the Mustache demo page

@mrozigor
Copy link
Member

On the demo page booleans are used with conditional (?) {{#TAG}} tag, not with displaying one {{TAG}}.

@queenstdev
Copy link
Contributor Author

@mrozigor, you are correct. The default template doesn't have a {{tag}} that is a boolean value.
What I meant to say was that if you use the demo page to render a boolean tag e.g. {{empty}}, it will render false.

mrozigor pushed a commit to queenstdev/Crow that referenced this issue Feb 3, 2023
mrozigor added a commit that referenced this issue Feb 3, 2023
fix #587 Render true and false Mustache tags
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants