microformats 0.3 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +18 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/Guardfile +5 -0
- data/LICENSE.md +36 -0
- data/README.md +228 -0
- data/Rakefile +7 -25
- data/lib/microformats.rb +25 -9
- data/lib/microformats/absolute_uri.rb +30 -0
- data/lib/microformats/format_parser.rb +343 -0
- data/lib/microformats/parser.rb +105 -0
- data/lib/microformats/parser_core.rb +343 -0
- data/lib/microformats/property_parser.rb +122 -0
- data/lib/microformats/results/collection.rb +121 -0
- data/lib/microformats/results/parser_result.rb +111 -0
- data/lib/microformats/results/property_set.rb +87 -0
- data/lib/microformats/time_property_parser.rb +161 -0
- data/lib/microformats/version.rb +3 -0
- data/microformats.gemspec +37 -0
- data/spec/lib/microformats/absolute_uri_spec.rb +48 -0
- data/spec/lib/microformats/parser_spec.rb +72 -0
- data/spec/lib/microformats_spec.rb +33 -0
- data/spec/spec_helper.rb +10 -0
- data/spec/support/cases/microformats.org/microformats-2/microformats-2-0.html +2 -0
- data/spec/support/cases/microformats.org/microformats-2/microformats-2-0.js +9 -0
- data/spec/support/cases/microformats.org/microformats-2/microformats-2-1.html +2 -0
- data/spec/support/cases/microformats.org/microformats-2/microformats-2-1.js +10 -0
- data/spec/support/cases/microformats.org/microformats-2/microformats-2-2.html +5 -0
- data/spec/support/cases/microformats.org/microformats-2/microformats-2-2.js +11 -0
- data/spec/support/cases/microformats.org/microformats-2/microformats-2-3.html +17 -0
- data/spec/support/cases/microformats.org/microformats-2/microformats-2-3.js +20 -0
- data/spec/support/cases/microformats.org/microformats-2/microformats-2-4.html +16 -0
- data/spec/support/cases/microformats.org/microformats-2/microformats-2-4.js +24 -0
- data/spec/support/cases/microformats.org/microformats-2/microformats-2-5.html +7 -0
- data/spec/support/cases/microformats.org/microformats-2/microformats-2-5.js +11 -0
- data/spec/support/cases/microformats.org/microformats-2/microformats-2-6.html +9 -0
- data/spec/support/cases/microformats.org/microformats-2/microformats-2-6.js +18 -0
- data/spec/support/cases/microformats.org/microformats-2/microformats-2-7.html +9 -0
- data/spec/support/cases/microformats.org/microformats-2/microformats-2-7.js +18 -0
- data/spec/support/cases/microformats.org/microformats-2/microformats-2-8.html +9 -0
- data/spec/support/cases/microformats.org/microformats-2/microformats-2-8.js +17 -0
- data/spec/support/cases/microformats.org/microformats-2/microformats-2-9.html +9 -0
- data/spec/support/cases/microformats.org/microformats-2/microformats-2-9.js +17 -0
- data/spec/support/lib/microformats/implied_property/name-fail.html +60 -0
- data/spec/support/lib/microformats/implied_property/name-pass.html +30 -0
- data/spec/support/lib/microformats/implied_property/photo-fail.html +60 -0
- data/spec/support/lib/microformats/implied_property/photo-pass.html +30 -0
- data/spec/support/lib/microformats/implied_property/url-fail.html +18 -0
- data/spec/support/lib/microformats/implied_property/url-pass.html +12 -0
- data/spec/support/lib/microformats/implied_property/url-relative.html +13 -0
- data/spec/support/lib/microformats/implied_property/url-unnormalized.html +12 -0
- data/spec/support/lib/microformats/nested-format-with-property-of-same-name.html +13 -0
- data/spec/support/lib/microformats/nested-format-with-property-of-same-name.js +16 -0
- data/spec/support/lib/microformats/nested-format-with-property.html +12 -0
- data/spec/support/lib/microformats/nested-format-with-property.js +16 -0
- data/spec/support/lib/microformats/nested-format-without-property.html +13 -0
- data/spec/support/lib/microformats/nested-property.html +12 -0
- data/spec/support/lib/microformats/nested-property.js +10 -0
- data/spec/support/lib/microformats/rels-that-drop-the-base.html +11 -0
- data/spec/support/lib/microformats/rels-with-unnormalized-urls.html +11 -0
- data/spec/support/lib/microformats/rels.html +12 -0
- data/spec/support/lib/microformats/rels.js +13 -0
- data/spec/support/lib/microformats/simple.html +23 -0
- data/spec/support/lib/microformats/simple.js +11 -0
- data/vendor/tests/.gitignore +25 -0
- data/vendor/tests/LICENSE.md +36 -0
- data/vendor/tests/README.md +48 -0
- data/vendor/tests/app.js +84 -0
- data/vendor/tests/composer.json +5 -0
- data/vendor/tests/css/testsuite.css +159 -0
- data/vendor/tests/interface.js +18 -0
- data/vendor/tests/package.json +27 -0
- data/vendor/tests/tests/microformats-mixed/h-card/change-log.html +63 -0
- data/vendor/tests/tests/microformats-mixed/h-card/mixedpropertries.html +14 -0
- data/vendor/tests/tests/microformats-mixed/h-card/mixedpropertries.json +22 -0
- data/vendor/tests/tests/microformats-mixed/h-card/tworoots.html +1 -0
- data/vendor/tests/tests/microformats-mixed/h-card/tworoots.json +10 -0
- data/vendor/tests/tests/microformats-mixed/h-entry/mixedroots.html +16 -0
- data/vendor/tests/tests/microformats-mixed/h-entry/mixedroots.json +38 -0
- data/vendor/tests/tests/microformats-mixed/h-resume/change-log.html +68 -0
- data/vendor/tests/tests/microformats-mixed/h-resume/mixedroots.html +16 -0
- data/vendor/tests/tests/microformats-mixed/h-resume/mixedroots.json +31 -0
- data/vendor/tests/tests/microformats-v1/adr/change-log.html +63 -0
- data/vendor/tests/tests/microformats-v1/adr/simpleproperties.html +8 -0
- data/vendor/tests/tests/microformats-v1/adr/simpleproperties.json +15 -0
- data/vendor/tests/tests/microformats-v1/geo/abbrpattern.html +5 -0
- data/vendor/tests/tests/microformats-v1/geo/abbrpattern.json +11 -0
- data/vendor/tests/tests/microformats-v1/geo/change-log.1.html +78 -0
- data/vendor/tests/tests/microformats-v1/geo/change-log.html +63 -0
- data/vendor/tests/tests/microformats-v1/geo/hidden.html +10 -0
- data/vendor/tests/tests/microformats-v1/geo/hidden.json +11 -0
- data/vendor/tests/tests/microformats-v1/geo/simpleproperties.html +6 -0
- data/vendor/tests/tests/microformats-v1/geo/simpleproperties.json +11 -0
- data/vendor/tests/tests/microformats-v1/geo/valuetitleclass.html +11 -0
- data/vendor/tests/tests/microformats-v1/geo/valuetitleclass.json +11 -0
- data/vendor/tests/tests/microformats-v1/hcalendar/ampm.html +41 -0
- data/vendor/tests/tests/microformats-v1/hcalendar/ampm.json +21 -0
- data/vendor/tests/tests/microformats-v1/hcalendar/attendees.html +13 -0
- data/vendor/tests/tests/microformats-v1/hcalendar/attendees.json +37 -0
- data/vendor/tests/tests/microformats-v1/hcalendar/change-log.html +68 -0
- data/vendor/tests/tests/microformats-v1/hcalendar/combining.html +15 -0
- data/vendor/tests/tests/microformats-v1/hcalendar/combining.json +31 -0
- data/vendor/tests/tests/microformats-v1/hcalendar/concatenate.html +7 -0
- data/vendor/tests/tests/microformats-v1/hcalendar/concatenate.json +12 -0
- data/vendor/tests/tests/microformats-v1/hcalendar/time.html +44 -0
- data/vendor/tests/tests/microformats-v1/hcalendar/time.json +22 -0
- data/vendor/tests/tests/microformats-v1/hcard/change-log.html +68 -0
- data/vendor/tests/tests/microformats-v1/hcard/email.html +14 -0
- data/vendor/tests/tests/microformats-v1/hcard/email.json +11 -0
- data/vendor/tests/tests/microformats-v1/hcard/format.html +6 -0
- data/vendor/tests/tests/microformats-v1/hcard/format.json +11 -0
- data/vendor/tests/tests/microformats-v1/hcard/hyperlinkedphoto.html +3 -0
- data/vendor/tests/tests/microformats-v1/hcard/hyperlinkedphoto.json +8 -0
- data/vendor/tests/tests/microformats-v1/hcard/justahyperlink.html +1 -0
- data/vendor/tests/tests/microformats-v1/hcard/justahyperlink.json +8 -0
- data/vendor/tests/tests/microformats-v1/hcard/justaname.html +1 -0
- data/vendor/tests/tests/microformats-v1/hcard/justaname.json +8 -0
- data/vendor/tests/tests/microformats-v1/hcard/multiple.html +74 -0
- data/vendor/tests/tests/microformats-v1/hcard/multiple.json +65 -0
- data/vendor/tests/tests/microformats-v1/hcard/name.html +11 -0
- data/vendor/tests/tests/microformats-v1/hcard/name.json +15 -0
- data/vendor/tests/tests/microformats-v1/hcard/single.html +14 -0
- data/vendor/tests/tests/microformats-v1/hcard/single.json +24 -0
- data/vendor/tests/tests/microformats-v1/hentry/change-log.html +73 -0
- data/vendor/tests/tests/microformats-v1/hentry/summarycontent.html +20 -0
- data/vendor/tests/tests/microformats-v1/hentry/summarycontent.json +24 -0
- data/vendor/tests/tests/microformats-v1/hfeed/simple.html +30 -0
- data/vendor/tests/tests/microformats-v1/hfeed/simple.json +49 -0
- data/vendor/tests/tests/microformats-v1/hnews/all.html +37 -0
- data/vendor/tests/tests/microformats-v1/hnews/all.json +74 -0
- data/vendor/tests/tests/microformats-v1/hnews/change-log.html +72 -0
- data/vendor/tests/tests/microformats-v1/hnews/minimum.html +25 -0
- data/vendor/tests/tests/microformats-v1/hnews/minimum.json +48 -0
- data/vendor/tests/tests/microformats-v1/hproduct/aggregate.html +26 -0
- data/vendor/tests/tests/microformats-v1/hproduct/aggregate.json +52 -0
- data/vendor/tests/tests/microformats-v1/hproduct/change-log.html +62 -0
- data/vendor/tests/tests/microformats-v1/hproduct/simpleproperties.html +13 -0
- data/vendor/tests/tests/microformats-v1/hproduct/simpleproperties.json +33 -0
- data/vendor/tests/tests/microformats-v1/hresume/affiliation.html +12 -0
- data/vendor/tests/tests/microformats-v1/hresume/affiliation.json +25 -0
- data/vendor/tests/tests/microformats-v1/hresume/change-log.html +73 -0
- data/vendor/tests/tests/microformats-v1/hresume/contact.html +18 -0
- data/vendor/tests/tests/microformats-v1/hresume/contact.json +32 -0
- data/vendor/tests/tests/microformats-v1/hresume/education.html +13 -0
- data/vendor/tests/tests/microformats-v1/hresume/education.json +29 -0
- data/vendor/tests/tests/microformats-v1/hresume/skill.html +12 -0
- data/vendor/tests/tests/microformats-v1/hresume/skill.json +33 -0
- data/vendor/tests/tests/microformats-v1/hresume/work.html +16 -0
- data/vendor/tests/tests/microformats-v1/hresume/work.json +30 -0
- data/vendor/tests/tests/microformats-v1/hreview-aggregate/change-log.html +67 -0
- data/vendor/tests/tests/microformats-v1/hreview-aggregate/hcard.html +18 -0
- data/vendor/tests/tests/microformats-v1/hreview-aggregate/hcard.json +31 -0
- data/vendor/tests/tests/microformats-v1/hreview-aggregate/justahyperlink.html +6 -0
- data/vendor/tests/tests/microformats-v1/hreview-aggregate/justahyperlink.json +19 -0
- data/vendor/tests/tests/microformats-v1/hreview-aggregate/vevent.html +13 -0
- data/vendor/tests/tests/microformats-v1/hreview-aggregate/vevent.json +22 -0
- data/vendor/tests/tests/microformats-v1/hreview/change-log.html +73 -0
- data/vendor/tests/tests/microformats-v1/hreview/item.html +8 -0
- data/vendor/tests/tests/microformats-v1/hreview/item.json +19 -0
- data/vendor/tests/tests/microformats-v1/hreview/vcard.html +23 -0
- data/vendor/tests/tests/microformats-v1/hreview/vcard.json +58 -0
- data/vendor/tests/tests/microformats-v1/includes/change-log.html +72 -0
- data/vendor/tests/tests/microformats-v1/includes/hcarditemref.html +16 -0
- data/vendor/tests/tests/microformats-v1/includes/hcarditemref.json +49 -0
- data/vendor/tests/tests/microformats-v1/includes/heventitemref.html +25 -0
- data/vendor/tests/tests/microformats-v1/includes/heventitemref.json +33 -0
- data/vendor/tests/tests/microformats-v1/includes/hyperlink.html +18 -0
- data/vendor/tests/tests/microformats-v1/includes/hyperlink.json +43 -0
- data/vendor/tests/tests/microformats-v1/includes/object.html +23 -0
- data/vendor/tests/tests/microformats-v1/includes/object.json +42 -0
- data/vendor/tests/tests/microformats-v1/includes/table.html +12 -0
- data/vendor/tests/tests/microformats-v1/includes/table.json +19 -0
- data/vendor/tests/tests/microformats-v2/h-adr/change-log.html +62 -0
- data/vendor/tests/tests/microformats-v2/h-adr/geo.html +10 -0
- data/vendor/tests/tests/microformats-v2/h-adr/geo.json +16 -0
- data/vendor/tests/tests/microformats-v2/h-adr/geourl.html +4 -0
- data/vendor/tests/tests/microformats-v2/h-adr/geourl.json +13 -0
- data/vendor/tests/tests/microformats-v2/h-adr/justaname.html +1 -0
- data/vendor/tests/tests/microformats-v2/h-adr/justaname.json +10 -0
- data/vendor/tests/tests/microformats-v2/h-adr/lettercase.html +21 -0
- data/vendor/tests/tests/microformats-v2/h-adr/lettercase.json +12 -0
- data/vendor/tests/tests/microformats-v2/h-adr/simpleproperties.html +8 -0
- data/vendor/tests/tests/microformats-v2/h-adr/simpleproperties.json +16 -0
- data/vendor/tests/tests/microformats-v2/h-as-note/note.html +56 -0
- data/vendor/tests/tests/microformats-v2/h-as-note/note.json +98 -0
- data/vendor/tests/tests/microformats-v2/h-card/baseurl.html +6 -0
- data/vendor/tests/tests/microformats-v2/h-card/baseurl.json +26 -0
- data/vendor/tests/tests/microformats-v2/h-card/change-log.html +100 -0
- data/vendor/tests/tests/microformats-v2/h-card/childimplied.html +7 -0
- data/vendor/tests/tests/microformats-v2/h-card/childimplied.json +12 -0
- data/vendor/tests/tests/microformats-v2/h-card/extendeddescription.html +10 -0
- data/vendor/tests/tests/microformats-v2/h-card/extendeddescription.json +15 -0
- data/vendor/tests/tests/microformats-v2/h-card/hcard.html +4 -0
- data/vendor/tests/tests/microformats-v2/h-card/hcard.json +19 -0
- data/vendor/tests/tests/microformats-v2/h-card/horghcard.html +4 -0
- data/vendor/tests/tests/microformats-v2/h-card/horghcard.json +19 -0
- data/vendor/tests/tests/microformats-v2/h-card/hyperlinkedphoto.html +3 -0
- data/vendor/tests/tests/microformats-v2/h-card/hyperlinkedphoto.json +12 -0
- data/vendor/tests/tests/microformats-v2/h-card/impliedname.html +15 -0
- data/vendor/tests/tests/microformats-v2/h-card/impliedname.json +90 -0
- data/vendor/tests/tests/microformats-v2/h-card/impliedphoto.html +11 -0
- data/vendor/tests/tests/microformats-v2/h-card/impliedphoto.json +72 -0
- data/vendor/tests/tests/microformats-v2/h-card/impliedurl.html +5 -0
- data/vendor/tests/tests/microformats-v2/h-card/impliedurl.json +45 -0
- data/vendor/tests/tests/microformats-v2/h-card/justahyperlink.html +1 -0
- data/vendor/tests/tests/microformats-v2/h-card/justahyperlink.json +11 -0
- data/vendor/tests/tests/microformats-v2/h-card/justaname.html +1 -0
- data/vendor/tests/tests/microformats-v2/h-card/justaname.json +10 -0
- data/vendor/tests/tests/microformats-v2/h-card/nested.html +4 -0
- data/vendor/tests/tests/microformats-v2/h-card/nested.json +18 -0
- data/vendor/tests/tests/microformats-v2/h-card/p-property.html +21 -0
- data/vendor/tests/tests/microformats-v2/h-card/p-property.json +15 -0
- data/vendor/tests/tests/microformats-v2/h-card/relativeurls.html +6 -0
- data/vendor/tests/tests/microformats-v2/h-card/relativeurls.json +29 -0
- data/vendor/tests/tests/microformats-v2/h-entry/change-log.html +90 -0
- data/vendor/tests/tests/microformats-v2/h-entry/encoding.html +3 -0
- data/vendor/tests/tests/microformats-v2/h-entry/encoding.json +14 -0
- data/vendor/tests/tests/microformats-v2/h-entry/impliedvalue-nested.html +9 -0
- data/vendor/tests/tests/microformats-v2/h-entry/impliedvalue-nested.json +27 -0
- data/vendor/tests/tests/microformats-v2/h-entry/justahyperlink.html +1 -0
- data/vendor/tests/tests/microformats-v2/h-entry/justahyperlink.json +11 -0
- data/vendor/tests/tests/microformats-v2/h-entry/justaname.html +1 -0
- data/vendor/tests/tests/microformats-v2/h-entry/justaname.json +10 -0
- data/vendor/tests/tests/microformats-v2/h-entry/scriptstyletags.html +4 -0
- data/vendor/tests/tests/microformats-v2/h-entry/scriptstyletags.json +14 -0
- data/vendor/tests/tests/microformats-v2/h-entry/summarycontent.html +20 -0
- data/vendor/tests/tests/microformats-v2/h-entry/summarycontent.json +25 -0
- data/vendor/tests/tests/microformats-v2/h-entry/u-property.html +33 -0
- data/vendor/tests/tests/microformats-v2/h-entry/u-property.json +12 -0
- data/vendor/tests/tests/microformats-v2/h-entry/urlincontent.html +13 -0
- data/vendor/tests/tests/microformats-v2/h-entry/urlincontent.json +14 -0
- data/vendor/tests/tests/microformats-v2/h-event/ampm.html +41 -0
- data/vendor/tests/tests/microformats-v2/h-event/ampm.json +21 -0
- data/vendor/tests/tests/microformats-v2/h-event/attendees.html +13 -0
- data/vendor/tests/tests/microformats-v2/h-event/attendees.json +37 -0
- data/vendor/tests/tests/microformats-v2/h-event/change-log.html +82 -0
- data/vendor/tests/tests/microformats-v2/h-event/combining.html +13 -0
- data/vendor/tests/tests/microformats-v2/h-event/combining.json +25 -0
- data/vendor/tests/tests/microformats-v2/h-event/concatenate.html +8 -0
- data/vendor/tests/tests/microformats-v2/h-event/concatenate.json +12 -0
- data/vendor/tests/tests/microformats-v2/h-event/dates.html +13 -0
- data/vendor/tests/tests/microformats-v2/h-event/dates.json +26 -0
- data/vendor/tests/tests/microformats-v2/h-event/dt-property.html +23 -0
- data/vendor/tests/tests/microformats-v2/h-event/dt-property.json +20 -0
- data/vendor/tests/tests/microformats-v2/h-event/justahyperlink.html +1 -0
- data/vendor/tests/tests/microformats-v2/h-event/justahyperlink.json +11 -0
- data/vendor/tests/tests/microformats-v2/h-event/justaname.html +1 -0
- data/vendor/tests/tests/microformats-v2/h-event/justaname.json +10 -0
- data/vendor/tests/tests/microformats-v2/h-event/time.html +47 -0
- data/vendor/tests/tests/microformats-v2/h-event/time.json +25 -0
- data/vendor/tests/tests/microformats-v2/h-feed/implied-title.html +30 -0
- data/vendor/tests/tests/microformats-v2/h-feed/implied-title.json +23 -0
- data/vendor/tests/tests/microformats-v2/h-feed/simple.html +26 -0
- data/vendor/tests/tests/microformats-v2/h-feed/simple.json +33 -0
- data/vendor/tests/tests/microformats-v2/h-geo/abbrpattern.html +5 -0
- data/vendor/tests/tests/microformats-v2/h-geo/abbrpattern.json +12 -0
- data/vendor/tests/tests/microformats-v2/h-geo/altitude.html +8 -0
- data/vendor/tests/tests/microformats-v2/h-geo/altitude.json +13 -0
- data/vendor/tests/tests/microformats-v2/h-geo/change-log.html +67 -0
- data/vendor/tests/tests/microformats-v2/h-geo/hidden.html +10 -0
- data/vendor/tests/tests/microformats-v2/h-geo/hidden.json +12 -0
- data/vendor/tests/tests/microformats-v2/h-geo/justaname.html +3 -0
- data/vendor/tests/tests/microformats-v2/h-geo/justaname.json +10 -0
- data/vendor/tests/tests/microformats-v2/h-geo/simpleproperties.html +5 -0
- data/vendor/tests/tests/microformats-v2/h-geo/simpleproperties.json +12 -0
- data/vendor/tests/tests/microformats-v2/h-geo/valuetitleclass.html +11 -0
- data/vendor/tests/tests/microformats-v2/h-geo/valuetitleclass.json +12 -0
- data/vendor/tests/tests/microformats-v2/h-news/all.html +35 -0
- data/vendor/tests/tests/microformats-v2/h-news/all.json +51 -0
- data/vendor/tests/tests/microformats-v2/h-news/change-log.html +78 -0
- data/vendor/tests/tests/microformats-v2/h-news/minimum.html +24 -0
- data/vendor/tests/tests/microformats-v2/h-news/minimum.json +40 -0
- data/vendor/tests/tests/microformats-v2/h-org/change-log.html +57 -0
- data/vendor/tests/tests/microformats-v2/h-org/hyperlink.html +1 -0
- data/vendor/tests/tests/microformats-v2/h-org/hyperlink.json +11 -0
- data/vendor/tests/tests/microformats-v2/h-org/simple.html +1 -0
- data/vendor/tests/tests/microformats-v2/h-org/simple.json +10 -0
- data/vendor/tests/tests/microformats-v2/h-org/simpleproperties.html +4 -0
- data/vendor/tests/tests/microformats-v2/h-org/simpleproperties.json +12 -0
- data/vendor/tests/tests/microformats-v2/h-product/aggregate.html +21 -0
- data/vendor/tests/tests/microformats-v2/h-product/aggregate.json +45 -0
- data/vendor/tests/tests/microformats-v2/h-product/change-log.html +62 -0
- data/vendor/tests/tests/microformats-v2/h-product/justahyperlink.html +1 -0
- data/vendor/tests/tests/microformats-v2/h-product/justahyperlink.json +11 -0
- data/vendor/tests/tests/microformats-v2/h-product/justaname.html +1 -0
- data/vendor/tests/tests/microformats-v2/h-product/justaname.json +10 -0
- data/vendor/tests/tests/microformats-v2/h-product/simpleproperties.html +10 -0
- data/vendor/tests/tests/microformats-v2/h-product/simpleproperties.json +26 -0
- data/vendor/tests/tests/microformats-v2/h-recipe/all.html +63 -0
- data/vendor/tests/tests/microformats-v2/h-recipe/all.json +54 -0
- data/vendor/tests/tests/microformats-v2/h-recipe/change-log.html +62 -0
- data/vendor/tests/tests/microformats-v2/h-recipe/minimum.html +7 -0
- data/vendor/tests/tests/microformats-v2/h-recipe/minimum.json +17 -0
- data/vendor/tests/tests/microformats-v2/h-resume/affiliation.html +12 -0
- data/vendor/tests/tests/microformats-v2/h-resume/affiliation.json +20 -0
- data/vendor/tests/tests/microformats-v2/h-resume/change-log.html +78 -0
- data/vendor/tests/tests/microformats-v2/h-resume/contact.html +17 -0
- data/vendor/tests/tests/microformats-v2/h-resume/contact.json +26 -0
- data/vendor/tests/tests/microformats-v2/h-resume/education.html +13 -0
- data/vendor/tests/tests/microformats-v2/h-resume/education.json +30 -0
- data/vendor/tests/tests/microformats-v2/h-resume/justaname.html +1 -0
- data/vendor/tests/tests/microformats-v2/h-resume/justaname.json +10 -0
- data/vendor/tests/tests/microformats-v2/h-resume/skill.html +12 -0
- data/vendor/tests/tests/microformats-v2/h-resume/skill.json +12 -0
- data/vendor/tests/tests/microformats-v2/h-resume/work.html +16 -0
- data/vendor/tests/tests/microformats-v2/h-resume/work.json +31 -0
- data/vendor/tests/tests/microformats-v2/h-review-aggregate/change-log.html +78 -0
- data/vendor/tests/tests/microformats-v2/h-review-aggregate/hevent.html +13 -0
- data/vendor/tests/tests/microformats-v2/h-review-aggregate/hevent.json +23 -0
- data/vendor/tests/tests/microformats-v2/h-review-aggregate/justahyperlink.html +8 -0
- data/vendor/tests/tests/microformats-v2/h-review-aggregate/justahyperlink.json +19 -0
- data/vendor/tests/tests/microformats-v2/h-review-aggregate/simpleproperties.html +18 -0
- data/vendor/tests/tests/microformats-v2/h-review-aggregate/simpleproperties.json +26 -0
- data/vendor/tests/tests/microformats-v2/h-review/change-log.html +84 -0
- data/vendor/tests/tests/microformats-v2/h-review/hyperlink.html +1 -0
- data/vendor/tests/tests/microformats-v2/h-review/hyperlink.json +11 -0
- data/vendor/tests/tests/microformats-v2/h-review/implieditem.html +4 -0
- data/vendor/tests/tests/microformats-v2/h-review/implieditem.json +19 -0
- data/vendor/tests/tests/microformats-v2/h-review/item.html +8 -0
- data/vendor/tests/tests/microformats-v2/h-review/item.json +20 -0
- data/vendor/tests/tests/microformats-v2/h-review/justaname.html +1 -0
- data/vendor/tests/tests/microformats-v2/h-review/justaname.json +10 -0
- data/vendor/tests/tests/microformats-v2/h-review/photo.html +1 -0
- data/vendor/tests/tests/microformats-v2/h-review/photo.json +11 -0
- data/vendor/tests/tests/microformats-v2/h-review/vcard.html +23 -0
- data/vendor/tests/tests/microformats-v2/h-review/vcard.json +48 -0
- data/vendor/tests/tests/microformats-v2/rel/change-log.html +67 -0
- data/vendor/tests/tests/microformats-v2/rel/duplicate-rels.html +10 -0
- data/vendor/tests/tests/microformats-v2/rel/duplicate-rels.json +75 -0
- data/vendor/tests/tests/microformats-v2/rel/license.html +1 -0
- data/vendor/tests/tests/microformats-v2/rel/license.json +12 -0
- data/vendor/tests/tests/microformats-v2/rel/nofollow.html +1 -0
- data/vendor/tests/tests/microformats-v2/rel/nofollow.json +12 -0
- data/vendor/tests/tests/microformats-v2/rel/rel-urls.html +8 -0
- data/vendor/tests/tests/microformats-v2/rel/rel-urls.json +33 -0
- data/vendor/tests/tests/microformats-v2/rel/varying-text-duplicate-rels.html +4 -0
- data/vendor/tests/tests/microformats-v2/rel/varying-text-duplicate-rels.json +20 -0
- data/vendor/tests/tests/microformats-v2/rel/xfn-all.html +19 -0
- data/vendor/tests/tests/microformats-v2/rel/xfn-all.json +92 -0
- data/vendor/tests/tests/microformats-v2/rel/xfn-elsewhere.html +10 -0
- data/vendor/tests/tests/microformats-v2/rel/xfn-elsewhere.json +40 -0
- metadata +533 -57
- data/CHANGELOG.rdoc +0 -6
- data/LICENSE +0 -20
- data/README.rdoc +0 -147
- data/lib/address.rb +0 -97
- data/lib/calendar.rb +0 -40
- data/lib/event.rb +0 -156
- data/lib/formatting_helpers.rb +0 -57
- data/lib/helpers.rb +0 -74
- data/lib/vcard.rb +0 -177
@@ -0,0 +1,37 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'microformats/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "microformats"
|
8
|
+
gem.version = Microformats::VERSION
|
9
|
+
gem.authors = ["Shane Becker", "Jessica Lynn Suttles", "Ben Roberts"]
|
10
|
+
gem.email = ["veganstraightedge@gmail.com", "jlsuttles@gmail.com", "ben@thatmustbe.me"]
|
11
|
+
gem.description = %q{A Ruby gem to parse HTML containing one or more microformats and microformats2 and return a collection of dynamically defined Ruby objects, a Ruby hash or a JSON hash.}
|
12
|
+
gem.summary = %q{Microformats and microformats2 parser}
|
13
|
+
gem.homepage = "https://github.com/indieweb/microformats-ruby"
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
|
20
|
+
gem.post_install_message = %q{
|
21
|
+
|
22
|
+
Previously called "microformats2" (on version 3.1 and below).
|
23
|
+
|
24
|
+
}
|
25
|
+
|
26
|
+
gem.required_ruby_version = ">= 2.0"
|
27
|
+
|
28
|
+
gem.add_runtime_dependency "nokogiri"
|
29
|
+
gem.add_runtime_dependency "json"
|
30
|
+
|
31
|
+
gem.add_development_dependency "rake"
|
32
|
+
gem.add_development_dependency "rspec"
|
33
|
+
gem.add_development_dependency "guard-rspec"
|
34
|
+
gem.add_development_dependency "rb-fsevent"
|
35
|
+
gem.add_development_dependency "simplecov"
|
36
|
+
gem.add_development_dependency "webmock"
|
37
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "microformats/absolute_uri"
|
3
|
+
|
4
|
+
describe Microformats::AbsoluteUri do
|
5
|
+
describe "#absolutize" do
|
6
|
+
subject { Microformats::AbsoluteUri.new(relative, base: base).absolutize }
|
7
|
+
let(:base) { nil }
|
8
|
+
|
9
|
+
context "when relative is nil" do
|
10
|
+
let(:relative) { nil }
|
11
|
+
it { should be_nil }
|
12
|
+
end
|
13
|
+
|
14
|
+
context "when relative is an empty string" do
|
15
|
+
let(:relative) { "" }
|
16
|
+
it { should be_nil }
|
17
|
+
end
|
18
|
+
|
19
|
+
context "when relative is a valid absolute URI" do
|
20
|
+
let(:relative) { "http://google.com" }
|
21
|
+
it { should eq("http://google.com") }
|
22
|
+
end
|
23
|
+
|
24
|
+
context "when relative is a valid non-absolute URI" do
|
25
|
+
let(:relative) { "bar/qux" }
|
26
|
+
|
27
|
+
context "and base is present but not absolute" do
|
28
|
+
let(:base) { "foo" }
|
29
|
+
it { should eq("bar/qux") }
|
30
|
+
end
|
31
|
+
|
32
|
+
context "and base is present and absolute" do
|
33
|
+
let(:base) { "http://google.com" }
|
34
|
+
it { should eq("http://google.com/bar/qux") }
|
35
|
+
end
|
36
|
+
|
37
|
+
context "and base is not present" do
|
38
|
+
let(:base) { nil }
|
39
|
+
it { should eq("bar/qux") }
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
context "when relative is an invalid URI" do
|
44
|
+
let(:relative) { "git@github.com:indieweb/microformats-ruby.git" }
|
45
|
+
it { should eq("git@github.com:indieweb/microformats-ruby.git") }
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "microformats"
|
3
|
+
|
4
|
+
describe Microformats::Parser do
|
5
|
+
let(:parser) { Microformats::Parser.new }
|
6
|
+
|
7
|
+
describe "#http_headers" do
|
8
|
+
it "starts as a blank hash" do
|
9
|
+
expect(parser.http_headers).to eq({})
|
10
|
+
end
|
11
|
+
|
12
|
+
describe "open file" do
|
13
|
+
before do
|
14
|
+
parser.parse("spec/support/lib/microformats/simple.html")
|
15
|
+
end
|
16
|
+
|
17
|
+
it "doesn't save #http_headers" do
|
18
|
+
expect(parser.http_headers).to eq({})
|
19
|
+
end
|
20
|
+
it "saves #http_body" do
|
21
|
+
expect(parser.http_body).to include "<!DOCTYPE html>"
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "http response" do
|
26
|
+
before do
|
27
|
+
stub_request(:get, "http://www.example.com/").
|
28
|
+
with(:headers => {"Accept"=>"*/*", "User-Agent"=>"Ruby"}).
|
29
|
+
to_return(:status => 200, :body => "abc", :headers => {"Content-Length" => 3})
|
30
|
+
parser.parse("http://www.example.com")
|
31
|
+
end
|
32
|
+
|
33
|
+
it "saves #http_headers" do
|
34
|
+
expect(parser.http_headers).to eq({"content-length" => "3"})
|
35
|
+
end
|
36
|
+
it "saves #http_body" do
|
37
|
+
expect(parser.http_body).to eq("abc")
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe "microformat-tests/tests" do
|
43
|
+
cases_dir = "vendor/tests/tests/*"
|
44
|
+
#cases_dir = "vendor/tests/tests/microformats-mixed"
|
45
|
+
#cases_dir = "vendor/tests/tests/microformats-v1"
|
46
|
+
#cases_dir = "vendor/tests/tests/microformats-working"
|
47
|
+
#cases_dir = "vendor/tests/tests/microformats-v2" #limit to only v2 for now
|
48
|
+
Dir[File.join(cases_dir, "*")].each do |page_dir|
|
49
|
+
describe page_dir.split("/")[-2..-1].join("/") do
|
50
|
+
Dir[File.join(page_dir, "*")].keep_if { |f| f =~ /([.]json$)/ }.each do |json_file|
|
51
|
+
it "#{json_file.split("/").last}" do
|
52
|
+
|
53
|
+
if json_file =~ /\/includes\//
|
54
|
+
pending "include-pattern are not yet implemented"
|
55
|
+
elsif json_file =~ /\/h-entry\/urlincontent/
|
56
|
+
pending "known issue / this is an aspect of nokogiri / won't fix"
|
57
|
+
elsif json_file =~ /\/hcard\/email/
|
58
|
+
pending "believed issue with the test suite, test needs to be fixed"
|
59
|
+
end
|
60
|
+
#pending "These are dynamic tests that are not yet passing so commenting out for now"
|
61
|
+
html_file = json_file.gsub(/([.]json$)/, ".html")
|
62
|
+
html = open(html_file).read
|
63
|
+
json = open(json_file).read
|
64
|
+
|
65
|
+
expect(JSON.parse(Microformats.parse(html, base: 'http://example.com').to_json)).to eq(JSON.parse(json))
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "microformats"
|
3
|
+
|
4
|
+
describe Microformats do
|
5
|
+
before do
|
6
|
+
@html = <<-HTML.strip
|
7
|
+
<div class="h-card"><p class="p-name">Jessica Lynn Suttles</p></div>
|
8
|
+
HTML
|
9
|
+
end
|
10
|
+
|
11
|
+
describe "::parse" do
|
12
|
+
it "returns ParserResult" do
|
13
|
+
expect(Microformats.parse(@html)).to be_kind_of Microformats::Collection
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "::read_html" do
|
18
|
+
it "can be a string of html" do
|
19
|
+
expect(Microformats.read_html(@html)).to include @html
|
20
|
+
end
|
21
|
+
it "can be a file path to html" do
|
22
|
+
html = "spec/support/lib/microformats/simple.html"
|
23
|
+
expect(Microformats.read_html(html)).to include "<div class=\"h-card\">"
|
24
|
+
end
|
25
|
+
it "can be a url to html" do
|
26
|
+
stub_request(:get, "http://google.com/").
|
27
|
+
with(:headers => {'Accept'=>'*/*', 'User-Agent'=>'Ruby'}).
|
28
|
+
to_return(:status => 200, :body => "google", :headers => {})
|
29
|
+
html = "http://google.com"
|
30
|
+
expect(Microformats.read_html(html)).to include "google"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
// http://microformats.org/wiki/microformats-2
|
2
|
+
{
|
3
|
+
"items": [{
|
4
|
+
"type": ["h-card"],
|
5
|
+
"properties": {
|
6
|
+
"name": ["Rohit Khare"],
|
7
|
+
"url": ["http://rohit.khare.org"],
|
8
|
+
"photo": ["https://s3.amazonaws.com/twitter_production/profile_images/53307499/180px-Rohit-sq_bigger.jpg"]
|
9
|
+
}
|
10
|
+
}]
|
11
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<!-- http://microformats.org/wiki/microformats-2 -->
|
2
|
+
<div class="h-card">
|
3
|
+
<img class="u-photo" alt="photo of Mitchell"
|
4
|
+
src="https://webfwd.org/content/about-experts/300.mitchellbaker/mentor_mbaker.jpg"/>
|
5
|
+
<a class="p-name u-url"
|
6
|
+
href="http://blog.lizardwrangler.com/"
|
7
|
+
>Mitchell Baker</a>
|
8
|
+
(<a class="u-url"
|
9
|
+
href="https://twitter.com/MitchellBaker"
|
10
|
+
>@MitchellBaker</a>)
|
11
|
+
<span class="p-org">Mozilla Foundation</span>
|
12
|
+
<p class="p-note">
|
13
|
+
Mitchell is responsible for setting the direction and scope of the Mozilla Foundation and its activities.
|
14
|
+
</p>
|
15
|
+
<span class="p-category">Strategy</span>
|
16
|
+
<span class="p-category">Leadership</span>
|
17
|
+
</div>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
// http://microformats.org/wiki/microformats-2
|
2
|
+
{
|
3
|
+
"items": [{
|
4
|
+
"type": ["h-card"],
|
5
|
+
"properties": {
|
6
|
+
"photo": ["https://webfwd.org/content/about-experts/300.mitchellbaker/mentor_mbaker.jpg"],
|
7
|
+
"name": ["Mitchell Baker"],
|
8
|
+
"url": [
|
9
|
+
"http://blog.lizardwrangler.com/",
|
10
|
+
"https://twitter.com/MitchellBaker"
|
11
|
+
],
|
12
|
+
"org": ["Mozilla Foundation"],
|
13
|
+
"note": ["Mitchell is responsible for setting the direction and scope of the Mozilla Foundation and its activities."],
|
14
|
+
"category": [
|
15
|
+
"Strategy",
|
16
|
+
"Leadership"
|
17
|
+
]
|
18
|
+
}
|
19
|
+
}]
|
20
|
+
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<!-- http://microformats.org/wiki/microformats-2 -->
|
2
|
+
<div class="h-event">
|
3
|
+
<a class="p-name u-url" href="http://indiewebcamp.com/2012">
|
4
|
+
IndieWebCamp 2012
|
5
|
+
</a>
|
6
|
+
from <time class="dt-start">2012-06-30</time>
|
7
|
+
to <time class="dt-end">2012-07-01</time> at
|
8
|
+
<span class="p-location h-card">
|
9
|
+
<a class="p-name p-org u-url" href="http://geoloqi.com/">
|
10
|
+
Geoloqi
|
11
|
+
</a>,
|
12
|
+
<span class="p-street-address">920 SW 3rd Ave. Suite 400</span>,
|
13
|
+
<span class="p-locality">Portland</span>,
|
14
|
+
<abbr class="p-region" title="Oregon">OR</abbr>
|
15
|
+
</span>
|
16
|
+
</div>
|
@@ -0,0 +1,24 @@
|
|
1
|
+
// http://microformats.org/wiki/microformats-2
|
2
|
+
{
|
3
|
+
"items": [{
|
4
|
+
"type": ["h-event"],
|
5
|
+
"properties": {
|
6
|
+
"name": ["IndieWebCamp 2012"],
|
7
|
+
"url": ["http://indiewebcamp.com/2012"],
|
8
|
+
"start": ["2012-06-30"],
|
9
|
+
"end": ["2012-07-01"],
|
10
|
+
"location": [{
|
11
|
+
"value": "Geoloqi, 920 SW 3rd Ave. Suite 400, Portland, OR",
|
12
|
+
"type": ["h-card"],
|
13
|
+
"properties": {
|
14
|
+
"name": ["Geoloqi"],
|
15
|
+
"org": ["Geoloqi"],
|
16
|
+
"url": ["http://geoloqi.com/"],
|
17
|
+
"street-address": ["920 SW 3rd Ave. Suite 400"],
|
18
|
+
"locality": ["Portland"],
|
19
|
+
"region": ["Oregon"]
|
20
|
+
}
|
21
|
+
}]
|
22
|
+
}
|
23
|
+
}]
|
24
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
// http://microformats.org/wiki/microformats-2
|
2
|
+
{
|
3
|
+
"items": [{
|
4
|
+
"type": ["h-card"],
|
5
|
+
"properties": {
|
6
|
+
"name": ["Mitchell Baker"],
|
7
|
+
"url": ["http://blog.lizardwrangler.com/"],
|
8
|
+
"org": [{
|
9
|
+
"value": "Mozilla Foundation",
|
10
|
+
"type": ["h-card"],
|
11
|
+
"properties": {
|
12
|
+
"name": ["Mozilla Foundation"],
|
13
|
+
"url": ["http://mozilla.org/"]
|
14
|
+
}
|
15
|
+
}]
|
16
|
+
}
|
17
|
+
}]
|
18
|
+
}
|
@@ -0,0 +1,18 @@
|
|
1
|
+
// http://microformats.org/wiki/microformats-2
|
2
|
+
{
|
3
|
+
"items": [{
|
4
|
+
"type": ["h-card"],
|
5
|
+
"properties": {
|
6
|
+
"name": ["Mitchell Baker"],
|
7
|
+
"url": ["http://blog.lizardwrangler.com/"],
|
8
|
+
"org": [{
|
9
|
+
"value": "Mozilla Foundation",
|
10
|
+
"type": ["h-card", "h-org"],
|
11
|
+
"properties": {
|
12
|
+
"name": ["Mozilla Foundation"],
|
13
|
+
"url": ["http://mozilla.org/"]
|
14
|
+
}
|
15
|
+
}]
|
16
|
+
}
|
17
|
+
}]
|
18
|
+
}
|