module Kramdown::Parser::Html::Parser
def parse_raw_html(el, &block)
When an HTML start tag is found, processing is deferred to #handle_html_start_tag,
element).
- The matching end tag for the element +el+ is found (only used if +el+ is an HTML
- The end of the document is reached.
Parsing continues until one of the following criteria are fulfilled:
Parse raw HTML from the current source position, storing the found elements in +el+.
def parse_raw_html(el, &block) @stack.push(@tree) @tree = el done = false while !@src.eos? && !done if result = @src.scan_until(HTML_RAW_START) add_text(result, @tree, :text) if result = @src.scan(HTML_COMMENT_RE) @tree.children << Element.new(:xml_comment, result, nil, :category => :block) elsif result = @src.scan(HTML_INSTRUCTION_RE) @tree.children << Element.new(:xml_pi, result, nil, :category => :block) elsif @src.scan(HTML_TAG_RE) handle_html_start_tag(&block) elsif @src.scan(HTML_TAG_CLOSE_RE) if @tree.value == @src[1].downcase done = true else warning("Found invalidly used HTML closing tag for '#{@src[1].downcase}' - ignoring it") end else add_text(@src.getch, @tree, :text) end else add_text(@src.rest, @tree, :text) @src.terminate warning("Found no end tag for '#{@tree.value}' - auto-closing it") if @tree.type == :html_element done = true end end @tree = @stack.pop end