This commit is contained in:
Daniel Sipka 2015-04-10 12:56:08 +02:00
parent 3b4580186c
commit e31207b9cf
17 changed files with 160 additions and 93 deletions

View file

@ -6,26 +6,30 @@
using namespace mstch;
std::string state::outside_section::render(render_context& context, const token& token) {
std::string state::outside_section::render(
render_context& ctx,
const token& token)
{
switch(token.type()) {
case token_type::section_open:
context.set_state<in_section>(token.content());
break;
case token_type::inverted_section_open:
context.set_state<in_inverted_section>(token.content());
break;
case token_type::variable:
case token_type::unescaped_variable:
return boost::apply_visitor(visitor::render_node(token.type() == token_type::variable),
context.get_node(token.content()));
case token_type::comment: break;
case token_type::text:
return token.raw();
case token_type::partial:
break;//render_context(mstch::object{{".", i}}, context).render(section);
case token_type::section_close:
// TODO ERROR
break;
case token_type::section_open:
ctx.set_state<in_section>(token.content());
break;
case token_type::inverted_section_open:
ctx.set_state<in_inverted_section>(token.content());
break;
case token_type::variable:
case token_type::unescaped_variable:
return boost::apply_visitor(
visitor::render_node(token.type() == token_type::variable),
ctx.get_node(token.content()));
case token_type::comment: break;
case token_type::text:
return token.raw();
case token_type::partial:
break;//render_context(mstch::object{{".", i}}, ctx).render(section);
case token_type::section_close:
// TODO ERROR
break;
}
return "";
}