1 #include "outside_section.hpp"
3 #include "visitor/render_node.hpp"
4 #include "in_section.hpp"
5 #include "render_context.hpp"
9 std::string outside_section::render(
10 render_context& ctx, const token& token)
12 using flag = render_node::flag;
13 switch (token.token_type()) {
14 case token::type::section_open:
15 ctx.set_state<in_section>(in_section::type::normal, token);
17 case token::type::inverted_section_open:
18 ctx.set_state<in_section>(in_section::type::inverted, token);
20 case token::type::variable:
21 return visit(render_node(ctx, flag::escape_html), ctx.get_node(token.name()));
22 case token::type::unescaped_variable:
23 return visit(render_node(ctx, flag::none), ctx.get_node(token.name()));
24 case token::type::text:
26 case token::type::partial:
27 return ctx.render_partial(token.name(), token.partial_prefix());