module Kramdown::Parser::Html::Parser

def handle_html_script_tag

def handle_html_script_tag
  curpos = @src.pos
  if result = @src.scan_until(/(?=<\/script\s*>)/m)
    add_text(extract_string(curpos...@src.pos, @src), @tree.children.last, :raw)
    @src.scan(HTML_TAG_CLOSE_RE)
  else
    add_text(@src.scan(/.*/m), @tree.children.last, :raw)
    warning("Found no end tag for 'script' - auto-closing it")
  end
end

def handle_html_start_tag

steps and then yields to the caller for further processing.
Process the HTML start tag that has already be scanned/checked. Does the common processing
def handle_html_start_tag
  name = @src[1]
  closed = !@src[4].nil?
  attrs = Utils::OrderedHash.new
  @src[2].scan(HTML_ATTRIBUTE_RE).each {|attr,sep,val| attrs[attr] = val}
  el = Element.new(:html_element, name, attrs, :category => :block)
  @tree.children << el
  if !closed && HTML_ELEMENTS_WITHOUT_BODY.include?(el.value)
    warning("The HTML tag '#{el.value}' cannot have any content - auto-closing it")
    closed = true
  end
  if name == 'script'
    handle_html_script_tag
    yield(el, true)
  else
    yield(el, closed)
  end
end

def parse_raw_html(el, &block)

providing the block given to this method.
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]
          done = true
        else
          warning("Found invalidly used HTML closing tag for '#{@src[1]}' - ignoring it")
        end
      else
        add_text(@src.scan(/./), @tree, :text)
      end
    else
      result = @src.scan(/.*/m)
      add_text(result, @tree, :text)
      warning("Found no end tag for '#{@tree.value}' - auto-closing it") if @tree.type == :html_element
      done = true
    end
  end
  @tree = @stack.pop
end