optimize
This commit is contained in:
parent
61a700479d
commit
244477f0a0
20 changed files with 140 additions and 231 deletions
|
@ -1,7 +1,7 @@
|
|||
#include "visitor/is_node_empty.hpp"
|
||||
#include "visitor/render_section.hpp"
|
||||
#include "in_section.hpp"
|
||||
#include "outside_section.hpp"
|
||||
#include "visitor/is_node_empty.hpp"
|
||||
#include "visitor/render_section.hpp"
|
||||
|
||||
using namespace mstch;
|
||||
|
||||
|
@ -10,15 +10,12 @@ state::in_section::in_section(const std::string& section_name):
|
|||
{
|
||||
}
|
||||
|
||||
std::string state::in_section::render(
|
||||
render_context& ctx,
|
||||
const token& token)
|
||||
{
|
||||
switch(token.type()) {
|
||||
case token_type::section_close:
|
||||
std::string state::in_section::render(render_context& ctx, const token& token) {
|
||||
switch(token.token_type()) {
|
||||
case token::type::section_close:
|
||||
if(token.content() == section_name && skipped_openings == 0) {
|
||||
auto section_node = ctx.get_node(section_name);
|
||||
std::string out("");
|
||||
std::string out;
|
||||
if (!boost::apply_visitor(visitor::is_node_empty(), section_node))
|
||||
out = boost::apply_visitor(
|
||||
visitor::render_section(ctx, section_text.str()),
|
||||
|
@ -30,14 +27,14 @@ std::string state::in_section::render(
|
|||
section_text << token.raw();
|
||||
}
|
||||
break;
|
||||
case token_type::inverted_section_open:
|
||||
case token_type::section_open:
|
||||
case token::type::inverted_section_open:
|
||||
case token::type::section_open:
|
||||
skipped_openings++;
|
||||
case token_type::text:
|
||||
case token_type::variable:
|
||||
case token_type::unescaped_variable:
|
||||
case token_type::comment:
|
||||
case token_type::partial:
|
||||
case token::type::text:
|
||||
case token::type::variable:
|
||||
case token::type::unescaped_variable:
|
||||
case token::type::comment:
|
||||
case token::type::partial:
|
||||
section_text << token.raw();
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue