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
data/lib/formatting_helpers.rb
DELETED
@@ -1,57 +0,0 @@
|
|
1
|
-
# These are all internal methods used for formatting, no need
|
2
|
-
# to use any of them explicitly.
|
3
|
-
#
|
4
|
-
module Microformats::FormattingHelpers # :nodoc:
|
5
|
-
def content_tag(content, opts={}) # :nodoc:
|
6
|
-
tag = opts.delete(:tag) || @default_tag
|
7
|
-
attrs = opts.inject([]) do |out, tuple|
|
8
|
-
k,v = tuple
|
9
|
-
out << "#{k}='#{v}'" if v
|
10
|
-
out
|
11
|
-
end
|
12
|
-
attr_string = attrs.sort.join(' ')
|
13
|
-
open_tag = attr_string == '' ? tag : "#{tag} #{attr_string}"
|
14
|
-
if [:img].include?(tag)
|
15
|
-
"<#{open_tag} />"
|
16
|
-
else
|
17
|
-
"<#{open_tag}>#{content}</#{tag}>"
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
def concat_tag(opts={}) # :nodoc:
|
22
|
-
tag = opts.delete(:tag) || @default_tag
|
23
|
-
attrs = opts.inject([]) do |out, tuple|
|
24
|
-
k,v = tuple
|
25
|
-
out << "#{k}='#{v}'"
|
26
|
-
end
|
27
|
-
attr_string = attrs.sort.join(' ')
|
28
|
-
open_tag = attr_string == '' ? tag : "#{tag} #{attr_string}"
|
29
|
-
concat "<#{open_tag}>\n"
|
30
|
-
yield
|
31
|
-
concat "</#{tag}>\n"
|
32
|
-
end
|
33
|
-
|
34
|
-
def merge_html_attrs(base_attrs, overriding_attrs) # :nodoc:
|
35
|
-
classes = combine_class_names(base_attrs.delete(:class), overriding_attrs.delete(:class))
|
36
|
-
attrs = base_attrs.merge(overriding_attrs)
|
37
|
-
attrs[:class] = classes unless classes == ''
|
38
|
-
attrs
|
39
|
-
end
|
40
|
-
|
41
|
-
def concat(str) # :nodoc:
|
42
|
-
@template.concat(str)
|
43
|
-
end
|
44
|
-
|
45
|
-
def encode_time(t) # :nodoc:
|
46
|
-
t.strftime("%Y-%m-%dT%H:%M%z").gsub(/00$/, ":00")
|
47
|
-
end
|
48
|
-
|
49
|
-
def humanize_time(t) # :nodoc:
|
50
|
-
t.strftime("%b %d, %Y at %I:%M%p").gsub(/\s0/, ' ')
|
51
|
-
end
|
52
|
-
|
53
|
-
def combine_class_names(*classes) # :nodoc:
|
54
|
-
str = classes.flatten.compact.sort.join(' ').gsub(/\s+/, ' ')
|
55
|
-
(str =~ /\w/) ? str : nil
|
56
|
-
end
|
57
|
-
end
|
data/lib/helpers.rb
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
# Include this file into your view layer. For example, in Rails:
|
2
|
-
#
|
3
|
-
# module ApplicationHelper
|
4
|
-
# include Microformats::Helpers
|
5
|
-
# end
|
6
|
-
#
|
7
|
-
module Microformats::Helpers
|
8
|
-
# Creates a vCard with the given options and a block.
|
9
|
-
#
|
10
|
-
# OPTIONS:
|
11
|
-
# * :tag - The HTML wrapper element (defaults to :div)
|
12
|
-
# * Any other passed options will be treated as HTML attributes.
|
13
|
-
#
|
14
|
-
# EXAMPLE:
|
15
|
-
# <% vcard :id => 'my_vcard' do |card| %>
|
16
|
-
# Hello, my name is <%= card.name "Chris" %>!
|
17
|
-
# <% end %>
|
18
|
-
#
|
19
|
-
def vcard(opts = {}, &block)
|
20
|
-
card = Microformats::Vcard.new(self)
|
21
|
-
card.run(opts, &block)
|
22
|
-
end
|
23
|
-
|
24
|
-
# Creates a vAddress with the given options and a block.
|
25
|
-
#
|
26
|
-
# OPTIONS:
|
27
|
-
# * :type - A string that specifies the type of address('home', 'work', etc)
|
28
|
-
# * :tag - The HTML wrapper element (defaults to :div)
|
29
|
-
# * Any other passed options will be treated as HTML attributes.
|
30
|
-
#
|
31
|
-
# EXAMPLE:
|
32
|
-
# <% vaddress :type => 'work', :id => 'my_adr' do |adr| %>
|
33
|
-
# I live at <%= adr.street "123 Main St" %>.
|
34
|
-
# <% end %>
|
35
|
-
#
|
36
|
-
def vaddress(opts = {}, &block)
|
37
|
-
address = Microformats::Address.new(self)
|
38
|
-
address.run(opts, &block)
|
39
|
-
end
|
40
|
-
|
41
|
-
# Creates a vEvent with the given options and a block.
|
42
|
-
#
|
43
|
-
# OPTIONS:
|
44
|
-
# * :tag - The HTML wrapper element (defaults to :div)
|
45
|
-
# * Any other passed options will be treated as HTML attributes.
|
46
|
-
#
|
47
|
-
# EXAMPLE:
|
48
|
-
# <% vevent :id => 'my_event' do |event| %>
|
49
|
-
# This event is called <%= event.name "Cool Event" %>.
|
50
|
-
# <% end %>
|
51
|
-
#
|
52
|
-
def vevent(opts = {}, &block)
|
53
|
-
event = Microformats::Event.new(self)
|
54
|
-
event.run(opts, &block)
|
55
|
-
end
|
56
|
-
|
57
|
-
# Creates a vCalendar with the given options and a block.
|
58
|
-
#
|
59
|
-
# OPTIONS:
|
60
|
-
# * :tag - The HTML wrapper element (defaults to :div)
|
61
|
-
# * Any other passed options will be treated as HTML attributes.
|
62
|
-
#
|
63
|
-
# EXAMPLE:
|
64
|
-
# <% vcalendar :id => 'my_cal' do |cal| %>
|
65
|
-
# <% cal.event :id => 'my_event' do |event| %>
|
66
|
-
# This event is called <%= event.name "Cool Event" %>.
|
67
|
-
# <% end %>
|
68
|
-
# <% end %>
|
69
|
-
#
|
70
|
-
def vcalendar(opts = {}, &block)
|
71
|
-
cal = Microformats::Calendar.new(self)
|
72
|
-
cal.run(opts, &block)
|
73
|
-
end
|
74
|
-
end
|
data/lib/vcard.rb
DELETED
@@ -1,177 +0,0 @@
|
|
1
|
-
class Microformats::Vcard
|
2
|
-
include Microformats::FormattingHelpers
|
3
|
-
|
4
|
-
# You can directly initialize and runthis class, but it's easier
|
5
|
-
# to use the Microformats::Helpers#vcard helper method.
|
6
|
-
def initialize(template)
|
7
|
-
@template = template
|
8
|
-
@default_tag = :span
|
9
|
-
end
|
10
|
-
|
11
|
-
# You can directly initialize and runthis class, but it's easier
|
12
|
-
# to use the Microformats::Helpers#vcard helper method.
|
13
|
-
#
|
14
|
-
# OPTIONS:
|
15
|
-
# * :tag - The HTML wrapper element (defaults to :div)
|
16
|
-
# * Any other passed options will be treated as HTML attributes.
|
17
|
-
#
|
18
|
-
def run(opts = {}, &block)
|
19
|
-
opts[:class] = combine_class_names('vcard', opts[:class])
|
20
|
-
opts[:itemscope] = 'itemscope'
|
21
|
-
opts[:itemtype] = 'http://data-vocabulary.org/Person'
|
22
|
-
opts[:tag] ||= :div
|
23
|
-
concat_tag(opts) do
|
24
|
-
block.call(self)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
# Marks up a person's name.
|
29
|
-
#
|
30
|
-
# OPTIONS:
|
31
|
-
# * :tag - The HTML wrapper element (defaults to :span)
|
32
|
-
# * Any other passed options will be treated as HTML attributes.
|
33
|
-
#
|
34
|
-
def name(str, opts = {})
|
35
|
-
content_tag(str, merge_html_attrs({:class => 'fn', :itemprop => 'name'}, opts))
|
36
|
-
end
|
37
|
-
|
38
|
-
# Marks up a company name. If this vCard represents a company
|
39
|
-
# rather than an individual person that works at a company, set
|
40
|
-
# the :is_company option to true.
|
41
|
-
#
|
42
|
-
# OPTIONS:
|
43
|
-
# * :is_company - Boolean, true if this is a company vCard (defaults to false)
|
44
|
-
# * :tag - The HTML wrapper element (defaults to :span)
|
45
|
-
# * Any other passed options will be treated as HTML attributes.
|
46
|
-
#
|
47
|
-
def company(str, opts = {})
|
48
|
-
classes = opts.delete(:is_company) ? 'fn org' : 'org'
|
49
|
-
content_tag(str, merge_html_attrs({:class => classes, :itemprop => 'affiliation'}, opts))
|
50
|
-
end
|
51
|
-
alias_method :organization, :company
|
52
|
-
|
53
|
-
# Marks up the person's URL. By default, it will output an <a> tag using
|
54
|
-
# the passed in string as both the href and the text. If the :href option
|
55
|
-
# is passed, then the string argument is treated as text.
|
56
|
-
#
|
57
|
-
# OPTIONS:
|
58
|
-
# * :href - If passed, the string argument will be treated as the text node.
|
59
|
-
# * :tag - The HTML wrapper element (defaults to :span)
|
60
|
-
# * Any other passed options will be treated as HTML attributes.
|
61
|
-
#
|
62
|
-
# EXAMPLES:
|
63
|
-
# card.url('http://google.com') #=> <a class='url' href='http://google.com' itemprop='url'>http://google.com</a>
|
64
|
-
# card.url('Google', :href => 'http://google.com') #=> <a class='url' href='http://google.com' itemprop='url'>Google</a>
|
65
|
-
# card.url('http://google.com', :tag => :span) #=> <span class='url' itemprop='url'>http://google.com</span>
|
66
|
-
#
|
67
|
-
def url(str, opts = {})
|
68
|
-
if opts[:href]
|
69
|
-
content_tag(str, merge_html_attrs({:tag => :a, :class => 'url', :itemprop => 'url'}, opts))
|
70
|
-
elsif opts[:tag]
|
71
|
-
content_tag(str, merge_html_attrs({:class => 'url', :itemprop => 'url'}, opts))
|
72
|
-
else
|
73
|
-
content_tag(str, merge_html_attrs({:tag => :a, :class => 'url', :href => str, :itemprop => 'url'}, opts))
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
# Marks up the vCard photo as an <img> tag. Takes the image URL as the first argument.
|
78
|
-
#
|
79
|
-
# OPTIONS
|
80
|
-
# * :size - Pass a string with WIDTHxHEIGHT like "200x100" in lieu of the :width and :height options.
|
81
|
-
# * Any other passed options will be treated as HTML attributes.
|
82
|
-
#
|
83
|
-
def photo(str, opts = {})
|
84
|
-
if size = opts.delete(:size)
|
85
|
-
opts[:width], opts[:height] = size.split('x')
|
86
|
-
end
|
87
|
-
content_tag(nil, merge_html_attrs({:tag => :img, :class => 'photo', :itemprop => 'photo', :src => str}, opts))
|
88
|
-
end
|
89
|
-
|
90
|
-
# Marks up a phone number, takes the phone number as a string.
|
91
|
-
#
|
92
|
-
# OPTIONS
|
93
|
-
# * :type - A string that specifies the type of phone number ('home', 'work', etc)
|
94
|
-
# * :tag - The HTML wrapper element (defaults to :span)
|
95
|
-
# * Any other passed options will be treated as HTML attributes.
|
96
|
-
#
|
97
|
-
def phone(str, opts = {})
|
98
|
-
type = if opts[:type].to_s != ''
|
99
|
-
type_inner_span = content_tag('', :class => 'value-title', :title => opts.delete(:type))
|
100
|
-
content_tag(type_inner_span, :class => 'type')
|
101
|
-
else
|
102
|
-
''
|
103
|
-
end
|
104
|
-
content_tag(type + str, merge_html_attrs({:class => 'tel'}, opts))
|
105
|
-
end
|
106
|
-
|
107
|
-
# Marks up an email address, takes the email as a string.
|
108
|
-
#
|
109
|
-
# OPTIONS
|
110
|
-
# * :type - A string that specifies the type of phone number ('home', 'work', etc)
|
111
|
-
# * :tag - The HTML wrapper element (defaults to :a)
|
112
|
-
# * Any other passed options will be treated as HTML attributes.
|
113
|
-
#
|
114
|
-
def email(str, opts = {})
|
115
|
-
opts[:tag] ||= :a
|
116
|
-
type = if opts[:type].to_s != ''
|
117
|
-
type_inner_span = content_tag('', :class => 'value-title', :title => opts.delete(:type))
|
118
|
-
content_tag(type_inner_span, :class => 'type')
|
119
|
-
else
|
120
|
-
''
|
121
|
-
end
|
122
|
-
if opts[:tag] == :a
|
123
|
-
content_tag(type + str, merge_html_attrs({:class => 'email', :href => "mailto:#{str}"}, opts))
|
124
|
-
else
|
125
|
-
content_tag(type + str, merge_html_attrs({:class => 'email'}, opts))
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
# Accepts latitude and longitude as arguments. It will only output a
|
130
|
-
# visible text node if you provide the :text option.
|
131
|
-
#
|
132
|
-
# OPTIONS
|
133
|
-
# * :text - String, the text will be be displayed inside the 'geo' wrapper
|
134
|
-
#
|
135
|
-
def coordinates(lat, lng, opts = {})
|
136
|
-
lat_meta = content_tag('', :tag => :meta, :itemprop => 'latitude', :content => lat)
|
137
|
-
lng_meta = content_tag('', :tag => :meta, :itemprop => 'longitude', :content => lng)
|
138
|
-
lat_span = content_tag(content_tag('', :class => 'value-title', :title => lat), :class => 'latitude')
|
139
|
-
lng_span = content_tag(content_tag('', :class => 'value-title', :title => lng), :class => 'longitude')
|
140
|
-
text = opts[:text] || ''
|
141
|
-
content_tag(lat_meta + lng_meta + lat_span + lng_span + text, :class => 'geo', :itemprop => 'geo', :itemscope => 'itemscope', :itemtype => 'http://data-vocabulary.org/Geo')
|
142
|
-
end
|
143
|
-
|
144
|
-
# Outputs a link to h2vx.com that will let the user download the vcard
|
145
|
-
# at the passed URL.
|
146
|
-
#
|
147
|
-
# OPTIONS
|
148
|
-
# * :text - The link text (default is "Download vCard")
|
149
|
-
# * Any other passed options will be treated as HTML attributes.
|
150
|
-
#
|
151
|
-
# EXAMPLE
|
152
|
-
# <%# In Rails, request.request_uri returns the URL of this page %>
|
153
|
-
# <%= card.download_link request.request_uri %>
|
154
|
-
#
|
155
|
-
def download_link(url, opts = {})
|
156
|
-
str = opts.delete(:text) || "Download vCard"
|
157
|
-
new_url = "http://h2vx.com/vcf/" + url.gsub("http://", '')
|
158
|
-
content_tag(str, merge_html_attrs({:tag => :a, :href => new_url, :type => 'text/directory'}, opts))
|
159
|
-
end
|
160
|
-
|
161
|
-
# Opens a new block for a nested vAddress.
|
162
|
-
#
|
163
|
-
# OPTIONS:
|
164
|
-
# * :type - A string that specifies the type of address('home', 'work', etc)
|
165
|
-
# * :tag - The HTML wrapper element (defaults to :div)
|
166
|
-
# * Any other passed options will be treated as HTML attributes.
|
167
|
-
#
|
168
|
-
# EXAMPLE:
|
169
|
-
# <% card.address :type => 'work', :id => 'my_adr' do |adr| %>
|
170
|
-
# I live at <%= adr.street "123 Main St" %>.
|
171
|
-
# <% end %>
|
172
|
-
#
|
173
|
-
def address(opts = {}, &block)
|
174
|
-
adr = Microformats::Address.new(@template)
|
175
|
-
adr.run(opts, &block)
|
176
|
-
end
|
177
|
-
end
|