Class: TestStackingParser

Inherits:
HTML::StackingParser show all
Defined in:
lib/web/htmltools/tree.rb,
lib/web/htmltools/xmltree.rb,
lib/web/htmltools/stparser.rb

Overview

:nodoc: all

Constant Summary

Constants inherited from SGMLParser

SGMLParser::Attrfind, SGMLParser::Charref, SGMLParser::Commentclose, SGMLParser::Commentopen, SGMLParser::Endbracket, SGMLParser::Endtagopen, SGMLParser::Entitydefs, SGMLParser::Entityref, SGMLParser::Incomplete, SGMLParser::Interesting, SGMLParser::Special, SGMLParser::Starttagopen, SGMLParser::Tagfind

Instance Method Summary collapse

Methods inherited from HTML::StackingParser

#feed, #last_tag, #parent_tag, #parse_file_named, #stack, #strip_whitespace=

Methods inherited from SGMLParser

#close, #feed, #finish_endtag, #finish_starttag, #goahead, #handle_charref, #handle_data, #handle_endtag, #handle_entityref, #handle_starttag, #has_context, #initialize, #parse_comment, #parse_endtag, #parse_special, #parse_starttag, #report_unbalanced, #reset, #setliteral, #setnomoretags, #unknown_charref, #unknown_endtag, #unknown_entityref, #unknown_starttag

Instance Method Details

#dump_stackObject



233
234
235
# File 'lib/web/htmltools/stparser.rb', line 233

def dump_stack
  stack.each { |ea| print ea, '/' }
end

#handle_cdata(data) ⇒ Object

print(“EMPTY: #tag #TestStackingParser.attrsattrs.inspectn”)



245
246
247
248
249
250
251
252
253
254
# File 'lib/web/htmltools/stparser.rb', line 245

def handle_cdata(data)
  # print("DATA: #{data.size} chars\n")
  if last_tag() != 'style'
    str = data.strip
    if str.size > 0
      dump_stack
      print(str.inspect, "\n")
    end
  end
end

#handle_comment(data) ⇒ Object



264
265
266
267
# File 'lib/web/htmltools/stparser.rb', line 264

def handle_comment(data)
  super
  print("COMMENT: #{data}\n")
end

#handle_empty_tag(tag, attrs) ⇒ Object

print(“END: #tagn”)



242
243
244
# File 'lib/web/htmltools/stparser.rb', line 242

def handle_empty_tag(tag, attrs)
  # print("EMPTY: #{tag} #{attrs.inspect}\n")
end

#handle_end_tag(tag) ⇒ Object



239
240
241
# File 'lib/web/htmltools/stparser.rb', line 239

def handle_end_tag(tag)
  # print("END: #{tag}\n")
end

#handle_script(data) ⇒ Object



255
256
257
# File 'lib/web/htmltools/stparser.rb', line 255

def handle_script(data)
  # print("SCRIPT: #{data.size} chars\n")
end

#handle_special(data) ⇒ Object



268
269
270
# File 'lib/web/htmltools/stparser.rb', line 268

def handle_special(data)
  print("SPECIAL: #{data}\n")
end

#handle_start_tag(tag, attrs) ⇒ Object



236
237
238
# File 'lib/web/htmltools/stparser.rb', line 236

def handle_start_tag(tag, attrs)
  print("START: #{tag} #{attrs.inspect}\n")
end

#handle_unknown_character(name) ⇒ Object

print(“SCRIPT: #TestStackingParser.datadata.size charsn”)



258
259
260
# File 'lib/web/htmltools/stparser.rb', line 258

def handle_unknown_character(name)
  print("UNKC: #{name}\n")
end

#handle_unknown_entity(name) ⇒ Object



261
262
263
# File 'lib/web/htmltools/stparser.rb', line 261

def handle_unknown_entity(name)
  print("UNKE: #{name}\n")
end