def insert(line)
@logger.debug "Looking at #{line.paragraph_type}|#{line.assigned_paragraph_type}(#{current_mode}) : #{line.to_s}"
@block_lang = line.block_lang if line.begin_block?
unless should_accumulate_output?(line)
flush!
maintain_mode_stack(line)
end
case
when line.assigned_paragraph_type == :comment
when line.title?
@buffer << line.output_text
when line.raw_text?
@buffer << "\n" << line.output_text if line.raw_text_tag == @buffer_tag
when preserve_whitespace?
@buffer << "\n" << line.output_text unless line.block_type
when line.assigned_paragraph_type == :code
when (line.kind_of? Headline)
add_line_attributes line
@buffer << "\n" << line.output_text.strip
when ([:definition_term, :list_item, :table_row, :table_header,
:horizontal_rule].include? line.paragraph_type)
@buffer << "\n" << line.output_text.strip
when line.paragraph_type == :paragraph
@buffer << "\n"
buffer_indentation
@buffer << line.output_text.strip
end
if mode_is_code? current_mode and not line.block_type
if line.paragraph_type != :blank
if @code_block_indent
@code_block_indent = [@code_block_indent, line.indent].min
else
@code_block_indent = line.indent
end
end
end
@output_type = line.assigned_paragraph_type || line.paragraph_type
end