diff --git a/include/crow/mustache.h b/include/crow/mustache.h index e858a7e8c..d14dccddf 100644 --- a/include/crow/mustache.h +++ b/include/crow/mustache.h @@ -222,26 +222,18 @@ namespace crow out += ctx.s; break; case json::type::Function: + std::string execute_result = ctx.execute(); + while (execute_result.find("{{") != std::string::npos) + { + template_t result_plug(execute_result); + execute_result = result_plug.render(*(stack[0])); + } + if (action.t == ActionType::Tag) - { - std::string execute_result = ctx.execute(); - while (execute_result.find("{{") != std::string::npos) - { - template_t result_plug(execute_result); - execute_result = result_plug.render(*(stack[0])); - } escape(execute_result, out); - } else - { - std::string execute_result = ctx.execute(); - while (execute_result.find("{{") != std::string::npos) - { - template_t result_plug(execute_result); - execute_result = result_plug.render(*(stack[0])); - } out += execute_result; - } + break; default: throw std::runtime_error("not implemented tag type" + boost::lexical_cast(static_cast(ctx.t())));