microformats 0.3 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/CHANGELOG.rdoc
DELETED
data/LICENSE
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
Copyright (c) 2010 Chris Powers
|
|
2
|
-
|
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
-
a copy of this software and associated documentation files (the
|
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
-
the following conditions:
|
|
10
|
-
|
|
11
|
-
The above copyright notice and this permission notice shall be
|
|
12
|
-
included in all copies or substantial portions of the Software.
|
|
13
|
-
|
|
14
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
DELETED
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
= Microformats
|
|
2
|
-
|
|
3
|
-
<b>STILL IN DEVELOPMENT, IT SHOULD WORK, BUT USE AT YOUR OWN RISK!</b>
|
|
4
|
-
|
|
5
|
-
<em>Created by Chris Powers, September 11, 2010</em>
|
|
6
|
-
|
|
7
|
-
== Two Great Tastes, One Great Library
|
|
8
|
-
|
|
9
|
-
The goal of this Microformats library is to give the developer
|
|
10
|
-
a series of simple view helper methods to richly markup their
|
|
11
|
-
HTML documents using both the older Microformats standard and
|
|
12
|
-
the new HTML5 Microdata standard.
|
|
13
|
-
|
|
14
|
-
By using microformats, you are opening your data up to Google
|
|
15
|
-
and other consumers for easy and intelligent consumption. In
|
|
16
|
-
the future, Google plans on making consumed microdata
|
|
17
|
-
directly searchable, which yields all sorts of new potential
|
|
18
|
-
for relevant results.
|
|
19
|
-
|
|
20
|
-
== Installation
|
|
21
|
-
|
|
22
|
-
Install the Microformats gem as usual:
|
|
23
|
-
|
|
24
|
-
gem install microformats
|
|
25
|
-
|
|
26
|
-
== Getting Started
|
|
27
|
-
|
|
28
|
-
To use Microformats, first include the Microformats::Helper
|
|
29
|
-
mixin into your view layer, like this in Rails:
|
|
30
|
-
|
|
31
|
-
# in app/helpers/application_helper.rb
|
|
32
|
-
module Application Helper
|
|
33
|
-
include Microformats::Helpers
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
== Usage: vCards and Addresses
|
|
37
|
-
|
|
38
|
-
You can easily markup a person and/or organization using the
|
|
39
|
-
<tt>vcard</tt> helper method. This will use both the hCard Microformat
|
|
40
|
-
and the http://www.data-vocabulary.org/Person microdata.
|
|
41
|
-
|
|
42
|
-
<b>PLEASE NOTE:</b> These two microdata standards do
|
|
43
|
-
not support the same fields. For example, hCard gives a person
|
|
44
|
-
telephone numbers and email addresses. The Person microdata only
|
|
45
|
-
gives organizations a single telephone number and has no support
|
|
46
|
-
for email.
|
|
47
|
-
|
|
48
|
-
vCards can embed addresses using the Microformats::Vcard#address
|
|
49
|
-
method, which gives you a block to run with a new
|
|
50
|
-
Microformats::Address object.
|
|
51
|
-
|
|
52
|
-
EXAMPLE (using ERB):
|
|
53
|
-
|
|
54
|
-
<% vcard do |card| %>
|
|
55
|
-
<%= card.photo "/images/me.jpg", :size => '200x300' %>
|
|
56
|
-
<%= card.name "John Doe" %>
|
|
57
|
-
<%= card.url "Visit my Site", :href => "http://mydomain.com" %>
|
|
58
|
-
<%= card.phone "999.888.7766", :type => 'Home' %>
|
|
59
|
-
<%= card.phone "111.222.3344", :type => 'Work' %>
|
|
60
|
-
<%= card.email "me@mydomain.com", :type => 'Home' %>
|
|
61
|
-
|
|
62
|
-
I work at <%= card.company "Acme Co." %>
|
|
63
|
-
<% card.address(:type => 'Work') do |adr| %>
|
|
64
|
-
<%= adr.street "123 Main" %>
|
|
65
|
-
<%= adr.city "Chicago" %>, <%= adr.state 'IL' %> <%= adr.zip '60010' %>
|
|
66
|
-
<% end %>
|
|
67
|
-
<%= card.download_link "http://mydomain.com" %>
|
|
68
|
-
<% end %>
|
|
69
|
-
|
|
70
|
-
This will output the following markup:
|
|
71
|
-
|
|
72
|
-
<div class='vcard' itemscope='itemscope' itemtype='http://data-vocabulary.org/Person'>
|
|
73
|
-
<img class='photo' itemprop='photo' src='/images/me.jpg' width='200' height='300' />
|
|
74
|
-
<span class='fn' itemprop='name'>John Doe</span>
|
|
75
|
-
<a class='url' href='http://mydomain.com' itemprop='url'>Visit my Site</a>
|
|
76
|
-
<span class='tel'><span class='type'><span class='value-title' title='Home'></span></span>999.888.7766</span>
|
|
77
|
-
<span class='tel'><span class='type'><span class='value-title' title='Work'></span></span> 111.222.3344</span>
|
|
78
|
-
<a class='email' href='mailto:me@mydomain.com'><span class='value-title' title='Home'></span>me@mydomain.com</span>
|
|
79
|
-
|
|
80
|
-
I work at <span class='org' itemprop='affiliation'>Acme Co.</span>
|
|
81
|
-
<div class='adr' itemscope='itemscope' itemtype='http://data-vocabulary.org/Address'>
|
|
82
|
-
<span class='type'><span class='value-title' title='Work'></span></span>
|
|
83
|
-
<span class='street-address' itemprop='street-address'>123 Main</span>
|
|
84
|
-
<span class='locality' itemprop='locality'>Chicago</span>, <span class='region' itemprop='region'>IL</span> <span class='postal-code' itemprop='postal-code'>60010</span>
|
|
85
|
-
</div>
|
|
86
|
-
<a href='http://h2vx.com/vcf/mydomain.com/page' type='text/directory'>Download vCard</a>
|
|
87
|
-
</div>
|
|
88
|
-
|
|
89
|
-
While these helper methods default to using <span> tags
|
|
90
|
-
(and <a> tags as appropriate), you can easily customize
|
|
91
|
-
the tag used for any given piece of microdata by using the
|
|
92
|
-
<tt>:tag</tt> option:
|
|
93
|
-
|
|
94
|
-
<%= card.name "John Doe", :tag => :h1 %>
|
|
95
|
-
|
|
96
|
-
Also note that you get the <tt>download_link</tt> method
|
|
97
|
-
that builds a link to h2vx.com that will automatically let
|
|
98
|
-
the user download vCards from whatever page url you pass in.
|
|
99
|
-
Usually you will just want to pass in the page that you are
|
|
100
|
-
currently on, so this is a quick way to do this in Rails:
|
|
101
|
-
|
|
102
|
-
<%= card.download_link request.request_uri %>
|
|
103
|
-
|
|
104
|
-
== Usage: Calendars and Events
|
|
105
|
-
|
|
106
|
-
Calendars with many events can be represented using the
|
|
107
|
-
Microformats::Calendar and Microformats::Event classes.
|
|
108
|
-
This employs the hCal and hEvent microformats along with the
|
|
109
|
-
http://www.data-vocabulary.org/Event microdata.
|
|
110
|
-
|
|
111
|
-
<b>NOTE:</b> An Event can use a nested vCard to represent
|
|
112
|
-
its location information.
|
|
113
|
-
|
|
114
|
-
EXAMPLE:
|
|
115
|
-
|
|
116
|
-
<% vcalendar :id => "my_calendar" do |cal| %>
|
|
117
|
-
<h1>Upcoming Events</h1>
|
|
118
|
-
<% cal.event do |event| %>
|
|
119
|
-
<h2><%= event.url(event.name("Happy Hour"), :href => "http://meetup.com/happyhour") %></h2>
|
|
120
|
-
<%= event.photo "/images/happy_hour.jpg", :size => "250x150" %>
|
|
121
|
-
<%= event.description "Come hang out with us for half price drinks at lots of fun!" %>
|
|
122
|
-
<span class='time_range'>
|
|
123
|
-
From <%= event.starts_at "October 30, 2010 at 7:30PM" %> -
|
|
124
|
-
<%= event.ends_at "October 30, 2010 at 10:00PM", :text => "10:00PM" %>
|
|
125
|
-
</span>
|
|
126
|
-
<% event.location do |card| %>
|
|
127
|
-
<%= card.url(card.company("Frank's Bar", :is_company => true), :href => "http://franksbar.com") %>
|
|
128
|
-
<% card.address do |adr| %>
|
|
129
|
-
<%= adr.street "784 N Main St" %><br />
|
|
130
|
-
<%= adr.city "Chicago" %>, <%= adr.state "IL" %> <%= adr.zip "60016" %>
|
|
131
|
-
<% end %>
|
|
132
|
-
<% end %>
|
|
133
|
-
<% end %>
|
|
134
|
-
<!-- More events could be added... -->
|
|
135
|
-
<% end %>
|
|
136
|
-
|
|
137
|
-
== Resources
|
|
138
|
-
|
|
139
|
-
* http://www.data-vocabulary.org
|
|
140
|
-
* http://microformats.org
|
|
141
|
-
|
|
142
|
-
== Care to Help?
|
|
143
|
-
|
|
144
|
-
There are still a lot of standards that need to be implemented into
|
|
145
|
-
this library, including but not limited to: Events, Products, Reviews,
|
|
146
|
-
Organizations. I will continue to work on these, but I'd be happy to
|
|
147
|
-
accept pull requests!
|
data/lib/address.rb
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
class Microformats::Address
|
|
2
|
-
include Microformats::FormattingHelpers
|
|
3
|
-
|
|
4
|
-
def initialize(template)
|
|
5
|
-
@template = template
|
|
6
|
-
@default_tag = :span
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
# You can directly initialize and run this class, but it's easier
|
|
10
|
-
# to use the Microformats::Helpers#vaddress helper method or the
|
|
11
|
-
# Microformats::Vcard#address method.
|
|
12
|
-
#
|
|
13
|
-
# OPTIONS:
|
|
14
|
-
# * :type - A string that specifies the type of address('home', 'work', etc)
|
|
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
|
-
type = opts[:type] ? self.type(opts.delete(:type)) : nil
|
|
20
|
-
opts[:class] = combine_class_names('adr', opts[:class])
|
|
21
|
-
opts[:itemscope] = 'itemscope'
|
|
22
|
-
opts[:itemtype] = 'http://data-vocabulary.org/Address'
|
|
23
|
-
opts[:tag] ||= :div
|
|
24
|
-
concat_tag(opts) do
|
|
25
|
-
concat type if type
|
|
26
|
-
block.call(self)
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
# Outputs markup for the type of address ('work', 'home', etc.)
|
|
31
|
-
# There will be no visible text unless provided with the :text option.
|
|
32
|
-
#
|
|
33
|
-
# <em>NOTE: You get this for free with the :type option of
|
|
34
|
-
# Microformats::Helpers#vaddress, Microformats::Vcard#address and #run methods.</em>
|
|
35
|
-
#
|
|
36
|
-
# OPTIONS
|
|
37
|
-
# * :text - String, the text you want displayed as a text node (default is '')
|
|
38
|
-
# * Any other passed options will be treated as HTML attributes.
|
|
39
|
-
#
|
|
40
|
-
def type(str, opts = {})
|
|
41
|
-
inner = content_tag('', :class => 'value-title', :title => str)
|
|
42
|
-
text = opts.delete(:text) || ''
|
|
43
|
-
content_tag(inner + text, merge_html_attrs({:class => 'type'}, opts))
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
# Outputs the passed string as a street address.
|
|
47
|
-
#
|
|
48
|
-
# OPTIONS
|
|
49
|
-
# * :tag - The HTML wrapper element (defaults to :span)
|
|
50
|
-
# * Any other passed options will be treated as HTML attributes.
|
|
51
|
-
#
|
|
52
|
-
def street(str, opts = {})
|
|
53
|
-
content_tag(str, merge_html_attrs({:class => 'street-address', :itemprop => 'street-address'}, opts))
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
# Outputs the passed string as a city.
|
|
57
|
-
#
|
|
58
|
-
# OPTIONS
|
|
59
|
-
# * :tag - The HTML wrapper element (defaults to :span)
|
|
60
|
-
# * Any other passed options will be treated as HTML attributes.
|
|
61
|
-
#
|
|
62
|
-
def city(str, opts = {})
|
|
63
|
-
content_tag(str, merge_html_attrs({:class => 'locality', :itemprop => 'locality'}, opts))
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
# Outputs the passed string as a state.
|
|
67
|
-
#
|
|
68
|
-
# OPTIONS
|
|
69
|
-
# * :tag - The HTML wrapper element (defaults to :span)
|
|
70
|
-
# * Any other passed options will be treated as HTML attributes.
|
|
71
|
-
#
|
|
72
|
-
def state(str, opts = {})
|
|
73
|
-
content_tag(str, merge_html_attrs({:class => 'region', :itemprop => 'region'}, opts))
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
# Outputs the passed string as a postal code.
|
|
77
|
-
#
|
|
78
|
-
# OPTIONS
|
|
79
|
-
# * :tag - The HTML wrapper element (defaults to :span)
|
|
80
|
-
# * Any other passed options will be treated as HTML attributes.
|
|
81
|
-
#
|
|
82
|
-
def zip(str, opts = {})
|
|
83
|
-
content_tag(str, merge_html_attrs({:class => 'postal-code', :itemprop => 'postal-code'}, opts))
|
|
84
|
-
end
|
|
85
|
-
alias_method :postal_code, :zip
|
|
86
|
-
|
|
87
|
-
# Outputs the passed string as a country.
|
|
88
|
-
#
|
|
89
|
-
# OPTIONS
|
|
90
|
-
# * :tag - The HTML wrapper element (defaults to :span)
|
|
91
|
-
# * Any other passed options will be treated as HTML attributes.
|
|
92
|
-
#
|
|
93
|
-
def country(str, opts = {})
|
|
94
|
-
content_tag(str, merge_html_attrs({:class => 'country-name', :itemprop => 'country-name'}, opts))
|
|
95
|
-
end
|
|
96
|
-
|
|
97
|
-
end
|
data/lib/calendar.rb
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
class Microformats::Calendar
|
|
2
|
-
include Microformats::FormattingHelpers
|
|
3
|
-
|
|
4
|
-
def initialize(template)
|
|
5
|
-
@template = template
|
|
6
|
-
@default_tag = :span
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
# You can directly initialize and run this class, but it's easier
|
|
10
|
-
# to use the Microformats::Helpers#vcalendar helper method.
|
|
11
|
-
#
|
|
12
|
-
# OPTIONS:
|
|
13
|
-
# * :tag - The HTML wrapper element (defaults to :div)
|
|
14
|
-
# * Any other passed options will be treated as HTML attributes.
|
|
15
|
-
#
|
|
16
|
-
def run(opts = {}, &block)
|
|
17
|
-
opts[:class] = combine_class_names('vcalendar', opts[:class])
|
|
18
|
-
opts[:tag] ||= :div
|
|
19
|
-
concat_tag(opts) do
|
|
20
|
-
block.call(self)
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
# Creates a vEvent with the given options and a block.
|
|
25
|
-
#
|
|
26
|
-
# OPTIONS:
|
|
27
|
-
# * :tag - The HTML wrapper element (defaults to :div)
|
|
28
|
-
# * Any other passed options will be treated as HTML attributes.
|
|
29
|
-
#
|
|
30
|
-
# EXAMPLE:
|
|
31
|
-
# <% calendar.event :id => 'my_event' do |event| %>
|
|
32
|
-
# This event is called <%= event.name "Cool Event" %>.
|
|
33
|
-
# <% end %>
|
|
34
|
-
#
|
|
35
|
-
def event(opts = {}, &block)
|
|
36
|
-
ev = Microformats::Event.new(@template)
|
|
37
|
-
opts[:class] = combine_class_names('vevent', opts[:class])
|
|
38
|
-
ev.run(opts, &block)
|
|
39
|
-
end
|
|
40
|
-
end
|
data/lib/event.rb
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
class Microformats::Event
|
|
2
|
-
include Microformats::FormattingHelpers
|
|
3
|
-
|
|
4
|
-
def initialize(template)
|
|
5
|
-
@template = template
|
|
6
|
-
@default_tag = :span
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
# You can directly initialize and run this class, but it's easier
|
|
10
|
-
# to use the Microformats::Helpers#vevent helper method or the
|
|
11
|
-
# Microformats::Calendar#event method.
|
|
12
|
-
#
|
|
13
|
-
# OPTIONS:
|
|
14
|
-
# * :tag - The HTML wrapper element (defaults to :div)
|
|
15
|
-
# * Any other passed options will be treated as HTML attributes.
|
|
16
|
-
#
|
|
17
|
-
def run(opts = {}, &block)
|
|
18
|
-
opts[:class] = combine_class_names('vevent', opts[:class])
|
|
19
|
-
opts[:itemscope] = 'itemscope'
|
|
20
|
-
opts[:itemtype] = 'http://data-vocabulary.org/Event'
|
|
21
|
-
opts[:tag] ||= :div
|
|
22
|
-
concat_tag(opts) do
|
|
23
|
-
block.call(self)
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
# Marks up an event's name.
|
|
28
|
-
#
|
|
29
|
-
# OPTIONS:
|
|
30
|
-
# * :tag - The HTML wrapper element (defaults to :span)
|
|
31
|
-
# * Any other passed options will be treated as HTML attributes.
|
|
32
|
-
#
|
|
33
|
-
def name(str, opts={})
|
|
34
|
-
content_tag(str, merge_html_attrs({:itemprop => 'summary', :class => 'summary'}, opts))
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
# Marks up the event's URL. By default, it will output an <a> tag using
|
|
38
|
-
# the passed in string as both the href and the text. If the :href option
|
|
39
|
-
# is passed, then the string argument is treated as text.
|
|
40
|
-
#
|
|
41
|
-
# OPTIONS:
|
|
42
|
-
# * :href - If passed, the string argument will be treated as the text node.
|
|
43
|
-
# * :tag - The HTML wrapper element (defaults to :span)
|
|
44
|
-
# * Any other passed options will be treated as HTML attributes.
|
|
45
|
-
#
|
|
46
|
-
# EXAMPLES:
|
|
47
|
-
# event.url('http://google.com') #=> <a class='url' href='http://google.com' itemprop='url'>http://google.com</a>
|
|
48
|
-
# event.url('Google', :href => 'http://google.com') #=> <a class='url' href='http://google.com' itemprop='url'>Google</a>
|
|
49
|
-
# event.url('http://google.com', :tag => :span) #=> <span class='url' itemprop='url'>http://google.com</span>
|
|
50
|
-
#
|
|
51
|
-
def url(str, opts = {})
|
|
52
|
-
if opts[:href]
|
|
53
|
-
content_tag(str, merge_html_attrs({:tag => :a, :class => 'url', :itemprop => 'url'}, opts))
|
|
54
|
-
elsif opts[:tag]
|
|
55
|
-
content_tag(str, merge_html_attrs({:class => 'url', :itemprop => 'url'}, opts))
|
|
56
|
-
else
|
|
57
|
-
content_tag(str, merge_html_attrs({:tag => :a, :class => 'url', :href => str, :itemprop => 'url'}, opts))
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
# Marks up the event photo as an <img> tag. Takes the image URL as the first argument.
|
|
62
|
-
#
|
|
63
|
-
# OPTIONS
|
|
64
|
-
# * :size - Pass a string with WIDTHxHEIGHT like "200x100" in lieu of the :width and :height options.
|
|
65
|
-
# * Any other passed options will be treated as HTML attributes.
|
|
66
|
-
#
|
|
67
|
-
def photo(str, opts = {})
|
|
68
|
-
if size = opts.delete(:size)
|
|
69
|
-
opts[:width], opts[:height] = size.split('x')
|
|
70
|
-
end
|
|
71
|
-
content_tag(nil, merge_html_attrs({:tag => :img, :class => 'photo', :itemprop => 'photo', :src => str}, opts))
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
# Marks up an event's description.
|
|
75
|
-
#
|
|
76
|
-
# OPTIONS:
|
|
77
|
-
# * :tag - The HTML wrapper element (defaults to :span)
|
|
78
|
-
# * Any other passed options will be treated as HTML attributes.
|
|
79
|
-
#
|
|
80
|
-
def description(str, opts={})
|
|
81
|
-
content_tag(str, merge_html_attrs({:itemprop => 'description', :class => 'description'}, opts))
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
# Marks up the event's start time/date. Accepts either a Time object
|
|
85
|
-
# or a time String as the first argument. By default, the text node
|
|
86
|
-
# will be the date and time output like "Oct 20, 2010 at 7:30PM", but
|
|
87
|
-
# this can be overridden by the :text option.
|
|
88
|
-
#
|
|
89
|
-
# OPTIONS:
|
|
90
|
-
# * :text - String, will be displayed as the text node.
|
|
91
|
-
# * Any other passed options will be treated as HTML attributes.
|
|
92
|
-
#
|
|
93
|
-
def starts_at(time_or_str, opts={})
|
|
94
|
-
if time_or_str.is_a?(String)
|
|
95
|
-
time = Time.parse(time_or_str)
|
|
96
|
-
encoded_time = encode_time(time)
|
|
97
|
-
humanized_time = opts.delete(:text) || time_or_str
|
|
98
|
-
else
|
|
99
|
-
encoded_time = encode_time(time_or_str)
|
|
100
|
-
humanized_time = opts.delete(:text) || humanize_time(time_or_str)
|
|
101
|
-
end
|
|
102
|
-
inner_span = content_tag('', :class => 'value-title', :title => encoded_time)
|
|
103
|
-
content_tag(inner_span + humanized_time, merge_html_attrs({:tag => :time, :itemprop => 'startDate', :class => 'dtstart', :datetime => encoded_time}, opts))
|
|
104
|
-
end
|
|
105
|
-
|
|
106
|
-
# Marks up the event's end time/date. Accepts either a Time object
|
|
107
|
-
# or a time String as the first argument. By default, the text node
|
|
108
|
-
# will be the date and time output like "Oct 20, 2010 at 7:30PM", but
|
|
109
|
-
# this can be overridden by the :text option.
|
|
110
|
-
#
|
|
111
|
-
# OPTIONS:
|
|
112
|
-
# * :text - String, will be displayed as the text node.
|
|
113
|
-
# * Any other passed options will be treated as HTML attributes.
|
|
114
|
-
#
|
|
115
|
-
def ends_at(time_or_str, opts={})
|
|
116
|
-
if time_or_str.is_a?(String)
|
|
117
|
-
time = Time.parse(time_or_str)
|
|
118
|
-
encoded_time = encode_time(time)
|
|
119
|
-
humanized_time = opts.delete(:text) || time_or_str
|
|
120
|
-
else
|
|
121
|
-
encoded_time = encode_time(time_or_str)
|
|
122
|
-
humanized_time = opts.delete(:text) || humanize_time(time_or_str)
|
|
123
|
-
end
|
|
124
|
-
inner_span = content_tag('', :class => 'value-title', :title => encoded_time)
|
|
125
|
-
content_tag(inner_span + humanized_time, merge_html_attrs({:tag => :time, :itemprop => 'endDate', :class => 'dtend', :datetime => encoded_time}, opts))
|
|
126
|
-
end
|
|
127
|
-
|
|
128
|
-
# Marks up an event's category name.
|
|
129
|
-
#
|
|
130
|
-
# OPTIONS:
|
|
131
|
-
# * :tag - The HTML wrapper element (defaults to :span)
|
|
132
|
-
# * Any other passed options will be treated as HTML attributes.
|
|
133
|
-
#
|
|
134
|
-
def category(str, opts = {})
|
|
135
|
-
content_tag(str, merge_html_attrs({:itemprop => 'eventType', :class => 'category'}, opts))
|
|
136
|
-
end
|
|
137
|
-
|
|
138
|
-
# Creates a vCard with the given options and a block to represent
|
|
139
|
-
# the event's location.
|
|
140
|
-
#
|
|
141
|
-
# OPTIONS:
|
|
142
|
-
# * :tag - The HTML wrapper element (defaults to :div)
|
|
143
|
-
# * Any other passed options will be treated as HTML attributes.
|
|
144
|
-
#
|
|
145
|
-
# EXAMPLE:
|
|
146
|
-
# <% event.location :id => 'my_location' do |card| %>
|
|
147
|
-
# We will be meeting at the <%= card.company "Obtiva" %> office.
|
|
148
|
-
# <% end %>
|
|
149
|
-
#
|
|
150
|
-
def location(opts = {}, &block)
|
|
151
|
-
card = Microformats::Vcard.new(@template)
|
|
152
|
-
opts[:class] = combine_class_names('location', opts[:class])
|
|
153
|
-
card.run(opts, &block)
|
|
154
|
-
end
|
|
155
|
-
|
|
156
|
-
end
|