module Hpricot::Container::Trav
def each_hyperlink_uri(base_uri=nil) # :yields: hyperlink, uri
+each_hyperlink_uri+ doesn't yields href of the BASE element.
HTML BASE element or the argument ((|base_uri|)).
The URI objects are created with a base URI which is given by
It yields Hpricot::Text and URI for each hyperlink.
of A element.
+each_hyperlink_uri+ traverses hyperlinks such as HTML href attribute
def each_hyperlink_uri(base_uri=nil) # :yields: hyperlink, uri base_uri = URI.parse(base_uri) if String === base_uri links = [] each_hyperlink_attribute {|elem, attr, hyperlink| if %r{\{http://www.w3.org/1999/xhtml\}(?:base)\z}i =~ elem.name base_uri = URI.parse(hyperlink.to_s) else links << hyperlink end } if base_uri links.each {|hyperlink| yield hyperlink, base_uri + hyperlink.to_s } else links.each {|hyperlink| yield hyperlink, URI.parse(hyperlink.to_s) } end end