class RDoc::Markup::ToTtOnly

def accept_block_quote block_quote

def accept_block_quote block_quote
  tt_sections block_quote.text
end

def accept_list_end list

def accept_list_end list
  @list_type.pop
end

def accept_list_item_start list_item

def accept_list_item_start list_item
  case @list_type.last
  when :NOTE, :LABEL then
    Array(list_item.label).map do |label|
      tt_sections label
    end.flatten
  end
end

def accept_list_start list

def accept_list_start list
  @list_type << list.type
end

def accept_paragraph paragraph

def accept_paragraph paragraph
  tt_sections(paragraph.text)
end

def do_nothing markup_item

def do_nothing markup_item
end

def end_accepting

def end_accepting
  @res.compact
end

def initialize markup = nil

def initialize markup = nil
  super nil, markup
  add_tag :TT, nil, nil
end

def start_accepting

def start_accepting
  @res = []
  @list_type = []
end

def tt_sections text

def tt_sections text
  flow = @am.flow text.dup
  flow.each do |item|
    case item
    when String then
      @res << item if in_tt?
    when RDoc::Markup::AttrChanger then
      off_tags res, item
      on_tags res, item
    when RDoc::Markup::RegexpHandling then
      @res << convert_regexp_handling(item) if in_tt? # TODO can this happen?
    else
      raise "Unknown flow element: #{item.inspect}"
    end
  end
  res
end