Resolve relative URLs (bugfix)
When the <base> tag is used, the @base wasn't handed down all the way to URLs and photos, this patch fixes this problem. In addition to that it also makes it possible to handle u-url on <input> tags.
This commit is contained in:
parent
1e9e65cf9e
commit
6c90f01ae7
4 changed files with 9 additions and 4 deletions
|
@ -40,9 +40,9 @@ module Microformats2
|
||||||
|
|
||||||
def parse_implied_properties
|
def parse_implied_properties
|
||||||
ip = []
|
ip = []
|
||||||
ip << ImpliedProperty::Name.new(@element).parse unless property_present?(:name)
|
ip << ImpliedProperty::Name.new(@element, @base).parse unless property_present?(:name)
|
||||||
ip << ImpliedProperty::Url.new(@element, @base).parse unless property_present?(:url)
|
ip << ImpliedProperty::Url.new(@element, @base).parse unless property_present?(:url)
|
||||||
ip << ImpliedProperty::Photo.new(@element).parse unless property_present?(:photo)
|
ip << ImpliedProperty::Photo.new(@element, @base).parse unless property_present?(:photo)
|
||||||
ip.compact.each do |property|
|
ip.compact.each do |property|
|
||||||
save_property_name(property.method_name)
|
save_property_name(property.method_name)
|
||||||
define_method(property.method_name)
|
define_method(property.method_name)
|
||||||
|
|
|
@ -6,6 +6,10 @@ module Microformats2
|
||||||
"photo"
|
"photo"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def to_s
|
||||||
|
@to_s = Microformats2::AbsoluteUri.new(@base, super.to_s).absolutize
|
||||||
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def name_map
|
def name_map
|
||||||
|
|
|
@ -25,7 +25,7 @@ module Microformats2
|
||||||
end
|
end
|
||||||
|
|
||||||
def formats
|
def formats
|
||||||
@formats ||= format_classes.length >=1 ? FormatParser.parse(@element) : []
|
@formats ||= format_classes.length >=1 ? FormatParser.parse(@element, @base) : []
|
||||||
end
|
end
|
||||||
|
|
||||||
def to_hash
|
def to_hash
|
||||||
|
|
|
@ -15,7 +15,8 @@ module Microformats2
|
||||||
"img" => "src",
|
"img" => "src",
|
||||||
"object" => "data",
|
"object" => "data",
|
||||||
"abbr" => "title",
|
"abbr" => "title",
|
||||||
"data" => "value" }
|
"data" => "value",
|
||||||
|
"input" => "value" }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue