lib/indieweb/endpoints/parsers/webmention_parser.rb in indieweb-endpoints-0.4.0 vs lib/indieweb/endpoints/parsers/webmention_parser.rb in indieweb-endpoints-0.5.0

- old
+ new

@@ -8,17 +8,25 @@ Parsers.register(self) private + def results_from_body + WebmentionLinkElementParser.new(response, self.class.identifier).results + end + end + + class WebmentionLinkElementParser < LinkElementParser + private + def link_element # Return first `a` or `link` element with valid `rel` attribute # https://www.w3.org/TR/webmention/#sender-discovers-receiver-webmention-endpoint @link_element ||= link_elements.find { |element| %w[a link].include?(element.name) } end def link_elements_css_selector - @link_elements_css_selector ||= %([rel~="#{self.class.identifier}"][href]) + @link_elements_css_selector ||= %([rel~="#{identifier}"][href]:not([href*="#"])) end end end end end