From 1869adb60efcde541a5d511fe28d9673e3afb84b Mon Sep 17 00:00:00 2001 From: Jessica Dillon & Jessica Lynn Suttles Date: Sun, 17 Nov 2013 16:00:25 -0800 Subject: [PATCH 01/36] Add Campfire notifications for Travis CI --- .travis.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 8d81e4a..de0b030 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,8 @@ language: ruby rvm: - - 1.9.3 +- 1.9.3 script: bundle exec rspec spec +notifications: + campfire: + rooms: + secure: UlQ85ETcMVxrK6N9E1zcNPYZ+7as8TLkPS/ArOxytairh8W2S4BFyuCoVRgvLQ88RhHhGgTbkF14DiFtcCiXu9hmfZFZY54q92Sk/Lf98mz1Vzis6X+PedBUIVBPWCEPpMmLxAF+Q1HkEcVYQMKwNoAaQLrW+7SOzh57bOMxHeE= From b83c2118f6f45bb31503705dfd1d24c1b17488ea Mon Sep 17 00:00:00 2001 From: Jessica Dillon & Jessica Lynn Suttles Date: Sun, 17 Nov 2013 16:09:45 -0800 Subject: [PATCH 02/36] Fix .travis.yml file --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index de0b030..5ecd29a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,7 @@ language: ruby rvm: -- 1.9.3 -script: bundle exec rspec spec + - 1.9.3 +script: bundle exec rspec notifications: campfire: rooms: From 68bfe0fb2ebd4d0394550da7ba023e261e802082 Mon Sep 17 00:00:00 2001 From: Jessica Dillon & Jessica Lynn Suttles Date: Sun, 17 Nov 2013 16:16:52 -0800 Subject: [PATCH 03/36] Update Campfire config for Travis CI --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 5ecd29a..9f5a5f4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,3 +6,5 @@ notifications: campfire: rooms: secure: UlQ85ETcMVxrK6N9E1zcNPYZ+7as8TLkPS/ArOxytairh8W2S4BFyuCoVRgvLQ88RhHhGgTbkF14DiFtcCiXu9hmfZFZY54q92Sk/Lf98mz1Vzis6X+PedBUIVBPWCEPpMmLxAF+Q1HkEcVYQMKwNoAaQLrW+7SOzh57bOMxHeE= + on_success: change + on_failure: always From 2ac4cff54b97d5968d278158bdc25bf66281c481 Mon Sep 17 00:00:00 2001 From: Jessica Dillon & Jessica Lynn Suttles Date: Thu, 12 Dec 2013 15:11:51 -0800 Subject: [PATCH 04/36] Add spec for nested format with property of same name --- spec/lib/microformats2/collection_spec.rb | 14 ++++++++++++++ ...nested-format-with-property-of-same-name.html | 13 +++++++++++++ .../nested-format-with-property-of-same-name.js | 16 ++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 spec/support/lib/microformats2/nested-format-with-property-of-same-name.html create mode 100644 spec/support/lib/microformats2/nested-format-with-property-of-same-name.js diff --git a/spec/lib/microformats2/collection_spec.rb b/spec/lib/microformats2/collection_spec.rb index 44e5c49..55b6b1e 100644 --- a/spec/lib/microformats2/collection_spec.rb +++ b/spec/lib/microformats2/collection_spec.rb @@ -138,6 +138,20 @@ describe Microformats2::Collection do end end + describe "nested-format-with-property-of-same-name.html" do + before do + html = "spec/support/lib/microformats2/nested-format-with-property-of-same-name.html" + @collection = Microformats2.parse(html) + end + describe "#to_json" do + it "should match nested-format-with-property-of-same-name.js" do + json = "spec/support/lib/microformats2/nested-format-with-property-of-same-name.js" + json = open(json).read + JSON.parse(@collection.to_json).should == JSON.parse(json) + end + end + end + describe "nested-format-with-property.html" do before do html = "spec/support/lib/microformats2/nested-format-with-property.html" diff --git a/spec/support/lib/microformats2/nested-format-with-property-of-same-name.html b/spec/support/lib/microformats2/nested-format-with-property-of-same-name.html new file mode 100644 index 0000000..4b858d9 --- /dev/null +++ b/spec/support/lib/microformats2/nested-format-with-property-of-same-name.html @@ -0,0 +1,13 @@ + + + +
+
+ + 123 Rainbow Lane + + +
+
+ + diff --git a/spec/support/lib/microformats2/nested-format-with-property-of-same-name.js b/spec/support/lib/microformats2/nested-format-with-property-of-same-name.js new file mode 100644 index 0000000..9114012 --- /dev/null +++ b/spec/support/lib/microformats2/nested-format-with-property-of-same-name.js @@ -0,0 +1,16 @@ +{ "items": [{ + "type": ["h-card"], + "properties": { + "adr": [{ + "value": "123 Rainbow Lane", + "type": ["h-adr"], + "properties": { + "street-address": ["123 Rainbow Lane"], + "name": ["123 Rainbow Lane"] + } + }], + "name": ["123 Rainbow Lane"] + } + }], + "rels": {} +} From b972df4334b46de073d112691b8e04ae7e4bb4fe Mon Sep 17 00:00:00 2001 From: Jessica Dillon & Jessica Lynn Suttles Date: Tue, 25 Feb 2014 15:11:42 -0800 Subject: [PATCH 05/36] Add a usage example for nested microformats to README Fixes #25 --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index c164c56..3a2463a 100644 --- a/README.md +++ b/README.md @@ -69,6 +69,15 @@ collection = Microformats2.parse(source) collection.card.name.to_s #=> "Jessica Lynn Suttles" # using plural accessors collection.cards.first.names.first.to_s #=> "Jessica Lynn Suttles" + +source = '
+

Microformats 2

+

Jessica Lynn Suttles

