microformats2 2.9.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +125 -25
- data/Rakefile +0 -60
- data/lib/microformats2.rb +7 -15
- data/lib/microformats2/absolute_uri.rb +5 -1
- data/lib/microformats2/format_parser.rb +321 -46
- data/lib/microformats2/parser.rb +86 -6
- data/lib/microformats2/parser_core.rb +343 -0
- data/lib/microformats2/property_parser.rb +104 -34
- data/lib/microformats2/results/collection.rb +121 -0
- data/lib/microformats2/results/parser_result.rb +111 -0
- data/lib/microformats2/results/property_set.rb +87 -0
- data/lib/microformats2/time_property_parser.rb +161 -0
- data/lib/microformats2/version.rb +1 -1
- data/microformats2.gemspec +2 -1
- data/spec/lib/microformats2/absolute_uri_spec.rb +2 -2
- data/spec/lib/microformats2/parser_spec.rb +36 -5
- data/spec/lib/microformats2_spec.rb +5 -5
- data/spec/spec_helper.rb +0 -1
- 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 +285 -37
- data/lib/microformats2/collection.rb +0 -136
- data/lib/microformats2/format.rb +0 -151
- data/lib/microformats2/implied_property/foundation.rb +0 -59
- data/lib/microformats2/implied_property/name.rb +0 -34
- data/lib/microformats2/implied_property/photo.rb +0 -28
- data/lib/microformats2/implied_property/url.rb +0 -24
- data/lib/microformats2/property.rb +0 -21
- data/lib/microformats2/property/date_time.rb +0 -28
- data/lib/microformats2/property/embedded.rb +0 -9
- data/lib/microformats2/property/foundation.rb +0 -143
- data/lib/microformats2/property/text.rb +0 -16
- data/lib/microformats2/property/url.rb +0 -26
- data/spec/lib/microformats2/collection_spec.rb +0 -252
- data/spec/lib/microformats2/implied_property/name_spec.rb +0 -31
- data/spec/lib/microformats2/implied_property/photo_spec.rb +0 -31
- data/spec/lib/microformats2/implied_property/url_spec.rb +0 -58
@@ -1,28 +0,0 @@
|
|
1
|
-
module Microformats2
|
2
|
-
module Property
|
3
|
-
class DateTime < Foundation
|
4
|
-
|
5
|
-
def value
|
6
|
-
::DateTime.parse(to_s)
|
7
|
-
end
|
8
|
-
|
9
|
-
def to_hash
|
10
|
-
if items.empty?
|
11
|
-
to_s
|
12
|
-
else
|
13
|
-
{ value: to_s }.merge(items.first.to_hash)
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
protected
|
18
|
-
|
19
|
-
def attr_map
|
20
|
-
@attr_map ||= {
|
21
|
-
"time" => "datetime",
|
22
|
-
"ins" => "datetime",
|
23
|
-
"abbr" => "title",
|
24
|
-
"data" => "value" }
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
@@ -1,143 +0,0 @@
|
|
1
|
-
module Microformats2
|
2
|
-
module Property
|
3
|
-
class Foundation
|
4
|
-
|
5
|
-
VALUE_CLASS_REG_EXP = /^(value)/
|
6
|
-
VALUE_TITLE_CLASS_REG_EXP = /^(value-title)/
|
7
|
-
|
8
|
-
attr_reader :method_name
|
9
|
-
|
10
|
-
def initialize(element, html_class, string_value=nil, base=nil)
|
11
|
-
@element = element
|
12
|
-
@method_name = to_method_name(html_class)
|
13
|
-
@string_value = string_value
|
14
|
-
@base = base
|
15
|
-
end
|
16
|
-
|
17
|
-
def parse
|
18
|
-
to_s
|
19
|
-
items
|
20
|
-
self
|
21
|
-
end
|
22
|
-
|
23
|
-
def to_s
|
24
|
-
@to_s ||= string_value || value_class_pattern || element_value || text_value
|
25
|
-
end
|
26
|
-
|
27
|
-
def format
|
28
|
-
warn "[DEPRECATION] `format` is deprecated and will be removed in the next release. Try just leaving this function out completely (example author.format.name.to_s => author.name.to_s). You can also call `items.first` instead."
|
29
|
-
items.first
|
30
|
-
end
|
31
|
-
|
32
|
-
def formats
|
33
|
-
warn "[DEPRECATION] `formats` is deprecated and will be removed in the next release. Please use `items` instead."
|
34
|
-
items
|
35
|
-
end
|
36
|
-
|
37
|
-
def items
|
38
|
-
@formats ||= format_classes.length >=1 ? FormatParser.parse(@element, @base) : []
|
39
|
-
end
|
40
|
-
|
41
|
-
def to_hash
|
42
|
-
if items.empty?
|
43
|
-
to_s
|
44
|
-
else
|
45
|
-
{ value: to_s }.merge(items.first.to_hash)
|
46
|
-
end
|
47
|
-
end
|
48
|
-
|
49
|
-
def to_json
|
50
|
-
to_hash.to_json
|
51
|
-
end
|
52
|
-
|
53
|
-
def method_missing(name, *arg, &block)
|
54
|
-
fmt = items.first
|
55
|
-
if fmt.respond_to?(name)
|
56
|
-
fmt.send(name)
|
57
|
-
else
|
58
|
-
super
|
59
|
-
end
|
60
|
-
|
61
|
-
end
|
62
|
-
|
63
|
-
protected
|
64
|
-
|
65
|
-
def value_class_pattern
|
66
|
-
result = value_parse(@element)
|
67
|
-
result = nil if result.empty?
|
68
|
-
result
|
69
|
-
end
|
70
|
-
|
71
|
-
def value_parse(element)
|
72
|
-
value_parse_node(element).flatten.compact
|
73
|
-
end
|
74
|
-
|
75
|
-
def value_parse_node(node)
|
76
|
-
case
|
77
|
-
when node.is_a?(Nokogiri::XML::NodeSet) then value_parse_nodeset(node)
|
78
|
-
when node.is_a?(Nokogiri::XML::Element) then [parse_for_value_class_pattern(node)]
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
def value_parse_nodeset(nodeset)
|
83
|
-
nodeset.map { |node| value_parse_node(node) }
|
84
|
-
end
|
85
|
-
|
86
|
-
def parse_for_value_class_pattern(element)
|
87
|
-
if value_title_classes(element).length >= 1
|
88
|
-
element.attribute("title").to_s.gsub(/\n+/, " ").gsub(/\s+/, " ").strip
|
89
|
-
elsif value_classes(element).length >= 1
|
90
|
-
element.inner_text.gsub(/\n+/, " ").gsub(/\s+/, " ").strip
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
def element_value
|
95
|
-
@element.attribute(attribute).to_s if attribute && @element.attribute(attribute)
|
96
|
-
end
|
97
|
-
|
98
|
-
def text_value
|
99
|
-
@element.inner_text.gsub(/\n+/, " ").gsub(/\s+/, " ").strip
|
100
|
-
end
|
101
|
-
|
102
|
-
def string_value
|
103
|
-
@string_value
|
104
|
-
end
|
105
|
-
|
106
|
-
def attribute
|
107
|
-
attr_map[@element.name]
|
108
|
-
end
|
109
|
-
|
110
|
-
def attr_map
|
111
|
-
{}
|
112
|
-
end
|
113
|
-
|
114
|
-
private
|
115
|
-
|
116
|
-
def to_method_name(html_class)
|
117
|
-
# p-class-name -> class_name
|
118
|
-
mn = html_class.downcase.split("-")[1..-1].join("_")
|
119
|
-
# avoid overriding Object#class
|
120
|
-
mn = "klass" if mn == "class"
|
121
|
-
mn
|
122
|
-
end
|
123
|
-
|
124
|
-
def format_classes
|
125
|
-
return [] unless @element
|
126
|
-
@format_classes = @element.attribute("class").to_s.split.select do |html_class|
|
127
|
-
html_class =~ Format::CLASS_REG_EXP
|
128
|
-
end
|
129
|
-
end
|
130
|
-
|
131
|
-
def value_classes(element)
|
132
|
-
element.attribute("class").to_s.split.select do |html_class|
|
133
|
-
html_class =~ VALUE_CLASS_REG_EXP
|
134
|
-
end
|
135
|
-
end
|
136
|
-
def value_title_classes(element)
|
137
|
-
element.attribute("class").to_s.split.select do |html_class|
|
138
|
-
html_class =~ VALUE_TITLE_CLASS_REG_EXP
|
139
|
-
end
|
140
|
-
end
|
141
|
-
end
|
142
|
-
end
|
143
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
module Microformats2
|
2
|
-
module Property
|
3
|
-
class Url < Foundation
|
4
|
-
|
5
|
-
def to_s
|
6
|
-
@to_s = Microformats2::AbsoluteUri.new(@base, super.to_s).absolutize
|
7
|
-
end
|
8
|
-
|
9
|
-
protected
|
10
|
-
|
11
|
-
def attr_map
|
12
|
-
@attr_map = {
|
13
|
-
"a" => "href",
|
14
|
-
"area" => "href",
|
15
|
-
"audio" => "src",
|
16
|
-
"img" => "src",
|
17
|
-
"object" => "data",
|
18
|
-
"source" => "src",
|
19
|
-
"video" => "src",
|
20
|
-
"abbr" => "title",
|
21
|
-
"data" => "value",
|
22
|
-
"input" => "value" }
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
@@ -1,252 +0,0 @@
|
|
1
|
-
require "spec_helper"
|
2
|
-
require "microformats2"
|
3
|
-
|
4
|
-
describe Microformats2::Collection do
|
5
|
-
describe "spec/support/lib/microformats2" do
|
6
|
-
|
7
|
-
describe "simple.html" do
|
8
|
-
before do
|
9
|
-
html = "spec/support/lib/microformats2/simple.html"
|
10
|
-
@collection = Microformats2.parse(html)
|
11
|
-
end
|
12
|
-
describe "#to_json" do
|
13
|
-
it "should match simple.js" do
|
14
|
-
json = "spec/support/lib/microformats2/simple.js"
|
15
|
-
json = open(json).read
|
16
|
-
JSON.parse(@collection.to_json).should == JSON.parse(json)
|
17
|
-
end
|
18
|
-
end
|
19
|
-
describe "'.h-card'" do
|
20
|
-
it "assigns all cards to Collection#cards" do
|
21
|
-
@collection.cards.first.should be_kind_of HCard
|
22
|
-
end
|
23
|
-
it "assigns the first card to Collection#card" do
|
24
|
-
@collection.card.should be_kind_of HCard
|
25
|
-
end
|
26
|
-
end
|
27
|
-
describe "'.h-card .p-name'" do
|
28
|
-
it "assigns all names to HCard#names" do
|
29
|
-
@collection.card.names.map(&:to_s).should == ["Jessica Lynn Suttles"]
|
30
|
-
end
|
31
|
-
it "assigns the first name to HCard#name" do
|
32
|
-
@collection.card.name.to_s.should == "Jessica Lynn Suttles"
|
33
|
-
end
|
34
|
-
it "HCard#name is a Property::Text" do
|
35
|
-
@collection.card.name.should be_kind_of Microformats2::Property::Text
|
36
|
-
end
|
37
|
-
end
|
38
|
-
describe "'.h-card .u-url'" do
|
39
|
-
it "assigns all urls to HCard#urls" do
|
40
|
-
urls = ["http://example.org/", "http://flickr.com/", "http://twitter.com/jlsuttles"]
|
41
|
-
@collection.card.urls.map(&:to_s).should == urls
|
42
|
-
end
|
43
|
-
it "assigns then first url to HCard#url" do
|
44
|
-
@collection.card.url.to_s.should == "http://example.org/"
|
45
|
-
end
|
46
|
-
it "HCard#url is a Property::Url" do
|
47
|
-
@collection.card.url.should be_kind_of Microformats2::Property::Url
|
48
|
-
end
|
49
|
-
end
|
50
|
-
describe "'.h-card .p-bday'" do
|
51
|
-
it "assigns all bdays to HCard#bdays" do
|
52
|
-
@collection.card.bdays.map(&:to_s).should == ["1990-10-15"]
|
53
|
-
end
|
54
|
-
it "assigns the first bday to HCard#bday" do
|
55
|
-
@collection.card.bday.to_s.should == "1990-10-15"
|
56
|
-
end
|
57
|
-
it "HCard#bday is a Property::DateTime" do
|
58
|
-
@collection.card.bday.should be_kind_of Microformats2::Property::DateTime
|
59
|
-
end
|
60
|
-
it "assigns DateTime object to Property::DateTime#value" do
|
61
|
-
@collection.card.bday.value.should be_kind_of DateTime
|
62
|
-
@collection.card.bday.value.to_s.should == "1990-10-15T00:00:00+00:00"
|
63
|
-
end
|
64
|
-
end
|
65
|
-
describe "'.h-card .p-content'" do
|
66
|
-
it "assigns all contents to HCard#contents" do
|
67
|
-
@collection.card.contents.map(&:to_s).should == ["<p>Vegan. Cat lover. Coder.</p>"]
|
68
|
-
end
|
69
|
-
it "assigns the first content to HCard#content" do
|
70
|
-
@collection.card.content.to_s.should == "<p>Vegan. Cat lover. Coder.</p>"
|
71
|
-
end
|
72
|
-
it "HCard#content is a Property::Embedded" do
|
73
|
-
@collection.card.contents.first.should be_kind_of Microformats2::Property::Embedded
|
74
|
-
end
|
75
|
-
end
|
76
|
-
describe "Format.add_property" do
|
77
|
-
let(:value) { "bar" }
|
78
|
-
it "creates the attr" do
|
79
|
-
@collection.first.add_property("p-foo", value)
|
80
|
-
@collection.first.foo.to_s.should == value
|
81
|
-
end
|
82
|
-
it "allows json output of the attribute" do
|
83
|
-
@collection.first.add_property("p-foo", value)
|
84
|
-
@collection.first.to_json.should include(value)
|
85
|
-
end
|
86
|
-
it "supports Embedded" do
|
87
|
-
@collection.first.add_property("e-foo", value)
|
88
|
-
@collection.first.foo.to_s.should == value
|
89
|
-
end
|
90
|
-
it "raises a InvalidPropertyPrefix error if the prefix is invalid" do
|
91
|
-
expect {
|
92
|
-
@collection.first.add_property("xxx-foo", value)
|
93
|
-
}.to raise_error Microformats2::InvalidPropertyPrefix
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
97
|
-
describe "nested-property.html" do
|
98
|
-
before do
|
99
|
-
html = "spec/support/lib/microformats2/nested-property.html"
|
100
|
-
@collection = Microformats2.parse(html)
|
101
|
-
end
|
102
|
-
describe "#to_json" do
|
103
|
-
it "should match nested-property.js" do
|
104
|
-
json = "spec/support/lib/microformats2/nested-property.js"
|
105
|
-
json = open(json).read
|
106
|
-
JSON.parse(@collection.to_json).should == JSON.parse(json)
|
107
|
-
end
|
108
|
-
end
|
109
|
-
describe "'.h-card'" do
|
110
|
-
it "assigns all cards to Collection#cards" do
|
111
|
-
@collection.cards.first.should be_kind_of HCard
|
112
|
-
end
|
113
|
-
it "assigns the first card to Collection#card" do
|
114
|
-
@collection.card.should be_kind_of HCard
|
115
|
-
end
|
116
|
-
end
|
117
|
-
describe "'.h-card .p-name'" do
|
118
|
-
it "assigns all names to HCard#names" do
|
119
|
-
@collection.card.names.map(&:to_s).should == ["jlsuttles"]
|
120
|
-
end
|
121
|
-
it "assigns the first name to HCard#name" do
|
122
|
-
@collection.card.name.to_s.should == "jlsuttles"
|
123
|
-
end
|
124
|
-
it "HCard#name is a Property::Text" do
|
125
|
-
@collection.card.name.should be_kind_of Microformats2::Property::Text
|
126
|
-
end
|
127
|
-
end
|
128
|
-
describe "'.h-card .p-name .p-nickname'" do
|
129
|
-
it "assigns all nicknames to HCard#nicknames" do
|
130
|
-
@collection.card.nicknames.map(&:to_s).should == ["jlsuttles"]
|
131
|
-
end
|
132
|
-
it "assigns the first nickname to HCard#nickname" do
|
133
|
-
@collection.card.nickname.to_s.should == "jlsuttles"
|
134
|
-
end
|
135
|
-
it "HCard#nickname is a Property::Text" do
|
136
|
-
@collection.card.nickname.should be_kind_of Microformats2::Property::Text
|
137
|
-
end
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
|
-
describe "nested-format-with-property-of-same-name.html" do
|
142
|
-
before do
|
143
|
-
html = "spec/support/lib/microformats2/nested-format-with-property-of-same-name.html"
|
144
|
-
@collection = Microformats2.parse(html)
|
145
|
-
end
|
146
|
-
describe "#to_json" do
|
147
|
-
it "should match nested-format-with-property-of-same-name.js" do
|
148
|
-
json = "spec/support/lib/microformats2/nested-format-with-property-of-same-name.js"
|
149
|
-
json = open(json).read
|
150
|
-
JSON.parse(@collection.to_json).should == JSON.parse(json)
|
151
|
-
end
|
152
|
-
end
|
153
|
-
end
|
154
|
-
|
155
|
-
describe "nested-format-with-property.html" do
|
156
|
-
before do
|
157
|
-
html = "spec/support/lib/microformats2/nested-format-with-property.html"
|
158
|
-
@collection = Microformats2.parse(html)
|
159
|
-
end
|
160
|
-
describe "#to_json" do
|
161
|
-
it "should match nested-format-with-property.js" do
|
162
|
-
json = "spec/support/lib/microformats2/nested-format-with-property.js"
|
163
|
-
json = open(json).read
|
164
|
-
JSON.parse(@collection.to_json).should == JSON.parse(json)
|
165
|
-
end
|
166
|
-
end
|
167
|
-
describe "'.h-entry'" do
|
168
|
-
it "assigns all entrys to Collection#entrys" do
|
169
|
-
@collection.entries.first.should be_kind_of HEntry
|
170
|
-
end
|
171
|
-
it "assigns the first entry to Collection#entry" do
|
172
|
-
@collection.entry.should be_kind_of HEntry
|
173
|
-
end
|
174
|
-
end
|
175
|
-
describe "'.h-card .p-author.h-card'" do
|
176
|
-
it "assigns all authors to HCard#authors" do
|
177
|
-
@collection.entry.authors.map(&:to_s).should == ["Jessica Lynn Suttles"]
|
178
|
-
end
|
179
|
-
it "assigns the first author to HCard#author" do
|
180
|
-
@collection.entry.author.to_s.should == "Jessica Lynn Suttles"
|
181
|
-
end
|
182
|
-
it "HCard#author is a Property::Text" do
|
183
|
-
@collection.entry.author.should be_kind_of Microformats2::Property::Text
|
184
|
-
end
|
185
|
-
it "assigns all HCard to Property::Text#formats" do
|
186
|
-
@collection.entry.author.formats.first.should be_kind_of HCard
|
187
|
-
end
|
188
|
-
it "assigns the first HCard to Property::Text#format" do
|
189
|
-
@collection.entry.author.format.should be_kind_of HCard
|
190
|
-
end
|
191
|
-
end
|
192
|
-
end
|
193
|
-
|
194
|
-
describe "rels.html" do
|
195
|
-
before do
|
196
|
-
html = "spec/support/lib/microformats2/rels.html"
|
197
|
-
@collection = Microformats2.parse(html)
|
198
|
-
end
|
199
|
-
describe "#to_json" do
|
200
|
-
it "should match rels.js" do
|
201
|
-
# this also tests the case of having rel="alternates"
|
202
|
-
json = "spec/support/lib/microformats2/rels.js"
|
203
|
-
json = open(json).read
|
204
|
-
JSON.parse(@collection.to_json).should == JSON.parse(json)
|
205
|
-
end
|
206
|
-
end
|
207
|
-
end
|
208
|
-
|
209
|
-
describe "rels-with-unnormalized-urls.html" do
|
210
|
-
before do
|
211
|
-
html = "spec/support/lib/microformats2/rels-with-unnormalized-urls.html"
|
212
|
-
@collection = Microformats2.parse(html)
|
213
|
-
end
|
214
|
-
|
215
|
-
it "should normalize the url" do
|
216
|
-
@collection.to_hash[:rels]["me"].should eq([ "http://jessicard.com/" ])
|
217
|
-
end
|
218
|
-
end
|
219
|
-
|
220
|
-
describe "rels-that-drop-the-base.html" do
|
221
|
-
before do
|
222
|
-
html = "spec/support/lib/microformats2/rels-that-drop-the-base.html"
|
223
|
-
@collection = Microformats2.parse(html)
|
224
|
-
end
|
225
|
-
|
226
|
-
it "keeps the relative path" do
|
227
|
-
@collection.to_hash[:rels]["stylesheet"].should eq([ "/path/to/stylesheet.css" ])
|
228
|
-
end
|
229
|
-
end
|
230
|
-
end
|
231
|
-
|
232
|
-
|
233
|
-
# these cases were scraped from the internet using `rake specs:update`
|
234
|
-
|
235
|
-
describe "spec/support/cases" do
|
236
|
-
cases_dir = "spec/support/cases/*"
|
237
|
-
Dir[File.join(cases_dir, "*")].each do |page_dir|
|
238
|
-
describe page_dir.split("/")[-2..-1].join("/") do
|
239
|
-
Dir[File.join(page_dir, "*")].keep_if { |f| f =~ /([.]html$)/ }.each do |html_file|
|
240
|
-
it "#{html_file.split("/").last}" do
|
241
|
-
pending "These are dynamic tests that are not yet passing so commenting out for now"
|
242
|
-
# json_file = html_file.gsub(/([.]html$)/, ".js")
|
243
|
-
# html = open(html_file).read
|
244
|
-
# json = open(json_file).read
|
245
|
-
|
246
|
-
# JSON.parse(Microformats2.parse(html).to_json).should == JSON.parse(json)
|
247
|
-
end
|
248
|
-
end
|
249
|
-
end
|
250
|
-
end
|
251
|
-
end
|
252
|
-
end
|