class Minidown::BlockElement

Constants

BlockTagRegexp

Public Instance Methods

parse() click to toggle source
# File lib/minidown/elements/block_element.rb, line 5
def parse
  unparsed_lines.unshift content
  nodes << self
  while(child_line = unparsed_lines.shift) do
    block = child_line.sub! BlockTagRegexp, ''
    doc.parse_line(child_line)
    child = nodes.pop
    case child
    when LineElement
      unparsed_lines.unshift child_line
      unparsed_lines.unshift nil
    when ParagraphElement
      child.extra = !!block
      nodes << child
    else
      break if child.nil?
      nodes << child 
    end
  end
  children_range = (nodes.index(self) + 1)..-1
  self.children = nodes[children_range]
  nodes[children_range] = []
end
to_html() click to toggle source
# File lib/minidown/elements/block_element.rb, line 29
def to_html
  build_tag 'blockquote'.freeze do |content|
    children.each do |child|
      content << child.to_html
    end
  end
end