+
' +collection = Microformats2.parse(source) +collection.entry.name.to_s #=> "Microformats 2" +# accessing nested microformats +collection.entry.author.format.name.to_s #=> "Jessica Lynn Suttles" ``` * `source` can be a URL, filepath, or HTML From ed10fa8823239a66f1ae3f00cd4ad7818fcd8fe0 Mon Sep 17 00:00:00 2001 From: Jessica Lynn Suttles Date: Tue, 25 Feb 2014 15:19:27 -0800 Subject: [PATCH 06/36] Remove version constraints from dependencies --- microformats2.gemspec | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/microformats2.gemspec b/microformats2.gemspec index e8d1245..8eb15fc 100644 --- a/microformats2.gemspec +++ b/microformats2.gemspec @@ -17,14 +17,14 @@ Gem::Specification.new do |gem| gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) gem.require_paths = ["lib"] - gem.add_runtime_dependency "nokogiri", ">= 1.5.6" - gem.add_runtime_dependency "json", ">= 1.7.6" - gem.add_runtime_dependency "activesupport", ">= 3.2.13" + gem.add_runtime_dependency "nokogiri" + gem.add_runtime_dependency "json" + gem.add_runtime_dependency "activesupport" - gem.add_development_dependency "rake", "~> 10.0.0" - gem.add_development_dependency "rspec", "~> 2.11.0" - gem.add_development_dependency "guard-rspec", "~> 2.1.0" - gem.add_development_dependency "rb-fsevent", "~> 0.9.1" - gem.add_development_dependency "simplecov", "~> 0.7.1" - gem.add_development_dependency "webmock", "~> 1.12.3" + gem.add_development_dependency "rake" + gem.add_development_dependency "rspec" + gem.add_development_dependency "guard-rspec" + gem.add_development_dependency "rb-fsevent" + gem.add_development_dependency "simplecov" + gem.add_development_dependency "webmock" end From 78927d36b8869d5e73adff754b2ee921a0ee853b Mon Sep 17 00:00:00 2001 From: Jessica Lynn Suttles Date: Tue, 25 Feb 2014 15:22:44 -0800 Subject: [PATCH 07/36] Bump version to 2.0.0 Fixes #24 --- README.md | 8 ++++---- lib/microformats2/version.rb | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 3a2463a..00a4f4a 100644 --- a/README.md +++ b/README.md @@ -33,14 +33,14 @@ Not Implemented: ## Current Version -2.0.0.pre5 +2.0.0 ## Requirements -* "nokogiri", "~> 1.5.6" -* "json", "~> 1.7.6" -* "activesupport", "~> 3.2.12" +* "nokogiri" +* "json" +* "activesupport" ## Installation diff --git a/lib/microformats2/version.rb b/lib/microformats2/version.rb index 60003dc..c89cf32 100644 --- a/lib/microformats2/version.rb +++ b/lib/microformats2/version.rb @@ -1,3 +1,3 @@ module Microformats2 - VERSION = "2.0.0.pre5" + VERSION = "2.0.0" end From bbff5ac389b1bf020bab2c92c149fbf963dc8aff Mon Sep 17 00:00:00 2001 From: jessicard Date: Tue, 25 Feb 2014 15:56:14 -0800 Subject: [PATCH 08/36] adds jessicard to list of contributors --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 00a4f4a..9540cbc 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,7 @@ collection.entry.author.format.name.to_s #=> "Jessica Lynn Suttles" * Shane Becker / [@veganstraightedge](https://github.com/veganstraightedge) * Chris Stringer / [@jcstringer](https://github.com/jcstringer) * Michael Mitchell / [@variousred](https://github.com/variousred) +* Jessica Dillon / [@jessicard](https://github.com/jessicard) ## Contributions From d85c12c6060a9b76faa3c3b88623bd54ce5d6541 Mon Sep 17 00:00:00 2001 From: jessicard Date: Tue, 25 Feb 2014 15:58:34 -0800 Subject: [PATCH 09/36] adds jessicard to authors in gemspec --- microformats2.gemspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/microformats2.gemspec b/microformats2.gemspec index 8eb15fc..5c5dff1 100644 --- a/microformats2.gemspec +++ b/microformats2.gemspec @@ -6,8 +6,8 @@ require 'microformats2/version' Gem::Specification.new do |gem| gem.name = "microformats2" gem.version = Microformats2::VERSION - gem.authors = ["Jessica Lynn Suttles"] - gem.email = ["jlsuttles@gmail.com"] + gem.authors = ["Jessica Lynn Suttles", "Jessica Dillon"] + gem.email = ["jlsuttles@gmail.com", "jessicard@mac.com"] gem.description = %q{parses HTML for microformats and return a collection of dynamically defined Ruby objects} gem.summary = %q{microformats2 parser} gem.homepage = "https://github.com/G5/microformats2" From 25f5fda178d6169d088e35d28c242016bbffdf95 Mon Sep 17 00:00:00 2001 From: Jessica Lynn Suttles Date: Mon, 3 Mar 2014 15:32:36 -0800 Subject: [PATCH 10/36] Allow u-* properties to be invalid URIs --- lib/microformats2.rb | 1 + lib/microformats2/absolute_uri.rb | 32 +++++++++++++++++++++++ lib/microformats2/collection.rb | 15 ++--------- lib/microformats2/implied_property/url.rb | 14 +--------- lib/microformats2/property/url.rb | 14 +--------- 5 files changed, 37 insertions(+), 39 deletions(-) create mode 100644 lib/microformats2/absolute_uri.rb diff --git a/lib/microformats2.rb b/lib/microformats2.rb index 8515004..4359ecb 100644 --- a/lib/microformats2.rb +++ b/lib/microformats2.rb @@ -4,6 +4,7 @@ require "json" require "active_support/inflector" require "microformats2/version" +require "microformats2/absolute_uri" require "microformats2/parser" require "microformats2/format_parser" require "microformats2/property_parser" diff --git a/lib/microformats2/absolute_uri.rb b/lib/microformats2/absolute_uri.rb new file mode 100644 index 0000000..67e69e3 --- /dev/null +++ b/lib/microformats2/absolute_uri.rb @@ -0,0 +1,32 @@ +module Microformats2 + class AbsoluteUri + attr_accessor :base, :relative + + def initialize(base, relative) + @base = base + @relative = relative + end + + def absolutize + return nil if relative.nil? or relative == "" + + uri = URI.parse(relative) + + if base && !uri.absolute? + uri = URI.join(base.to_s, relative.to_s) + end + + uri.normalize! + uri.to_s + rescue URI::InvalidURIError => e + logger.warn e.message + relative.to_s + end + + def logger + @logger ||= Logger.new(STDOUT) + @logger.level = Logger::WARN + @logger + end + end +end diff --git a/lib/microformats2/collection.rb b/lib/microformats2/collection.rb index 8469ecc..5ed43e0 100644 --- a/lib/microformats2/collection.rb +++ b/lib/microformats2/collection.rb @@ -88,7 +88,7 @@ module Microformats2 if rel_values.member?("alternate") alternate_inst = {} - alternate_inst["url"] = absolutize(rel.attribute("href").text) + alternate_inst["url"] = Microformats2::AbsoluteUri.new(@base, rel.attribute("href").text).absolutize alternate_inst["rel"] = (rel_values - ["alternate"]).join(" ") unless rel.attribute("media").nil? alternate_inst["media"] = rel.attribute("media").text @@ -103,21 +103,10 @@ module Microformats2 else rel_values.each do |rel_value| @rels[rel_value] = [] unless @rels.has_key?(rel_value) - @rels[rel_value] << absolutize(rel.attribute("href").text) + @rels[rel_value] << Microformats2::AbsoluteUri.new(@base, rel.attribute("href").text).absolutize end end end end - - def absolutize(href) - uri = URI.parse(href) - - if @base && !uri.absolute? - uri = URI.join(@base, href) - end - - uri.normalize! - uri.to_s - end end end diff --git a/lib/microformats2/implied_property/url.rb b/lib/microformats2/implied_property/url.rb index 54ae407..26e0ea3 100644 --- a/lib/microformats2/implied_property/url.rb +++ b/lib/microformats2/implied_property/url.rb @@ -7,19 +7,7 @@ module Microformats2 end def to_s - @to_s = absolutize(super.to_s) if super.to_s != "" - end - - # TODO: make dry, repeated in Collection - def absolutize(href) - uri = URI.parse(href) - - if @base && !uri.absolute? - uri = URI.join(@base, href) - end - - uri.normalize! - uri.to_s + @to_s = Microformats2::AbsoluteUri.new(@base, super.to_s).absolutize end protected diff --git a/lib/microformats2/property/url.rb b/lib/microformats2/property/url.rb index 85847a6..c86c6b6 100644 --- a/lib/microformats2/property/url.rb +++ b/lib/microformats2/property/url.rb @@ -3,19 +3,7 @@ module Microformats2 class Url < Foundation def to_s - @to_s = absolutize(super.to_s) - end - - # TODO: make dry, repeated in Collection - def absolutize(href) - uri = URI.parse(href) - - if @base && !uri.absolute? - uri = URI.join(@base, href) - end - - uri.normalize! - uri.to_s + @to_s = Microformats2::AbsoluteUri.new(@base, super.to_s).absolutize end protected From d8545d9930180694c6227bb4c217cf50e76c967c Mon Sep 17 00:00:00 2001 From: Jessica Lynn Suttles Date: Fri, 7 Mar 2014 16:41:34 -0800 Subject: [PATCH 11/36] Do not log URI::InvalidURIError error message --- lib/microformats2/absolute_uri.rb | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/lib/microformats2/absolute_uri.rb b/lib/microformats2/absolute_uri.rb index 67e69e3..13eafad 100644 --- a/lib/microformats2/absolute_uri.rb +++ b/lib/microformats2/absolute_uri.rb @@ -18,15 +18,9 @@ module Microformats2 uri.normalize! uri.to_s - rescue URI::InvalidURIError => e - logger.warn e.message - relative.to_s - end - def logger - @logger ||= Logger.new(STDOUT) - @logger.level = Logger::WARN - @logger + rescue URI::InvalidURIError => e + relative.to_s end end end From cb918e2dd1cf86a9f1a56d86c83d77e336ea5aed Mon Sep 17 00:00:00 2001 From: Jessica Lynn Suttles Date: Mon, 10 Mar 2014 12:26:24 -0700 Subject: [PATCH 12/36] Add specs for Microformats2::AbsoluteUri --- lib/microformats2/absolute_uri.rb | 2 +- spec/lib/microformats2/absolute_uri_spec.rb | 73 +++++++++++++++++++++ 2 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 spec/lib/microformats2/absolute_uri_spec.rb diff --git a/lib/microformats2/absolute_uri.rb b/lib/microformats2/absolute_uri.rb index 13eafad..a28e0d0 100644 --- a/lib/microformats2/absolute_uri.rb +++ b/lib/microformats2/absolute_uri.rb @@ -19,7 +19,7 @@ module Microformats2 uri.normalize! uri.to_s - rescue URI::InvalidURIError => e + rescue URI::BadURIError, URI::InvalidURIError => e relative.to_s end end diff --git a/spec/lib/microformats2/absolute_uri_spec.rb b/spec/lib/microformats2/absolute_uri_spec.rb new file mode 100644 index 0000000..4aa8a08 --- /dev/null +++ b/spec/lib/microformats2/absolute_uri_spec.rb @@ -0,0 +1,73 @@ +require "spec_helper" +require "microformats2/absolute_uri" + +describe Microformats2::AbsoluteUri do + let(:subject) { Microformats2::AbsoluteUri } + + describe "#absolutize" do + context "when relative is nil" do + it "returns nil" do + base = nil + relative = nil + expect(subject.new(base, relative).absolutize).to be_nil + end + end + + context "when relative is an empty string" do + it "returns nil" do + base = nil + relative = "" + expect(subject.new(base, relative).absolutize).to be_nil + end + end + + context "when relative is a valid URI" do + context "and relative is absolute" do + it "returns normalized relative" do + base = nil + relative = "http://google.com" + result = "http://google.com/" + expect(subject.new(base, relative).absolutize).to eq result + end + end + + context "and relative is not absolute" do + context "and base is present but not absolute" do + it "returns normalized relative" do + base = "foo" + relative = "bar/qux" + result = "bar/qux" + expect(subject.new(base, relative).absolutize).to eq result + end + end + + context "and base is present and absolute" do + it "returns normalized base and relative joined" do + base = "http://google.com" + relative = "foo/bar" + result = "http://google.com/foo/bar" + expect(subject.new(base, relative).absolutize).to eq result + end + end + + context "and base is not present" do + it "returns normalized relative" do + base = nil + relative = "foo/bar" + result = "foo/bar" + expect(subject.new(base, relative).absolutize).to eq result + end + end + end + end + + context "when relative in an invliad URI" do + it "returns relative" do + base = nil + relative = "git@github.com:G5/microformats2.git" + result = "git@github.com:G5/microformats2.git" + expect(subject.new(base, relative).absolutize).to eq result + end + end + end +end From fd6ea19652971b5f2d613d13de745cd3e753ccec Mon Sep 17 00:00:00 2001 From: Don Petersen Date: Mon, 10 Mar 2014 20:54:22 +0000 Subject: [PATCH 13/36] Convert a spec to an explicit subject and lets. --- spec/lib/microformats2/absolute_uri_spec.rb | 91 ++++++++------------- 1 file changed, 33 insertions(+), 58 deletions(-) diff --git a/spec/lib/microformats2/absolute_uri_spec.rb b/spec/lib/microformats2/absolute_uri_spec.rb index 4aa8a08..56b4ee5 100644 --- a/spec/lib/microformats2/absolute_uri_spec.rb +++ b/spec/lib/microformats2/absolute_uri_spec.rb @@ -2,72 +2,47 @@ require "spec_helper" require "microformats2/absolute_uri" describe Microformats2::AbsoluteUri do - let(:subject) { Microformats2::AbsoluteUri } - describe "#absolutize" do + subject { Microformats2::AbsoluteUri.new(base, relative).absolutize } + let(:base) { nil } + context "when relative is nil" do - it "returns nil" do - base = nil - relative = nil - expect(subject.new(base, relative).absolutize).to be_nil - end + let(:relative) { nil } + it { should be_nil } end context "when relative is an empty string" do - it "returns nil" do - base = nil - relative = "" - expect(subject.new(base, relative).absolutize).to be_nil + let(:relative) { "" } + it { should be_nil } + end + + context "when relative is a valid absolute URI" do + let(:relative) { "http://google.com" } + it { should eq("http://google.com/") } + end + + context "when relative is a valid non-absolute URI" do + let(:relative) { "bar/qux" } + + context "and base is present but not absolute" do + let(:base) { "foo" } + it { should eq("bar/qux") } + end + + context "and base is present and absolute" do + let(:base) { "http://google.com" } + it { should eq("http://google.com/bar/qux") } + end + + context "and base is not present" do + let(:base) { nil } + it { should eq("bar/qux") } end end - context "when relative is a valid URI" do - context "and relative is absolute" do - it "returns normalized relative" do - base = nil - relative = "http://google.com" - result = "http://google.com/" - expect(subject.new(base, relative).absolutize).to eq result - end - end - - context "and relative is not absolute" do - context "and base is present but not absolute" do - it "returns normalized relative" do - base = "foo" - relative = "bar/qux" - result = "bar/qux" - expect(subject.new(base, relative).absolutize).to eq result - end - end - - context "and base is present and absolute" do - it "returns normalized base and relative joined" do - base = "http://google.com" - relative = "foo/bar" - result = "http://google.com/foo/bar" - expect(subject.new(base, relative).absolutize).to eq result - end - end - - context "and base is not present" do - it "returns normalized relative" do - base = nil - relative = "foo/bar" - result = "foo/bar" - expect(subject.new(base, relative).absolutize).to eq result - end - end - end - end - - context "when relative in an invliad URI" do - it "returns relative" do - base = nil - relative = "git@github.com:G5/microformats2.git" - result = "git@github.com:G5/microformats2.git" - expect(subject.new(base, relative).absolutize).to eq result - end + context "when relative is an invalid URI" do + let(:relative) { "git@github.com:G5/microformats2.git" } + it { should eq("git@github.com:G5/microformats2.git") } end end end From 840fdff624abd5eec6b956a62d897f49897cfa19 Mon Sep 17 00:00:00 2001 From: Jessica Lynn Suttles Date: Mon, 10 Mar 2014 15:56:27 -0700 Subject: [PATCH 14/36] Bump version to 2.0.1 --- README.md | 2 +- lib/microformats2/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9540cbc..d5da230 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ Not Implemented: ## Current Version -2.0.0 +2.0.1 ## Requirements diff --git a/lib/microformats2/version.rb b/lib/microformats2/version.rb index c89cf32..c47cce0 100644 --- a/lib/microformats2/version.rb +++ b/lib/microformats2/version.rb @@ -1,3 +1,3 @@ module Microformats2 - VERSION = "2.0.0" + VERSION = "2.0.1" end From 0734bc5c445117998b9749096a92c056653b2109 Mon Sep 17 00:00:00 2001 From: Jessica Lynn Suttles Date: Mon, 10 Mar 2014 16:12:55 -0700 Subject: [PATCH 15/36] Add .travis.yml campfire template --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 9f5a5f4..2cae312 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,5 +6,7 @@ notifications: campfire: rooms: secure: UlQ85ETcMVxrK6N9E1zcNPYZ+7as8TLkPS/ArOxytairh8W2S4BFyuCoVRgvLQ88RhHhGgTbkF14DiFtcCiXu9hmfZFZY54q92Sk/Lf98mz1Vzis6X+PedBUIVBPWCEPpMmLxAF+Q1HkEcVYQMKwNoAaQLrW+7SOzh57bOMxHeE= + template: + - "%{repository}#%{build_number} %{message} (%{branch} - %{commit} : %{author}) Change view : %{compare_url} Build details : %{build_url}" on_success: change on_failure: always From 96ed937040d3dd5da82c5826371ee001f7c5b3cd Mon Sep 17 00:00:00 2001 From: Barnaby Walters Date: Wed, 11 Jun 2014 16:45:17 +0000 Subject: [PATCH 16/36] Added usage examples of collection.to_hash and .to_json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As per @aaronpk wanting this feature to the point of considering creating a separate parser — turns out it is possible, just a little buried! --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index d5da230..f891f25 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,12 @@ collection = Microformats2.parse(source) collection.entry.name.to_s #=> "Microformats 2" # accessing nested microformats collection.entry.author.format.name.to_s #=> "Jessica Lynn Suttles" + +# getting a copy of the canonical microformats2 hash structure +collection.to_hash + +# the above, as JSON in a string +collection.to_json ``` * `source` can be a URL, filepath, or HTML From 1e9e65cf9e0bcc5a489883b890d57ebd7d269434 Mon Sep 17 00:00:00 2001 From: Michael Mitchell Date: Mon, 10 Aug 2015 10:56:06 -0700 Subject: [PATCH 17/36] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f891f25..f6620f4 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Microformats2 - +# NO LONGER MAINTAINED [![Build Status](https://travis-ci.org/G5/microformats2.png?branch=master)](https://travis-ci.org/G5/microformats2) [![Code Climate](https://codeclimate.com/github/G5/microformats2.png)](https://codeclimate.com/github/G5/microformats2) From 6c90f01ae74e30d55449095c9ee62ddc38d8d106 Mon Sep 17 00:00:00 2001 From: Jeena Date: Fri, 21 Aug 2015 21:17:54 +0200 Subject: [PATCH 18/36] Resolve relative URLs (bugfix) When the 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 tags. --- lib/microformats2/format.rb | 4 ++-- lib/microformats2/implied_property/photo.rb | 4 ++++ lib/microformats2/property/foundation.rb | 2 +- lib/microformats2/property/url.rb | 3 ++- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/microformats2/format.rb b/lib/microformats2/format.rb index 74ba975..7d09deb 100644 --- a/lib/microformats2/format.rb +++ b/lib/microformats2/format.rb @@ -40,9 +40,9 @@ module Microformats2 def parse_implied_properties 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::Photo.new(@element).parse unless property_present?(:photo) + ip << ImpliedProperty::Photo.new(@element, @base).parse unless property_present?(:photo) ip.compact.each do |property| save_property_name(property.method_name) define_method(property.method_name) diff --git a/lib/microformats2/implied_property/photo.rb b/lib/microformats2/implied_property/photo.rb index 2dc2676..41e4d3f 100644 --- a/lib/microformats2/implied_property/photo.rb +++ b/lib/microformats2/implied_property/photo.rb @@ -6,6 +6,10 @@ module Microformats2 "photo" end + def to_s + @to_s = Microformats2::AbsoluteUri.new(@base, super.to_s).absolutize + end + protected def name_map diff --git a/lib/microformats2/property/foundation.rb b/lib/microformats2/property/foundation.rb index 8851f8e..3ba5bb4 100644 --- a/lib/microformats2/property/foundation.rb +++ b/lib/microformats2/property/foundation.rb @@ -25,7 +25,7 @@ module Microformats2 end def formats - @formats ||= format_classes.length >=1 ? FormatParser.parse(@element) : [] + @formats ||= format_classes.length >=1 ? FormatParser.parse(@element, @base) : [] end def to_hash diff --git a/lib/microformats2/property/url.rb b/lib/microformats2/property/url.rb index c86c6b6..c213ebf 100644 --- a/lib/microformats2/property/url.rb +++ b/lib/microformats2/property/url.rb @@ -15,7 +15,8 @@ module Microformats2 "img" => "src", "object" => "data", "abbr" => "title", - "data" => "value" } + "data" => "value", + "input" => "value" } end end end From baf6060dfba62a1ce236c6043199dc37725b7fa3 Mon Sep 17 00:00:00 2001 From: Shane Becker Date: Tue, 22 Dec 2015 14:46:14 -0800 Subject: [PATCH 19/36] Change /g5 links to /indieweb in README --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f6620f4..dd9ae2f 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Microformats2 # NO LONGER MAINTAINED -[![Build Status](https://travis-ci.org/G5/microformats2.png?branch=master)](https://travis-ci.org/G5/microformats2) -[![Code Climate](https://codeclimate.com/github/G5/microformats2.png)](https://codeclimate.com/github/G5/microformats2) +[![Build Status](https://travis-ci.org/indieweb/microformats2-ruby.png?branch=master)](https://travis-ci.org/indieweb/microformats2-ruby) +[![Code Climate](https://codeclimate.com/github/indieweb/microformats2-ruby.png)](https://codeclimate.com/github/G5indieweb/microformats2-ruby) A Ruby gem to parse HTML containing one or more [microformats2](http://microformats.org/wiki/microformats-2) and return a collection of dynamically defined Ruby objects. @@ -107,7 +107,7 @@ collection.to_json 7. Create new Pull Request If you find bugs, have feature requests or questions, please -[file an issue](https://github.com/G5/microformats2/issues). +[file an issue](https://github.com/indieweb/microformats2-ruby/issues). ## Specs From a7dcd994b8a0b6a5b008fd89d666128751478a82 Mon Sep 17 00:00:00 2001 From: Shane Becker Date: Tue, 22 Dec 2015 14:49:35 -0800 Subject: [PATCH 20/36] Update Code Climate badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dd9ae2f..b592ca6 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # Microformats2 # NO LONGER MAINTAINED [![Build Status](https://travis-ci.org/indieweb/microformats2-ruby.png?branch=master)](https://travis-ci.org/indieweb/microformats2-ruby) -[![Code Climate](https://codeclimate.com/github/indieweb/microformats2-ruby.png)](https://codeclimate.com/github/G5indieweb/microformats2-ruby) +[![Code Climate](https://codeclimate.com/github/indieweb/microformats2-ruby/badges/gpa.svg)](https://codeclimate.com/github/indieweb/microformats2-ruby) A Ruby gem to parse HTML containing one or more [microformats2](http://microformats.org/wiki/microformats-2) and return a collection of dynamically defined Ruby objects. From 82f2b13dc2d010eb0aa17263cede8553abc04bd1 Mon Sep 17 00:00:00 2001 From: Shane Becker Date: Tue, 22 Dec 2015 15:14:18 -0800 Subject: [PATCH 21/36] Change license to CC0. --- README.md | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index b592ca6..56e1e57 100644 --- a/README.md +++ b/README.md @@ -131,25 +131,6 @@ guard ## License -Copyright (c) 2013 G5 +Microformats2 is dedicated to the public domain using Creative Commons -- CC0 1.0 Universal. -MIT License - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +http://creativecommons.org/publicdomain/zero/1.0 From aff63658cef56b19b8d1a3d5b1dbca3173c65610 Mon Sep 17 00:00:00 2001 From: Shane Becker Date: Tue, 22 Dec 2015 15:33:22 -0800 Subject: [PATCH 22/36] Change license file to CC0. --- LICENSE.md | 36 ++++++++++++++++++++++++++++++++++++ LICENSE.txt | 22 ---------------------- 2 files changed, 36 insertions(+), 22 deletions(-) create mode 100644 LICENSE.md delete mode 100644 LICENSE.txt diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..1e4777b --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,36 @@ +# Creative Commons Legal Code + +## CC0 1.0 Universal + +http://creativecommons.org/publicdomain/zero/1.0 + +Official translations of this legal tool are available> CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED HEREUNDER. + +### _Statement of Purpose_ + +The laws of most jurisdictions throughout the world automatically confer exclusive Copyright and Related Rights (defined below) upon the creator and subsequent owner(s) (each and all, an "owner") of an original work of authorship and/or a database (each, a "Work"). + +Certain owners wish to permanently relinquish those rights to a Work for the purpose of contributing to a commons of creative, cultural and scientific works ("Commons") that the public can reliably and without fear of later claims of infringement build upon, modify, incorporate in other works, reuse and redistribute as freely as possible in any form whatsoever and for any purposes, including without limitation commercial purposes. These owners may contribute to the Commons to promote the ideal of a free culture and the further production of creative, cultural and scientific works, or to gain reputation or greater distribution for their Work in part through the use and efforts of others. + +For these and/or other purposes and motivations, and without any expectation of additional consideration or compensation, the person associating CC0 with a Work (the "Affirmer"), to the extent that he or she is an owner of Copyright and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and publicly distribute the Work under its terms, with knowledge of his or her Copyright and Related Rights in the Work and the meaning and intended legal effect of CC0 on those rights. + +**1. Copyright and Related Rights.** A Work made available under CC0 may be protected by copyright and related or neighboring rights ("Copyright and Related Rights"). Copyright and Related Rights include, but are not limited to, the following: + +1. the right to reproduce, adapt, distribute, perform, display, communicate, and translate a Work; +2. moral rights retained by the original author(s) and/or performer(s); +3. publicity and privacy rights pertaining to a person's image or likeness depicted in a Work; +4. rights protecting against unfair competition in regards to a Work, subject to the limitations in paragraph 4(a), below; +5. rights protecting the extraction, dissemination, use and reuse of data in a Work; +6. database rights (such as those arising under Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, and under any national implementation thereof, including any amended or successor version of such directive); and +7. other similar, equivalent or corresponding rights throughout the world based on applicable law or treaty, and any national implementations thereof. + +**2. Waiver.** To the greatest extent permitted by, but not in contravention of, applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and unconditionally waives, abandons, and surrenders all of Affirmer's Copyright and Related Rights and associated claims and causes of action, whether now known or unknown (including existing as well as future claims and causes of action), in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each member of the public at large and to the detriment of Affirmer's heirs and successors, fully intending that such Waiver shall not be subject to revocation, rescission, cancellation, termination, or any other legal or equitable action to disrupt the quiet enjoyment of the Work by the public as contemplated by Affirmer's express Statement of Purpose. + +**3. Public License Fallback.** Should any part of the Waiver for any reason be judged legally invalid or ineffective under applicable law, then the Waiver shall be preserved to the maximum extent permitted taking into account Affirmer's express Statement of Purpose. In addition, to the extent the Waiver is so judged Affirmer hereby grants to each affected person a royalty-free, non transferable, non sublicensable, non exclusive, irrevocable and unconditional license to exercise Affirmer's Copyright and Related Rights in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "License"). The License shall be deemed effective as of the date CC0 was applied by Affirmer to the Work. Should any part of the License for any reason be judged legally invalid or ineffective under applicable law, such partial invalidity or ineffectiveness shall not invalidate the remainder of the License, and in such case Affirmer hereby affirms that he or she will not (i) exercise any of his or her remaining Copyright and Related Rights in the Work or (ii) assert any associated claims and causes of action with respect to the Work, in either case contrary to Affirmer's express Statement of Purpose. + +**4. Limitations and Disclaimers.** + +1. No trademark or patent rights held by Affirmer are waived, abandoned, surrendered, licensed or otherwise affected by this document. +2. Affirmer offers the Work as-is and makes no representations or warranties of any kind concerning the Work, express, implied, statutory or otherwise, including without limitation warranties of title, merchantability, fitness for a particular purpose, non infringement, or the absence of latent or other defects, accuracy, or the present or absence of errors, whether or not discoverable, all to the greatest extent permissible under applicable law. +3. Affirmer disclaims responsibility for clearing rights of other persons that may apply to the Work or any use thereof, including without limitation any person's Copyright and Related Rights in the Work. Further, Affirmer disclaims responsibility for obtaining any necessary consents, permissions or other rights required for any use of the Work. +4. Affirmer understands and acknowledges that Creative Commons is not a party to this document and has no duty or obligation with respect to this CC0 or use of the Work. diff --git a/LICENSE.txt b/LICENSE.txt deleted file mode 100644 index d450ba1..0000000 --- a/LICENSE.txt +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2013 G5 - -MIT License - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. From 59a316712a011282747d0b84b7d2c1e377ce8c3a Mon Sep 17 00:00:00 2001 From: Shane Becker Date: Tue, 22 Dec 2015 15:37:21 -0800 Subject: [PATCH 23/36] Add me to authors list in gemspec --- microformats2.gemspec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/microformats2.gemspec b/microformats2.gemspec index 5c5dff1..d7320a5 100644 --- a/microformats2.gemspec +++ b/microformats2.gemspec @@ -6,8 +6,8 @@ require 'microformats2/version' Gem::Specification.new do |gem| gem.name = "microformats2" gem.version = Microformats2::VERSION - gem.authors = ["Jessica Lynn Suttles", "Jessica Dillon"] - gem.email = ["jlsuttles@gmail.com", "jessicard@mac.com"] + gem.authors = ["Shane Becker", "Jessica Lynn Suttles", "Jessica Dillon"] + gem.email = ["veganstraightedge@gmail.com", "jlsuttles@gmail.com", "jessicard@mac.com"] gem.description = %q{parses HTML for microformats and return a collection of dynamically defined Ruby objects} gem.summary = %q{microformats2 parser} gem.homepage = "https://github.com/G5/microformats2" From 22f5de54ddff4b6472f5267ce7975774a1481e64 Mon Sep 17 00:00:00 2001 From: Shane Becker Date: Tue, 22 Dec 2015 15:37:49 -0800 Subject: [PATCH 24/36] Capitalize gem description --- microformats2.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/microformats2.gemspec b/microformats2.gemspec index d7320a5..0973001 100644 --- a/microformats2.gemspec +++ b/microformats2.gemspec @@ -8,7 +8,7 @@ Gem::Specification.new do |gem| gem.version = Microformats2::VERSION gem.authors = ["Shane Becker", "Jessica Lynn Suttles", "Jessica Dillon"] gem.email = ["veganstraightedge@gmail.com", "jlsuttles@gmail.com", "jessicard@mac.com"] - gem.description = %q{parses HTML for microformats and return a collection of dynamically defined Ruby objects} + gem.description = %q{Parses HTML for microformats and return a collection of dynamically defined Ruby objects} gem.summary = %q{microformats2 parser} gem.homepage = "https://github.com/G5/microformats2" From 5dcc2df60dc4740426a80ad0bd497cea96b15dac Mon Sep 17 00:00:00 2001 From: Shane Becker Date: Tue, 22 Dec 2015 16:12:42 -0800 Subject: [PATCH 25/36] Remove campfire notifications --- .travis.yml | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2cae312..dac7d1f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,4 @@ language: ruby rvm: - - 1.9.3 + - 2.2.3 script: bundle exec rspec -notifications: - campfire: - rooms: - secure: UlQ85ETcMVxrK6N9E1zcNPYZ+7as8TLkPS/ArOxytairh8W2S4BFyuCoVRgvLQ88RhHhGgTbkF14DiFtcCiXu9hmfZFZY54q92Sk/Lf98mz1Vzis6X+PedBUIVBPWCEPpMmLxAF+Q1HkEcVYQMKwNoAaQLrW+7SOzh57bOMxHeE= - template: - - "%{repository}#%{build_number} %{message} (%{branch} - %{commit} : %{author}) Change view : %{compare_url} Build details : %{build_url}" - on_success: change - on_failure: always From 412a94e576328d3f1c03ff0c6eff6ac3f72adc01 Mon Sep 17 00:00:00 2001 From: Shane Becker Date: Tue, 22 Dec 2015 16:52:52 -0800 Subject: [PATCH 26/36] Remove reference to G5 --- microformats2.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/microformats2.gemspec b/microformats2.gemspec index 0973001..f306a2e 100644 --- a/microformats2.gemspec +++ b/microformats2.gemspec @@ -10,7 +10,7 @@ Gem::Specification.new do |gem| gem.email = ["veganstraightedge@gmail.com", "jlsuttles@gmail.com", "jessicard@mac.com"] gem.description = %q{Parses HTML for microformats and return a collection of dynamically defined Ruby objects} gem.summary = %q{microformats2 parser} - gem.homepage = "https://github.com/G5/microformats2" + gem.homepage = "https://github.com/indieweb/microformats2-ruby" gem.files = `git ls-files`.split($/) gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) } From bba83be9b479efb11380e2d33b29305ed888dda2 Mon Sep 17 00:00:00 2001 From: Shane Becker Date: Tue, 22 Dec 2015 16:55:41 -0800 Subject: [PATCH 27/36] Remove reference to G5 --- spec/lib/microformats2/absolute_uri_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/lib/microformats2/absolute_uri_spec.rb b/spec/lib/microformats2/absolute_uri_spec.rb index 56b4ee5..4ec4d8e 100644 --- a/spec/lib/microformats2/absolute_uri_spec.rb +++ b/spec/lib/microformats2/absolute_uri_spec.rb @@ -41,8 +41,8 @@ describe Microformats2::AbsoluteUri do end context "when relative is an invalid URI" do - let(:relative) { "git@github.com:G5/microformats2.git" } - it { should eq("git@github.com:G5/microformats2.git") } + let(:relative) { "git@github.com:indieweb/microformats2-ruby.git" } + it { should eq("git@github.com:indieweb/microformats2-ruby.git") } end end end From dc884bdc2b13610393f56c8275b814c8c25fc5af Mon Sep 17 00:00:00 2001 From: Shane Becker Date: Wed, 23 Dec 2015 11:56:37 -0800 Subject: [PATCH 28/36] Status update --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 56e1e57..d2f2e7b 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ # Microformats2 -# NO LONGER MAINTAINED + +# Development Status + +This gem sat unmaintained for quite a long time. It's now under new management. Work will begin shortly on getting it on par with the other Microformats2 parsers and the current state of the spec. (2015-12-23) + [![Build Status](https://travis-ci.org/indieweb/microformats2-ruby.png?branch=master)](https://travis-ci.org/indieweb/microformats2-ruby) [![Code Climate](https://codeclimate.com/github/indieweb/microformats2-ruby/badges/gpa.svg)](https://codeclimate.com/github/indieweb/microformats2-ruby) From 7647446ea8ade615ce46d561f9ae4022bf77bf88 Mon Sep 17 00:00:00 2001 From: Shane Becker Date: Wed, 23 Dec 2015 12:28:22 -0800 Subject: [PATCH 29/36] Clean up README And remove Guard command --- README.md | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index d2f2e7b..81ab282 100644 --- a/README.md +++ b/README.md @@ -42,24 +42,30 @@ Not Implemented: ## Requirements -* "nokogiri" -* "json" -* "activesupport" +* [nokogiri](https://github.com/sparklemotion/nokogiri) +* [json](https://github.com/flori/json) +* [activesupport](https://github.com/rails/rails/tree/master/activesupport) ## Installation Add this line to your application's Gemfile: - gem 'microformats2' +```ruby +gem "microformats2" +``` And then execute: - $ bundle +``` +bundle +``` Or install it yourself as: - $ gem install microformats2 +``` +gem install microformats2 +``` ## Usage @@ -67,17 +73,17 @@ Or install it yourself as: ```ruby require "microformats2" -source = '

Jessica Lynn Suttles

' +source = "

Jessica Lynn Suttles

" collection = Microformats2.parse(source) # using singular accessors collection.card.name.to_s #=> "Jessica Lynn Suttles" # using plural accessors collection.cards.first.names.first.to_s #=> "Jessica Lynn Suttles" -source = '
-

Microformats 2

-

Jessica Lynn Suttles

-
' +source = "
+

Microformats 2

+

Jessica Lynn Suttles

+
" collection = Microformats2.parse(source) collection.entry.name.to_s #=> "Microformats 2" # accessing nested microformats @@ -100,6 +106,7 @@ collection.to_json * Michael Mitchell / [@variousred](https://github.com/variousred) * Jessica Dillon / [@jessicard](https://github.com/jessicard) + ## Contributions 1. Fork it @@ -118,18 +125,13 @@ If you find bugs, have feature requests or questions, please To update spec cases that are scraped from other sites. **Warning:** This could break specs. -```bash +``` rake specs:update ``` To run specs -```bash -rake spec ``` - -To keep specs running -```bash -guard +rake spec ``` From b6b37b07001923b9863817f4a4ea47a35a1d9e64 Mon Sep 17 00:00:00 2001 From: Shane Becker Date: Wed, 23 Dec 2015 12:34:07 -0800 Subject: [PATCH 30/36] Add TODO for using the mf2 test suite --- README.md | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 81ab282..bec75c9 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,16 @@ # Microformats2 -# Development Status - -This gem sat unmaintained for quite a long time. It's now under new management. Work will begin shortly on getting it on par with the other Microformats2 parsers and the current state of the spec. (2015-12-23) - [![Build Status](https://travis-ci.org/indieweb/microformats2-ruby.png?branch=master)](https://travis-ci.org/indieweb/microformats2-ruby) [![Code Climate](https://codeclimate.com/github/indieweb/microformats2-ruby/badges/gpa.svg)](https://codeclimate.com/github/indieweb/microformats2-ruby) A Ruby gem to parse HTML containing one or more [microformats2](http://microformats.org/wiki/microformats-2) and return a collection of dynamically defined Ruby objects. + +## Development Status + +This gem sat unmaintained for quite a long time. It's now under new management. Work will begin shortly on getting it on par with the other Microformats2 parsers and the current state of the spec. (2015-12-23) + A work in progress. Implemented: @@ -123,6 +124,8 @@ If you find bugs, have feature requests or questions, please ## Specs +*TODO* remove this and use the [microformats tests repo](https://github.com/microformats/tests) instead. + To update spec cases that are scraped from other sites. **Warning:** This could break specs. ``` From 7b62671ad24ee8222263d54df48cab980a6796ab Mon Sep 17 00:00:00 2001 From: Shane Becker Date: Wed, 23 Dec 2015 12:35:04 -0800 Subject: [PATCH 31/36] Bold is **, not * --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bec75c9..63c8f3c 100644 --- a/README.md +++ b/README.md @@ -124,7 +124,7 @@ If you find bugs, have feature requests or questions, please ## Specs -*TODO* remove this and use the [microformats tests repo](https://github.com/microformats/tests) instead. +**TODO** remove this and use the [microformats tests repo](https://github.com/microformats/tests) instead. To update spec cases that are scraped from other sites. **Warning:** This could break specs. From 6edf5721d143011e45386e8183fc259263cf1869 Mon Sep 17 00:00:00 2001 From: Shane Becker Date: Wed, 23 Dec 2015 12:37:54 -0800 Subject: [PATCH 32/36] Update name --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 63c8f3c..8cf5149 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Microformats2 +# Microformats2 (ruby) [![Build Status](https://travis-ci.org/indieweb/microformats2-ruby.png?branch=master)](https://travis-ci.org/indieweb/microformats2-ruby) [![Code Climate](https://codeclimate.com/github/indieweb/microformats2-ruby/badges/gpa.svg)](https://codeclimate.com/github/indieweb/microformats2-ruby) @@ -140,6 +140,6 @@ rake spec ## License -Microformats2 is dedicated to the public domain using Creative Commons -- CC0 1.0 Universal. +Microformats2 (ruby) is dedicated to the public domain using Creative Commons -- CC0 1.0 Universal. http://creativecommons.org/publicdomain/zero/1.0 From 086bed9d54a21b060969671c54b8b00c64846645 Mon Sep 17 00:00:00 2001 From: Christian Kruse Date: Fri, 19 Feb 2016 21:40:17 +0100 Subject: [PATCH 33/36] fix: typo compatable -> compatible --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8cf5149..3585c00 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ Not Implemented: * [value-class-pattern](http://microformats.org/wiki/value-class-pattern) * [include-pattern](http://microformats.org/wiki/include-pattern) * recognition of [vendor extensions](http://microformats.org/wiki/microformats2#VENDOR_EXTENSIONS) -* backwards compatable support for microformats v1 +* backwards compatible support for microformats v1 ## Current Version From a54c64034ddf562bba7b0ebc30cf483ec92502d2 Mon Sep 17 00:00:00 2001 From: Jeena Date: Sun, 24 Apr 2016 01:28:27 +0200 Subject: [PATCH 34/36] Don't crash if it's not possible to attach to property Normally one can attach to properties, but if it is of a type URL then it crashes hard. This check just drops everything which can't be attached by `<<`. --- lib/microformats2/format.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/microformats2/format.rb b/lib/microformats2/format.rb index 7d09deb..caaeca1 100644 --- a/lib/microformats2/format.rb +++ b/lib/microformats2/format.rb @@ -102,7 +102,7 @@ module Microformats2 send("#{mn}=", value) end if current = send(mn.pluralize) - current << value + current << value if current.respond_to? :<< else send("#{mn.pluralize}=", [value]) end From 945ffe6c6e16d9bc9829ee06677666575717e5bc Mon Sep 17 00:00:00 2001 From: Shane Becker Date: Wed, 4 May 2016 14:07:03 -0700 Subject: [PATCH 35/36] Version bump to 2.0.2 --- README.md | 8 +++++--- lib/microformats2/version.rb | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 3585c00..399ccd7 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ and return a collection of dynamically defined Ruby objects. ## Development Status -This gem sat unmaintained for quite a long time. It's now under new management. Work will begin shortly on getting it on par with the other Microformats2 parsers and the current state of the spec. (2015-12-23) +This gem sat unmaintained for quite a long time. It's now under new management. Work will begin shortly on getting it on par with the other Microformats2 parsers and the current state of the spec. (2015-12-23) A work in progress. @@ -38,7 +38,9 @@ Not Implemented: ## Current Version -2.0.1 +2.0.2 + +![Version 2.0.2](https://img.shields.io/badge/VERSION-2.0.2-green.svg) ## Requirements @@ -124,7 +126,7 @@ If you find bugs, have feature requests or questions, please ## Specs -**TODO** remove this and use the [microformats tests repo](https://github.com/microformats/tests) instead. +**TODO** remove this and use the [microformats tests repo](https://github.com/microformats/tests) instead. To update spec cases that are scraped from other sites. **Warning:** This could break specs. diff --git a/lib/microformats2/version.rb b/lib/microformats2/version.rb index c47cce0..09f358f 100644 --- a/lib/microformats2/version.rb +++ b/lib/microformats2/version.rb @@ -1,3 +1,3 @@ module Microformats2 - VERSION = "2.0.1" + VERSION = "2.0.2" end From f78162fd41cc4f0aa9df0e5273da4ee34cd0cc9f Mon Sep 17 00:00:00 2001 From: Jeena Date: Wed, 3 Aug 2016 21:34:49 +0200 Subject: [PATCH 36/36] While parsing check for existance of attribute When parsing rel attributes, check for existance of the href attribute before extracting the text, sometimes like in this post somewhere https://www.patreon.com/posts/jeenas-excellent-6467133 it might be empty and causes an exception. All the other uses above this one check that too. --- lib/microformats2/collection.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/microformats2/collection.rb b/lib/microformats2/collection.rb index 5ed43e0..f33b0cf 100644 --- a/lib/microformats2/collection.rb +++ b/lib/microformats2/collection.rb @@ -103,7 +103,9 @@ module Microformats2 else rel_values.each do |rel_value| @rels[rel_value] = [] unless @rels.has_key?(rel_value) - @rels[rel_value] << Microformats2::AbsoluteUri.new(@base, rel.attribute("href").text).absolutize + unless rel.attribute("href").nil? + @rels[rel_value] << Microformats2::AbsoluteUri.new(@base, rel.attribute("href").text).absolutize + end end end end