mirror of
https://github.com/CrowCpp/Crow.git
synced 2024-06-07 21:10:44 +00:00
took repeated code out of the if else statement
This commit is contained in:
parent
5c806252f0
commit
cca1d54ce5
@ -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<std::string>(static_cast<int>(ctx.t())));
|
||||
|
Loading…
Reference in New Issue
Block a user