lib/micro_micro/helpers.rb in micromicro-2.0.1 vs lib/micro_micro/helpers.rb in micromicro-3.0.0

- old
+ new

@@ -2,10 +2,12 @@ module MicroMicro module Helpers IGNORED_NODE_NAMES = %w[script style template].freeze + private_constant :IGNORED_NODE_NAMES + # @param node [Nokogiri::XML::Element] # @param attributes_map [Hash{String => Array}] # @return [String, nil] def self.attribute_value_from(node, attributes_map) attributes_map.filter_map do |attribute, names| @@ -54,11 +56,13 @@ def self.root_class_names_from(node) node.classes.grep(/^h(?:-[0-9a-z]+)?(?:-[a-z]+)+$/).uniq.sort end # @see https://microformats.org/wiki/microformats2-parsing#parse_an_element_for_properties + # microformats.org: microformats2 parsing specification § Parse an element for properties # @see https://microformats.org/wiki/microformats2-parsing#parsing_for_implied_properties + # microformats.org: microformats2 parsing specification § Parsing for implied properties # # @param context [Nokogiri::HTML::Document, Nokogiri::XML::NodeSet, Nokogiri::XML::Element] # @yield [context] # @return [String] def self.text_content_from(context) @@ -68,17 +72,19 @@ context.text.strip end # @see https://microformats.org/wiki/value-class-pattern#Basic_Parsing + # microformats.org: Value Class Pattern § Basic Parsing # # @param node [Nokogiri::XML::Element] # @return [Boolean] def self.value_class_node?(node) node.classes.include?('value') end # @see https://microformats.org/wiki/value-class-pattern#Parsing_value_from_a_title_attribute + # microformats.org: Value Class Pattern § Parsing value from a title attribute # # @param node [Nokogiri::XML::Element] # @return [Boolean] def self.value_title_node?(node) node.classes.include?('value-title')