Sha256: 5c07358ec45c71b913e604996d3277c120b024d8d7cf2de447d587f79f8a2cef
Contents?: true
Size: 1.47 KB
Versions: 19
Compression:
Stored size: 1.47 KB
Contents
module Watir module Generator class SVG::SpecExtractor < Base::SpecExtractor private def extract_interface_map list = @doc.search("//div[@id='chapter-eltindex']//ul/li") list.any? or raise 'could not find elements list' @interface_map = parse_list(list) end def build_result {}.tap do |result| @interface_map.each do |tag, interface| result[tag] = fetch_interface(interface) end end end def parse_list(list) {}.tap do |result| list.each do |node| tag_name = node.css('a span').inner_text.strip id = node.css('a').attr('href').to_s next if external_interface?(id) interface_css = 'div.element-summary a.idlinterface' interface_definitions = @doc.css("#{id} #{interface_css}, #{id} ~ #{interface_css}") # TSpan is defined along with Text so the first IDL definition is SVGTextElement idx = tag_name == 'tspan' ? 1 : 0 result[tag_name] = interface_definitions[idx].inner_text.strip end end end def issued_interfaces %w(SVGHatchElement SVGHatchPathElement SVGSolidColorElement) end # Some interfaces are actually defined in different specs # (for example, clipPath), so we ignore them for now. def external_interface?(id) id !~ /^#.+/ end end # SVG::SpecExtractor end # Generator end # Watir
Version data entries
19 entries across 19 versions & 1 rubygems