Class: MicroMicro::Parsers::UrlPropertyParser

Inherits:
BasePropertyParser show all
Defined in:
lib/micro_micro/parsers/url_property_parser.rb

Constant Summary collapse

HTML_ATTRIBUTES_MAP =
{
  "href"   => ["a", "area", "link"],
  "src"    => ["audio", "iframe", "img", "source", "video"],
  "poster" => ["video"],
  "data"   => ["object"]
}.freeze
EXTENDED_HTML_ATTRIBUTES_MAP =
{
  "title" => ["abbr"],
  "value" => ["data", "input"]
}.freeze

Instance Method Summary collapse

Methods inherited from BasePropertyParser

#initialize

Constructor Details

This class inherits a constructor from MicroMicro::Parsers::BasePropertyParser

Instance Method Details

#valueString, Hash{Symbol => String}

[View source]

24
25
26
27
28
29
30
31
# File 'lib/micro_micro/parsers/url_property_parser.rb', line 24

def value
  @value ||=
    if node.matches?("img[alt], img[srcset]")
      ImageElementParser.new(node, resolved_value).to_h
    else
      resolved_value
    end
end