microformats2 2.0.0.pre5 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.travis.yml +7 -1
- data/README.md +17 -8
- data/lib/microformats2/collection.rb +55 -3
- data/lib/microformats2/format.rb +5 -4
- data/lib/microformats2/format_parser.rb +3 -2
- data/lib/microformats2/implied_property/foundation.rb +2 -1
- data/lib/microformats2/implied_property/url.rb +16 -0
- data/lib/microformats2/property.rb +2 -2
- data/lib/microformats2/property/foundation.rb +2 -1
- data/lib/microformats2/property/url.rb +16 -0
- data/lib/microformats2/property_parser.rb +4 -3
- data/lib/microformats2/version.rb +1 -1
- data/microformats2.gemspec +9 -9
- data/spec/lib/microformats2/collection_spec.rb +40 -4
- data/spec/lib/microformats2/implied_property/url_spec.rb +29 -2
- data/spec/support/lib/microformats2/implied_property/url-relative.html +13 -0
- data/spec/support/lib/microformats2/implied_property/url-unnormalized.html +12 -0
- data/spec/support/lib/microformats2/nested-format-with-property.js +2 -1
- data/spec/support/lib/microformats2/nested-property.js +2 -1
- data/spec/support/lib/microformats2/rels-that-drop-the-base.html +11 -0
- data/spec/support/lib/microformats2/rels-with-unnormalized-urls.html +11 -0
- data/spec/support/lib/microformats2/rels.html +12 -0
- data/spec/support/lib/microformats2/rels.js +13 -0
- data/spec/support/lib/microformats2/simple.html +5 -1
- data/spec/support/lib/microformats2/simple.js +3 -2
- metadata +55 -64
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ZDA0ZWM4YmYxYWI1NzNkMmZkZDY3ZjU1YmM4YzU5ZDFjNGUwZTgyZg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZDAxYjVmMDJjNzNjOGYyNGY5NzcyOGJlY2U0OGQwN2JkODk2OTAxNw==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
MjQ3YmMzZjEwNzk3OWEzOTJkMWMzMjkyMTkyNzZjOTM2Y2Q5OTRhYTYwNDgw
|
10
|
+
YTM2ZjExMDYwMTVkODY2M2Q2Yzc4ZGEyYWFhNGFiMzA4Yjc0YmYzOGYyZWEw
|
11
|
+
ZGNmNGJkMzI0NzY2MmVmZGY4ZGJkYTgzMDE1MWIyZDc4OTkyYzk=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MzQ3NjZkYmQxZTMzMzkyZTk0MjI0YzRjNzBhM2NjYzZkNzJmNzY5NTA1YTgw
|
14
|
+
ZjhlMjEwMjhlMDA4YmE4NzZlNWNhZWQ2Yzg3ODI2OTFmMmYwZGFjYzc2ZDcz
|
15
|
+
ZWExYmFjYjMwZDlmOTU5MzE2ZTk2OGNhZWIxMzhjNzNkYmQ5MjI=
|
data/.travis.yml
CHANGED
@@ -1,4 +1,10 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
3
|
- 1.9.3
|
4
|
-
script: bundle exec rspec
|
4
|
+
script: bundle exec rspec
|
5
|
+
notifications:
|
6
|
+
campfire:
|
7
|
+
rooms:
|
8
|
+
secure: UlQ85ETcMVxrK6N9E1zcNPYZ+7as8TLkPS/ArOxytairh8W2S4BFyuCoVRgvLQ88RhHhGgTbkF14DiFtcCiXu9hmfZFZY54q92Sk/Lf98mz1Vzis6X+PedBUIVBPWCEPpMmLxAF+Q1HkEcVYQMKwNoAaQLrW+7SOzh57bOMxHeE=
|
9
|
+
on_success: change
|
10
|
+
on_failure: always
|
data/README.md
CHANGED
@@ -14,17 +14,17 @@ Implemented:
|
|
14
14
|
* [parsing a p- property](http://microformats.org/wiki/microformats2-parsing#parsing_a_p-_property)
|
15
15
|
* [parsing a u- property](http://microformats.org/wiki/microformats2-parsing#parsing_a_u-_property)
|
16
16
|
* [parsing a dt- property](http://microformats.org/wiki/microformats2-parsing#parsing_a_dt-_property)
|
17
|
-
* [parsing a e- property](http://microformats.org/wiki/microformats2-parsing#
|
17
|
+
* [parsing a e- property](http://microformats.org/wiki/microformats2-parsing#parsing_an_e-_property)
|
18
18
|
* [parsing implied properties](http://microformats.org/wiki/microformats-2-parsing#parsing_for_implied_properties)
|
19
19
|
* nested properties
|
20
20
|
* nested microformat with associated property
|
21
21
|
* dynamic creation of properties
|
22
|
+
* [rel](http://microformats.org/wiki/rel)
|
23
|
+
* [normalize u-* property values](http://microformats.org/wiki/microformats2-parsing-faq#normalizing_u-.2A_property_values)
|
22
24
|
|
23
25
|
Not Implemented:
|
24
26
|
|
25
|
-
* [normalize u-* property values](http://microformats.org/wiki/microformats2-parsing-faq#normalizing_u-.2A_property_values)
|
26
27
|
* nested microformat without associated property
|
27
|
-
* [rel](http://microformats.org/wiki/rel)
|
28
28
|
* [value-class-pattern](http://microformats.org/wiki/value-class-pattern)
|
29
29
|
* [include-pattern](http://microformats.org/wiki/include-pattern)
|
30
30
|
* recognition of [vendor extensions](http://microformats.org/wiki/microformats2#VENDOR_EXTENSIONS)
|
@@ -33,14 +33,14 @@ Not Implemented:
|
|
33
33
|
|
34
34
|
## Current Version
|
35
35
|
|
36
|
-
2.0.0
|
36
|
+
2.0.0
|
37
37
|
|
38
38
|
|
39
39
|
## Requirements
|
40
40
|
|
41
|
-
* "nokogiri"
|
42
|
-
* "json"
|
43
|
-
* "activesupport"
|
41
|
+
* "nokogiri"
|
42
|
+
* "json"
|
43
|
+
* "activesupport"
|
44
44
|
|
45
45
|
|
46
46
|
## Installation
|
@@ -64,11 +64,20 @@ Or install it yourself as:
|
|
64
64
|
require "microformats2"
|
65
65
|
|
66
66
|
source = '<div class="h-card"><p class="p-name">Jessica Lynn Suttles</p></div>'
|
67
|
-
collection =
|
67
|
+
collection = Microformats2.parse(source)
|
68
68
|
# using singular accessors
|
69
69
|
collection.card.name.to_s #=> "Jessica Lynn Suttles"
|
70
70
|
# using plural accessors
|
71
71
|
collection.cards.first.names.first.to_s #=> "Jessica Lynn Suttles"
|
72
|
+
|
73
|
+
source = '<article class="h-entry">
|
74
|
+
<h1 class="p-name">Microformats 2</h1>
|
75
|
+
<div class="h-card p-author"><p class="p-name">Jessica Lynn Suttles</p></div>
|
76
|
+
</article>'
|
77
|
+
collection = Microformats2.parse(source)
|
78
|
+
collection.entry.name.to_s #=> "Microformats 2"
|
79
|
+
# accessing nested microformats
|
80
|
+
collection.entry.author.format.name.to_s #=> "Jessica Lynn Suttles"
|
72
81
|
```
|
73
82
|
|
74
83
|
* `source` can be a URL, filepath, or HTML
|
@@ -2,18 +2,30 @@ module Microformats2
|
|
2
2
|
class Collection
|
3
3
|
attr_reader :all
|
4
4
|
|
5
|
-
def initialize(element)
|
5
|
+
def initialize(element, url = nil)
|
6
6
|
@element = element
|
7
|
+
|
8
|
+
@base = nil
|
9
|
+
if url != nil
|
10
|
+
@base = url
|
11
|
+
end
|
12
|
+
if @element.search("base").size > 0
|
13
|
+
@base = @element.search("base")[0].attribute("href")
|
14
|
+
end
|
15
|
+
|
7
16
|
@format_names = []
|
17
|
+
@rels = {}
|
18
|
+
@alternates = []
|
8
19
|
end
|
9
20
|
|
10
21
|
def parse
|
11
22
|
all
|
23
|
+
parse_rels
|
12
24
|
self
|
13
25
|
end
|
14
26
|
|
15
27
|
def all
|
16
|
-
@all ||= FormatParser.parse(@element).each do |format|
|
28
|
+
@all ||= FormatParser.parse(@element, @base).each do |format|
|
17
29
|
save_format_name(format.method_name)
|
18
30
|
define_method(format.method_name)
|
19
31
|
set_value(format.method_name, format)
|
@@ -29,10 +41,12 @@ module Microformats2
|
|
29
41
|
end
|
30
42
|
|
31
43
|
def to_hash
|
32
|
-
hash = { items: [] }
|
44
|
+
hash = { items: [], rels: @rels }
|
33
45
|
all.each do |format|
|
34
46
|
hash[:items] << format.to_hash
|
35
47
|
end
|
48
|
+
hash[:alternates] = @alternates unless @alternates.nil? || @alternates.empty?
|
49
|
+
|
36
50
|
hash
|
37
51
|
end
|
38
52
|
|
@@ -67,5 +81,43 @@ module Microformats2
|
|
67
81
|
send("#{mn.pluralize}=", [value])
|
68
82
|
end
|
69
83
|
end
|
84
|
+
|
85
|
+
def parse_rels
|
86
|
+
@element.search("*[@rel]").each do |rel|
|
87
|
+
rel_values = rel.attribute("rel").text.split(" ")
|
88
|
+
|
89
|
+
if rel_values.member?("alternate")
|
90
|
+
alternate_inst = {}
|
91
|
+
alternate_inst["url"] = absolutize(rel.attribute("href").text)
|
92
|
+
alternate_inst["rel"] = (rel_values - ["alternate"]).join(" ")
|
93
|
+
unless rel.attribute("media").nil?
|
94
|
+
alternate_inst["media"] = rel.attribute("media").text
|
95
|
+
end
|
96
|
+
unless rel.attribute("hreflang").nil?
|
97
|
+
alternate_inst["hreflang"] = rel.attribute("hreflang").text
|
98
|
+
end
|
99
|
+
unless rel.attribute("type").nil?
|
100
|
+
alternate_inst["type"] = rel.attribute("type").text
|
101
|
+
end
|
102
|
+
@alternates << alternate_inst
|
103
|
+
else
|
104
|
+
rel_values.each do |rel_value|
|
105
|
+
@rels[rel_value] = [] unless @rels.has_key?(rel_value)
|
106
|
+
@rels[rel_value] << absolutize(rel.attribute("href").text)
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
def absolutize(href)
|
113
|
+
uri = URI.parse(href)
|
114
|
+
|
115
|
+
if @base && !uri.absolute?
|
116
|
+
uri = URI.join(@base, href)
|
117
|
+
end
|
118
|
+
|
119
|
+
uri.normalize!
|
120
|
+
uri.to_s
|
121
|
+
end
|
70
122
|
end
|
71
123
|
end
|
data/lib/microformats2/format.rb
CHANGED
@@ -4,8 +4,9 @@ module Microformats2
|
|
4
4
|
|
5
5
|
attr_reader :method_name
|
6
6
|
|
7
|
-
def initialize(element)
|
7
|
+
def initialize(element, base)
|
8
8
|
@element = element
|
9
|
+
@base = base
|
9
10
|
@method_name = to_method_name(format_types.first)
|
10
11
|
@property_names = []
|
11
12
|
end
|
@@ -27,20 +28,20 @@ module Microformats2
|
|
27
28
|
end
|
28
29
|
|
29
30
|
def parse_properties
|
30
|
-
PropertyParser.parse(@element.children).each do |property|
|
31
|
+
PropertyParser.parse(@element.children, @base).each do |property|
|
31
32
|
assign_property(property)
|
32
33
|
end
|
33
34
|
end
|
34
35
|
|
35
36
|
def add_property(property_class, value)
|
36
|
-
property = Property.new(nil, property_class, value)
|
37
|
+
property = Property.new(nil, property_class, value, @base)
|
37
38
|
assign_property(property)
|
38
39
|
end
|
39
40
|
|
40
41
|
def parse_implied_properties
|
41
42
|
ip = []
|
42
43
|
ip << ImpliedProperty::Name.new(@element).parse unless property_present?(:name)
|
43
|
-
ip << ImpliedProperty::Url.new(@element).parse unless property_present?(:url)
|
44
|
+
ip << ImpliedProperty::Url.new(@element, @base).parse unless property_present?(:url)
|
44
45
|
ip << ImpliedProperty::Photo.new(@element).parse unless property_present?(:photo)
|
45
46
|
ip.compact.each do |property|
|
46
47
|
save_property_name(property.method_name)
|
@@ -1,7 +1,8 @@
|
|
1
1
|
module Microformats2
|
2
2
|
class FormatParser
|
3
3
|
class << self
|
4
|
-
def parse(element)
|
4
|
+
def parse(element, base=nil)
|
5
|
+
@@base = base
|
5
6
|
parse_node(element).flatten.compact
|
6
7
|
end
|
7
8
|
|
@@ -31,7 +32,7 @@ module Microformats2
|
|
31
32
|
const_name = constant_name(html_class)
|
32
33
|
klass = find_or_create_ruby_class(const_name)
|
33
34
|
|
34
|
-
klass.new(element).parse
|
35
|
+
klass.new(element, @@base).parse
|
35
36
|
end
|
36
37
|
|
37
38
|
def format_classes(element)
|
@@ -6,6 +6,22 @@ module Microformats2
|
|
6
6
|
"url"
|
7
7
|
end
|
8
8
|
|
9
|
+
def to_s
|
10
|
+
@to_s = absolutize(super.to_s) if super.to_s != ""
|
11
|
+
end
|
12
|
+
|
13
|
+
# TODO: make dry, repeated in Collection
|
14
|
+
def absolutize(href)
|
15
|
+
uri = URI.parse(href)
|
16
|
+
|
17
|
+
if @base && !uri.absolute?
|
18
|
+
uri = URI.join(@base, href)
|
19
|
+
end
|
20
|
+
|
21
|
+
uri.normalize!
|
22
|
+
uri.to_s
|
23
|
+
end
|
24
|
+
|
9
25
|
protected
|
10
26
|
|
11
27
|
def name_map
|
@@ -8,13 +8,13 @@ module Microformats2
|
|
8
8
|
"e" => Embedded }
|
9
9
|
|
10
10
|
class << self
|
11
|
-
def new(element, property_class, value=nil)
|
11
|
+
def new(element, property_class, value=nil, base=nil)
|
12
12
|
# p-class-name -> p
|
13
13
|
prefix = property_class.split("-").first
|
14
14
|
# find ruby class for kind of property
|
15
15
|
klass = PREFIX_CLASS_MAP[prefix]
|
16
16
|
raise InvalidPropertyPrefix unless klass
|
17
|
-
klass.new(element, property_class, value)
|
17
|
+
klass.new(element, property_class, value, base)
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
@@ -3,10 +3,11 @@ module Microformats2
|
|
3
3
|
class Foundation
|
4
4
|
attr_reader :method_name
|
5
5
|
|
6
|
-
def initialize(element, html_class, string_value=nil)
|
6
|
+
def initialize(element, html_class, string_value=nil, base=nil)
|
7
7
|
@element = element
|
8
8
|
@method_name = to_method_name(html_class)
|
9
9
|
@string_value = string_value
|
10
|
+
@base = base
|
10
11
|
end
|
11
12
|
|
12
13
|
def parse
|
@@ -2,6 +2,22 @@ module Microformats2
|
|
2
2
|
module Property
|
3
3
|
class Url < Foundation
|
4
4
|
|
5
|
+
def to_s
|
6
|
+
@to_s = absolutize(super.to_s)
|
7
|
+
end
|
8
|
+
|
9
|
+
# TODO: make dry, repeated in Collection
|
10
|
+
def absolutize(href)
|
11
|
+
uri = URI.parse(href)
|
12
|
+
|
13
|
+
if @base && !uri.absolute?
|
14
|
+
uri = URI.join(@base, href)
|
15
|
+
end
|
16
|
+
|
17
|
+
uri.normalize!
|
18
|
+
uri.to_s
|
19
|
+
end
|
20
|
+
|
5
21
|
protected
|
6
22
|
|
7
23
|
def attr_map
|
@@ -1,7 +1,8 @@
|
|
1
1
|
module Microformats2
|
2
2
|
class PropertyParser
|
3
3
|
class << self
|
4
|
-
def parse(element)
|
4
|
+
def parse(element, base)
|
5
|
+
@@base = base
|
5
6
|
parse_node(element).flatten.compact
|
6
7
|
end
|
7
8
|
|
@@ -26,8 +27,8 @@ module Microformats2
|
|
26
27
|
|
27
28
|
def parse_property(element)
|
28
29
|
property_classes(element).map do |property_class|
|
29
|
-
property = Property.new(element, property_class).parse
|
30
|
-
properties = format_classes(element).empty? ? PropertyParser.parse(element.children) : []
|
30
|
+
property = Property.new(element, property_class, nil, @@base).parse
|
31
|
+
properties = format_classes(element).empty? ? PropertyParser.parse(element.children, @@base) : []
|
31
32
|
|
32
33
|
[property].concat properties
|
33
34
|
end
|
data/microformats2.gemspec
CHANGED
@@ -17,14 +17,14 @@ Gem::Specification.new do |gem|
|
|
17
17
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
18
|
gem.require_paths = ["lib"]
|
19
19
|
|
20
|
-
gem.add_runtime_dependency "nokogiri"
|
21
|
-
gem.add_runtime_dependency "json"
|
22
|
-
gem.add_runtime_dependency "activesupport"
|
20
|
+
gem.add_runtime_dependency "nokogiri"
|
21
|
+
gem.add_runtime_dependency "json"
|
22
|
+
gem.add_runtime_dependency "activesupport"
|
23
23
|
|
24
|
-
gem.add_development_dependency "rake"
|
25
|
-
gem.add_development_dependency "rspec"
|
26
|
-
gem.add_development_dependency "guard-rspec"
|
27
|
-
gem.add_development_dependency "rb-fsevent"
|
28
|
-
gem.add_development_dependency "simplecov"
|
29
|
-
gem.add_development_dependency "webmock"
|
24
|
+
gem.add_development_dependency "rake"
|
25
|
+
gem.add_development_dependency "rspec"
|
26
|
+
gem.add_development_dependency "guard-rspec"
|
27
|
+
gem.add_development_dependency "rb-fsevent"
|
28
|
+
gem.add_development_dependency "simplecov"
|
29
|
+
gem.add_development_dependency "webmock"
|
30
30
|
end
|
@@ -35,13 +35,13 @@ describe Microformats2::Collection do
|
|
35
35
|
@collection.card.name.should be_kind_of Microformats2::Property::Text
|
36
36
|
end
|
37
37
|
end
|
38
|
-
describe "'.h-card .
|
38
|
+
describe "'.h-card .u-url'" do
|
39
39
|
it "assigns all urls to HCard#urls" do
|
40
|
-
urls = ["http://flickr.com/
|
40
|
+
urls = ["http://example.org/", "http://flickr.com/", "http://twitter.com/jlsuttles"]
|
41
41
|
@collection.card.urls.map(&:to_s).should == urls
|
42
42
|
end
|
43
43
|
it "assigns then first url to HCard#url" do
|
44
|
-
@collection.card.url.to_s.should == "http://
|
44
|
+
@collection.card.url.to_s.should == "http://example.org/"
|
45
45
|
end
|
46
46
|
it "HCard#url is a Property::Url" do
|
47
47
|
@collection.card.url.should be_kind_of Microformats2::Property::Url
|
@@ -176,11 +176,47 @@ describe Microformats2::Collection do
|
|
176
176
|
end
|
177
177
|
end
|
178
178
|
end
|
179
|
+
|
180
|
+
describe "rels.html" do
|
181
|
+
before do
|
182
|
+
html = "spec/support/lib/microformats2/rels.html"
|
183
|
+
@collection = Microformats2.parse(html)
|
184
|
+
end
|
185
|
+
describe "#to_json" do
|
186
|
+
it "should match rels.js" do
|
187
|
+
# this also tests the case of having rel="alternates"
|
188
|
+
json = "spec/support/lib/microformats2/rels.js"
|
189
|
+
json = open(json).read
|
190
|
+
JSON.parse(@collection.to_json).should == JSON.parse(json)
|
191
|
+
end
|
192
|
+
end
|
193
|
+
end
|
194
|
+
|
195
|
+
describe "rels-with-unnormalized-urls.html" do
|
196
|
+
before do
|
197
|
+
html = "spec/support/lib/microformats2/rels-with-unnormalized-urls.html"
|
198
|
+
@collection = Microformats2.parse(html)
|
199
|
+
end
|
200
|
+
|
201
|
+
it "should normalize the url" do
|
202
|
+
@collection.to_hash[:rels]["me"].should eq([ "http://jessicard.com/" ])
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
describe "rels-that-drop-the-base.html" do
|
207
|
+
before do
|
208
|
+
html = "spec/support/lib/microformats2/rels-that-drop-the-base.html"
|
209
|
+
@collection = Microformats2.parse(html)
|
210
|
+
end
|
211
|
+
|
212
|
+
it "keeps the relative path" do
|
213
|
+
@collection.to_hash[:rels]["stylesheet"].should eq([ "/path/to/stylesheet.css" ])
|
214
|
+
end
|
215
|
+
end
|
179
216
|
end
|
180
217
|
|
181
218
|
|
182
219
|
# these cases were scraped from the internet using `rake specs:update`
|
183
|
-
#
|
184
220
|
|
185
221
|
describe "spec/support/cases" do
|
186
222
|
cases_dir = "spec/support/cases/*"
|
@@ -15,6 +15,33 @@ describe Microformats2::ImpliedProperty::Url do
|
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
18
|
+
|
19
|
+
describe "url-relative.html" do
|
20
|
+
html = "spec/support/lib/microformats2/implied_property/url-relative.html"
|
21
|
+
collection = Microformats2.parse(html)
|
22
|
+
it "should have 2 microformats" do
|
23
|
+
collection.all.length.should == 2
|
24
|
+
end
|
25
|
+
collection.all.each_with_index do |format, index|
|
26
|
+
it "implies url to be 'http://example.org/' in case #{index+1}" do
|
27
|
+
format.url.to_s.should == "http://example.org/"
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe "url-unnormalized.html" do
|
33
|
+
html = "spec/support/lib/microformats2/implied_property/url-unnormalized.html"
|
34
|
+
collection = Microformats2.parse(html)
|
35
|
+
it "should have 2 microformats" do
|
36
|
+
collection.all.length.should == 2
|
37
|
+
end
|
38
|
+
collection.all.each_with_index do |format, index|
|
39
|
+
it "implies url to be 'http://github.com/' in case #{index+1}" do
|
40
|
+
format.url.to_s.should == "http://github.com/"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
18
45
|
describe "url-fail.html" do
|
19
46
|
html = "spec/support/lib/microformats2/implied_property/url-fail.html"
|
20
47
|
collection = Microformats2.parse(html)
|
@@ -22,8 +49,8 @@ describe Microformats2::ImpliedProperty::Url do
|
|
22
49
|
collection.all.length.should == 2
|
23
50
|
end
|
24
51
|
collection.all.each_with_index do |format, index|
|
25
|
-
it "
|
26
|
-
expect {format.url
|
52
|
+
it "does not imply url in case #{index+1}" do
|
53
|
+
expect {format.url}.to raise_error(NoMethodError)
|
27
54
|
end
|
28
55
|
end
|
29
56
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Rels without Base Test</title>
|
5
|
+
<link href="/path/to/stylesheet.css" media="all" rel="stylesheet" type="text/css" />
|
6
|
+
</head>
|
7
|
+
<body>
|
8
|
+
<li><a rel="met friend" href="http://adactio.com/">Jeremy Keith</a></li>
|
9
|
+
<li><a rel="met friend" href="http://tantek.com/">Tantek Çelik</a></li>
|
10
|
+
</body>
|
11
|
+
</html>
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Rels Test</title>
|
5
|
+
<base href="http://example.org/">
|
6
|
+
<link rel="updates alternate" href="http://tantek.com/updates.atom" type="application/atom+xml" />
|
7
|
+
</head>
|
8
|
+
<body>
|
9
|
+
<li><a rel="me" href="http://jessicard.com">Jessica Dillon</a></li>
|
10
|
+
</body>
|
11
|
+
</html>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Rels Test</title>
|
5
|
+
<base href="http://example.org/">
|
6
|
+
<link rel="updates alternate" href="http://tantek.com/updates.atom" type="application/atom+xml" />
|
7
|
+
</head>
|
8
|
+
<body>
|
9
|
+
<li><a rel="met friend" href="http://adactio.com/">Jeremy Keith</a></li>
|
10
|
+
<li><a rel="met friend" href="http://tantek.com/">Tantek Çelik</a></li>
|
11
|
+
</body>
|
12
|
+
</html>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
{
|
2
|
+
"items": [],
|
3
|
+
"rels": {
|
4
|
+
"friend": ["http://adactio.com/", "http://tantek.com/"],
|
5
|
+
"met": ["http://adactio.com/", "http://tantek.com/"]
|
6
|
+
},
|
7
|
+
"alternates": [
|
8
|
+
{"url": "http://tantek.com/updates.atom",
|
9
|
+
"type": "application/atom+xml",
|
10
|
+
"rel": "updates"
|
11
|
+
}
|
12
|
+
]
|
13
|
+
}
|
@@ -1,10 +1,14 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html>
|
3
|
+
<base href="http://example.org/">
|
3
4
|
<body>
|
4
5
|
<div class="h-card">
|
5
|
-
<a href="
|
6
|
+
<a href="/" class="u-url p-name">
|
6
7
|
Jessica Lynn Suttles
|
7
8
|
</a>
|
9
|
+
<a href="http://flickr.com" class="u-url">
|
10
|
+
@jlsuttles
|
11
|
+
</a>
|
8
12
|
<a href="http://twitter.com/jlsuttles" class="u-url">
|
9
13
|
@jlsuttles
|
10
14
|
</a>
|
@@ -1,10 +1,11 @@
|
|
1
1
|
{ "items": [{
|
2
2
|
"type": ["h-card"],
|
3
3
|
"properties": {
|
4
|
-
"url": ["http://flickr.com/
|
4
|
+
"url": ["http://example.org/", "http://flickr.com/", "http://twitter.com/jlsuttles"],
|
5
5
|
"name": ["Jessica Lynn Suttles"],
|
6
6
|
"bday": ["1990-10-15"],
|
7
7
|
"content": ["<p>Vegan. Cat lover. Coder.</p>"]
|
8
8
|
}
|
9
|
-
}]
|
9
|
+
}],
|
10
|
+
"rels": {}
|
10
11
|
}
|
metadata
CHANGED
@@ -1,160 +1,141 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: microformats2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0
|
5
|
-
prerelease: 6
|
4
|
+
version: 2.0.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Jessica Lynn Suttles
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-02-25 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: nokogiri
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ! '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
19
|
+
version: '0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ! '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
26
|
+
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: json
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - ! '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
|
-
version:
|
33
|
+
version: '0'
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - ! '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
|
-
version:
|
40
|
+
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: activesupport
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - ! '>='
|
52
46
|
- !ruby/object:Gem::Version
|
53
|
-
version:
|
47
|
+
version: '0'
|
54
48
|
type: :runtime
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - ! '>='
|
60
53
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
54
|
+
version: '0'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: rake
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - ! '>='
|
68
60
|
- !ruby/object:Gem::Version
|
69
|
-
version:
|
61
|
+
version: '0'
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - ! '>='
|
76
67
|
- !ruby/object:Gem::Version
|
77
|
-
version:
|
68
|
+
version: '0'
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: rspec
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
|
-
- -
|
73
|
+
- - ! '>='
|
84
74
|
- !ruby/object:Gem::Version
|
85
|
-
version:
|
75
|
+
version: '0'
|
86
76
|
type: :development
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
|
-
- -
|
80
|
+
- - ! '>='
|
92
81
|
- !ruby/object:Gem::Version
|
93
|
-
version:
|
82
|
+
version: '0'
|
94
83
|
- !ruby/object:Gem::Dependency
|
95
84
|
name: guard-rspec
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
86
|
requirements:
|
99
|
-
- -
|
87
|
+
- - ! '>='
|
100
88
|
- !ruby/object:Gem::Version
|
101
|
-
version:
|
89
|
+
version: '0'
|
102
90
|
type: :development
|
103
91
|
prerelease: false
|
104
92
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
93
|
requirements:
|
107
|
-
- -
|
94
|
+
- - ! '>='
|
108
95
|
- !ruby/object:Gem::Version
|
109
|
-
version:
|
96
|
+
version: '0'
|
110
97
|
- !ruby/object:Gem::Dependency
|
111
98
|
name: rb-fsevent
|
112
99
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
100
|
requirements:
|
115
|
-
- -
|
101
|
+
- - ! '>='
|
116
102
|
- !ruby/object:Gem::Version
|
117
|
-
version: 0
|
103
|
+
version: '0'
|
118
104
|
type: :development
|
119
105
|
prerelease: false
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
107
|
requirements:
|
123
|
-
- -
|
108
|
+
- - ! '>='
|
124
109
|
- !ruby/object:Gem::Version
|
125
|
-
version: 0
|
110
|
+
version: '0'
|
126
111
|
- !ruby/object:Gem::Dependency
|
127
112
|
name: simplecov
|
128
113
|
requirement: !ruby/object:Gem::Requirement
|
129
|
-
none: false
|
130
114
|
requirements:
|
131
|
-
- -
|
115
|
+
- - ! '>='
|
132
116
|
- !ruby/object:Gem::Version
|
133
|
-
version: 0
|
117
|
+
version: '0'
|
134
118
|
type: :development
|
135
119
|
prerelease: false
|
136
120
|
version_requirements: !ruby/object:Gem::Requirement
|
137
|
-
none: false
|
138
121
|
requirements:
|
139
|
-
- -
|
122
|
+
- - ! '>='
|
140
123
|
- !ruby/object:Gem::Version
|
141
|
-
version: 0
|
124
|
+
version: '0'
|
142
125
|
- !ruby/object:Gem::Dependency
|
143
126
|
name: webmock
|
144
127
|
requirement: !ruby/object:Gem::Requirement
|
145
|
-
none: false
|
146
128
|
requirements:
|
147
|
-
- -
|
129
|
+
- - ! '>='
|
148
130
|
- !ruby/object:Gem::Version
|
149
|
-
version:
|
131
|
+
version: '0'
|
150
132
|
type: :development
|
151
133
|
prerelease: false
|
152
134
|
version_requirements: !ruby/object:Gem::Requirement
|
153
|
-
none: false
|
154
135
|
requirements:
|
155
|
-
- -
|
136
|
+
- - ! '>='
|
156
137
|
- !ruby/object:Gem::Version
|
157
|
-
version:
|
138
|
+
version: '0'
|
158
139
|
description: parses HTML for microformats and return a collection of dynamically defined
|
159
140
|
Ruby objects
|
160
141
|
email:
|
@@ -354,36 +335,41 @@ files:
|
|
354
335
|
- spec/support/lib/microformats2/implied_property/photo-pass.html
|
355
336
|
- spec/support/lib/microformats2/implied_property/url-fail.html
|
356
337
|
- spec/support/lib/microformats2/implied_property/url-pass.html
|
338
|
+
- spec/support/lib/microformats2/implied_property/url-relative.html
|
339
|
+
- spec/support/lib/microformats2/implied_property/url-unnormalized.html
|
357
340
|
- spec/support/lib/microformats2/nested-format-with-property.html
|
358
341
|
- spec/support/lib/microformats2/nested-format-with-property.js
|
359
342
|
- spec/support/lib/microformats2/nested-format-without-property.html
|
360
343
|
- spec/support/lib/microformats2/nested-property.html
|
361
344
|
- spec/support/lib/microformats2/nested-property.js
|
345
|
+
- spec/support/lib/microformats2/rels-that-drop-the-base.html
|
346
|
+
- spec/support/lib/microformats2/rels-with-unnormalized-urls.html
|
347
|
+
- spec/support/lib/microformats2/rels.html
|
348
|
+
- spec/support/lib/microformats2/rels.js
|
362
349
|
- spec/support/lib/microformats2/simple.html
|
363
350
|
- spec/support/lib/microformats2/simple.js
|
364
351
|
homepage: https://github.com/G5/microformats2
|
365
352
|
licenses: []
|
353
|
+
metadata: {}
|
366
354
|
post_install_message:
|
367
355
|
rdoc_options: []
|
368
356
|
require_paths:
|
369
357
|
- lib
|
370
358
|
required_ruby_version: !ruby/object:Gem::Requirement
|
371
|
-
none: false
|
372
359
|
requirements:
|
373
360
|
- - ! '>='
|
374
361
|
- !ruby/object:Gem::Version
|
375
362
|
version: '0'
|
376
363
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
377
|
-
none: false
|
378
364
|
requirements:
|
379
|
-
- - ! '
|
365
|
+
- - ! '>='
|
380
366
|
- !ruby/object:Gem::Version
|
381
|
-
version:
|
367
|
+
version: '0'
|
382
368
|
requirements: []
|
383
369
|
rubyforge_project:
|
384
|
-
rubygems_version:
|
370
|
+
rubygems_version: 2.0.6
|
385
371
|
signing_key:
|
386
|
-
specification_version:
|
372
|
+
specification_version: 4
|
387
373
|
summary: microformats2 parser
|
388
374
|
test_files:
|
389
375
|
- spec/lib/microformats2/collection_spec.rb
|
@@ -551,11 +537,16 @@ test_files:
|
|
551
537
|
- spec/support/lib/microformats2/implied_property/photo-pass.html
|
552
538
|
- spec/support/lib/microformats2/implied_property/url-fail.html
|
553
539
|
- spec/support/lib/microformats2/implied_property/url-pass.html
|
540
|
+
- spec/support/lib/microformats2/implied_property/url-relative.html
|
541
|
+
- spec/support/lib/microformats2/implied_property/url-unnormalized.html
|
554
542
|
- spec/support/lib/microformats2/nested-format-with-property.html
|
555
543
|
- spec/support/lib/microformats2/nested-format-with-property.js
|
556
544
|
- spec/support/lib/microformats2/nested-format-without-property.html
|
557
545
|
- spec/support/lib/microformats2/nested-property.html
|
558
546
|
- spec/support/lib/microformats2/nested-property.js
|
547
|
+
- spec/support/lib/microformats2/rels-that-drop-the-base.html
|
548
|
+
- spec/support/lib/microformats2/rels-with-unnormalized-urls.html
|
549
|
+
- spec/support/lib/microformats2/rels.html
|
550
|
+
- spec/support/lib/microformats2/rels.js
|
559
551
|
- spec/support/lib/microformats2/simple.html
|
560
552
|
- spec/support/lib/microformats2/simple.js
|
561
|
-
has_rdoc:
|