1 #include "in_section.hpp"
2 #include "outside_section.hpp"
3 #include "visitor/is_node_empty.hpp"
4 #include "visitor/render_section.hpp"
8 in_section::in_section(type type, const token& start_token):
9 m_type(type), m_start_token(start_token), m_skipped_openings(0)
13 std::string in_section::render(render_context& ctx, const token& token) {
14 if (token.token_type() == token::type::section_close)
15 if (token.name() == m_start_token.name() && m_skipped_openings == 0) {
16 auto& node = ctx.get_node(m_start_token.name());
19 if (m_type == type::normal && !visit(is_node_empty(), node))
20 out = visit(render_section(ctx, m_section, m_start_token.delims()), node);
21 else if (m_type == type::inverted && visit(is_node_empty(), node))
22 out = render_context::push(ctx).render(m_section);
24 ctx.set_state<outside_section>();
28 else if (token.token_type() == token::type::inverted_section_open ||
29 token.token_type() == token::type::section_open)