Sha256: cbc0b83ab6b43123d20eb7b105b1847d166f6c65d7258378d2f0273cc89eeebb

Contents?: true

Size: 697 Bytes

Versions: 1

Compression:

Stored size: 697 Bytes

Contents

module MicroMicro
  module Parsers
    class EmbeddedMarkupPropertyParser < BasePropertyParser
      HTML_ATTRIBUTE_NAMES = %w[action cite code codebase data href poster src].freeze

      def value
        @value ||= begin
          {
            html: resolved_node.inner_html.strip,
            value: super
          }
        end
      end

      private

      def resolved_node
        @resolved_node ||= begin
          HTML_ATTRIBUTE_NAMES.each do |attribute|
            node.css("[#{attribute}]").each { |element| element[attribute] = Absolutely.to_abs(base: node.document.url, relative: element[attribute].strip) }
          end

          node
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
micromicro-0.1.0 lib/micro_micro/parsers/embedded_markup_property_parser.rb