microformats 0.3 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +18 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/Guardfile +5 -0
- data/LICENSE.md +36 -0
- data/README.md +228 -0
- data/Rakefile +7 -25
- data/lib/microformats.rb +25 -9
- data/lib/microformats/absolute_uri.rb +30 -0
- data/lib/microformats/format_parser.rb +343 -0
- data/lib/microformats/parser.rb +105 -0
- data/lib/microformats/parser_core.rb +343 -0
- data/lib/microformats/property_parser.rb +122 -0
- data/lib/microformats/results/collection.rb +121 -0
- data/lib/microformats/results/parser_result.rb +111 -0
- data/lib/microformats/results/property_set.rb +87 -0
- data/lib/microformats/time_property_parser.rb +161 -0
- data/lib/microformats/version.rb +3 -0
- data/microformats.gemspec +37 -0
- data/spec/lib/microformats/absolute_uri_spec.rb +48 -0
- data/spec/lib/microformats/parser_spec.rb +72 -0
- data/spec/lib/microformats_spec.rb +33 -0
- data/spec/spec_helper.rb +10 -0
- data/spec/support/cases/microformats.org/microformats-2/microformats-2-0.html +2 -0
- data/spec/support/cases/microformats.org/microformats-2/microformats-2-0.js +9 -0
- data/spec/support/cases/microformats.org/microformats-2/microformats-2-1.html +2 -0
- data/spec/support/cases/microformats.org/microformats-2/microformats-2-1.js +10 -0
- data/spec/support/cases/microformats.org/microformats-2/microformats-2-2.html +5 -0
- data/spec/support/cases/microformats.org/microformats-2/microformats-2-2.js +11 -0
- data/spec/support/cases/microformats.org/microformats-2/microformats-2-3.html +17 -0
- data/spec/support/cases/microformats.org/microformats-2/microformats-2-3.js +20 -0
- data/spec/support/cases/microformats.org/microformats-2/microformats-2-4.html +16 -0
- data/spec/support/cases/microformats.org/microformats-2/microformats-2-4.js +24 -0
- data/spec/support/cases/microformats.org/microformats-2/microformats-2-5.html +7 -0
- data/spec/support/cases/microformats.org/microformats-2/microformats-2-5.js +11 -0
- data/spec/support/cases/microformats.org/microformats-2/microformats-2-6.html +9 -0
- data/spec/support/cases/microformats.org/microformats-2/microformats-2-6.js +18 -0
- data/spec/support/cases/microformats.org/microformats-2/microformats-2-7.html +9 -0
- data/spec/support/cases/microformats.org/microformats-2/microformats-2-7.js +18 -0
- data/spec/support/cases/microformats.org/microformats-2/microformats-2-8.html +9 -0
- data/spec/support/cases/microformats.org/microformats-2/microformats-2-8.js +17 -0
- data/spec/support/cases/microformats.org/microformats-2/microformats-2-9.html +9 -0
- data/spec/support/cases/microformats.org/microformats-2/microformats-2-9.js +17 -0
- data/spec/support/lib/microformats/implied_property/name-fail.html +60 -0
- data/spec/support/lib/microformats/implied_property/name-pass.html +30 -0
- data/spec/support/lib/microformats/implied_property/photo-fail.html +60 -0
- data/spec/support/lib/microformats/implied_property/photo-pass.html +30 -0
- data/spec/support/lib/microformats/implied_property/url-fail.html +18 -0
- data/spec/support/lib/microformats/implied_property/url-pass.html +12 -0
- data/spec/support/lib/microformats/implied_property/url-relative.html +13 -0
- data/spec/support/lib/microformats/implied_property/url-unnormalized.html +12 -0
- data/spec/support/lib/microformats/nested-format-with-property-of-same-name.html +13 -0
- data/spec/support/lib/microformats/nested-format-with-property-of-same-name.js +16 -0
- data/spec/support/lib/microformats/nested-format-with-property.html +12 -0
- data/spec/support/lib/microformats/nested-format-with-property.js +16 -0
- data/spec/support/lib/microformats/nested-format-without-property.html +13 -0
- data/spec/support/lib/microformats/nested-property.html +12 -0
- data/spec/support/lib/microformats/nested-property.js +10 -0
- data/spec/support/lib/microformats/rels-that-drop-the-base.html +11 -0
- data/spec/support/lib/microformats/rels-with-unnormalized-urls.html +11 -0
- data/spec/support/lib/microformats/rels.html +12 -0
- data/spec/support/lib/microformats/rels.js +13 -0
- data/spec/support/lib/microformats/simple.html +23 -0
- data/spec/support/lib/microformats/simple.js +11 -0
- data/vendor/tests/.gitignore +25 -0
- data/vendor/tests/LICENSE.md +36 -0
- data/vendor/tests/README.md +48 -0
- data/vendor/tests/app.js +84 -0
- data/vendor/tests/composer.json +5 -0
- data/vendor/tests/css/testsuite.css +159 -0
- data/vendor/tests/interface.js +18 -0
- data/vendor/tests/package.json +27 -0
- data/vendor/tests/tests/microformats-mixed/h-card/change-log.html +63 -0
- data/vendor/tests/tests/microformats-mixed/h-card/mixedpropertries.html +14 -0
- data/vendor/tests/tests/microformats-mixed/h-card/mixedpropertries.json +22 -0
- data/vendor/tests/tests/microformats-mixed/h-card/tworoots.html +1 -0
- data/vendor/tests/tests/microformats-mixed/h-card/tworoots.json +10 -0
- data/vendor/tests/tests/microformats-mixed/h-entry/mixedroots.html +16 -0
- data/vendor/tests/tests/microformats-mixed/h-entry/mixedroots.json +38 -0
- data/vendor/tests/tests/microformats-mixed/h-resume/change-log.html +68 -0
- data/vendor/tests/tests/microformats-mixed/h-resume/mixedroots.html +16 -0
- data/vendor/tests/tests/microformats-mixed/h-resume/mixedroots.json +31 -0
- data/vendor/tests/tests/microformats-v1/adr/change-log.html +63 -0
- data/vendor/tests/tests/microformats-v1/adr/simpleproperties.html +8 -0
- data/vendor/tests/tests/microformats-v1/adr/simpleproperties.json +15 -0
- data/vendor/tests/tests/microformats-v1/geo/abbrpattern.html +5 -0
- data/vendor/tests/tests/microformats-v1/geo/abbrpattern.json +11 -0
- data/vendor/tests/tests/microformats-v1/geo/change-log.1.html +78 -0
- data/vendor/tests/tests/microformats-v1/geo/change-log.html +63 -0
- data/vendor/tests/tests/microformats-v1/geo/hidden.html +10 -0
- data/vendor/tests/tests/microformats-v1/geo/hidden.json +11 -0
- data/vendor/tests/tests/microformats-v1/geo/simpleproperties.html +6 -0
- data/vendor/tests/tests/microformats-v1/geo/simpleproperties.json +11 -0
- data/vendor/tests/tests/microformats-v1/geo/valuetitleclass.html +11 -0
- data/vendor/tests/tests/microformats-v1/geo/valuetitleclass.json +11 -0
- data/vendor/tests/tests/microformats-v1/hcalendar/ampm.html +41 -0
- data/vendor/tests/tests/microformats-v1/hcalendar/ampm.json +21 -0
- data/vendor/tests/tests/microformats-v1/hcalendar/attendees.html +13 -0
- data/vendor/tests/tests/microformats-v1/hcalendar/attendees.json +37 -0
- data/vendor/tests/tests/microformats-v1/hcalendar/change-log.html +68 -0
- data/vendor/tests/tests/microformats-v1/hcalendar/combining.html +15 -0
- data/vendor/tests/tests/microformats-v1/hcalendar/combining.json +31 -0
- data/vendor/tests/tests/microformats-v1/hcalendar/concatenate.html +7 -0
- data/vendor/tests/tests/microformats-v1/hcalendar/concatenate.json +12 -0
- data/vendor/tests/tests/microformats-v1/hcalendar/time.html +44 -0
- data/vendor/tests/tests/microformats-v1/hcalendar/time.json +22 -0
- data/vendor/tests/tests/microformats-v1/hcard/change-log.html +68 -0
- data/vendor/tests/tests/microformats-v1/hcard/email.html +14 -0
- data/vendor/tests/tests/microformats-v1/hcard/email.json +11 -0
- data/vendor/tests/tests/microformats-v1/hcard/format.html +6 -0
- data/vendor/tests/tests/microformats-v1/hcard/format.json +11 -0
- data/vendor/tests/tests/microformats-v1/hcard/hyperlinkedphoto.html +3 -0
- data/vendor/tests/tests/microformats-v1/hcard/hyperlinkedphoto.json +8 -0
- data/vendor/tests/tests/microformats-v1/hcard/justahyperlink.html +1 -0
- data/vendor/tests/tests/microformats-v1/hcard/justahyperlink.json +8 -0
- data/vendor/tests/tests/microformats-v1/hcard/justaname.html +1 -0
- data/vendor/tests/tests/microformats-v1/hcard/justaname.json +8 -0
- data/vendor/tests/tests/microformats-v1/hcard/multiple.html +74 -0
- data/vendor/tests/tests/microformats-v1/hcard/multiple.json +65 -0
- data/vendor/tests/tests/microformats-v1/hcard/name.html +11 -0
- data/vendor/tests/tests/microformats-v1/hcard/name.json +15 -0
- data/vendor/tests/tests/microformats-v1/hcard/single.html +14 -0
- data/vendor/tests/tests/microformats-v1/hcard/single.json +24 -0
- data/vendor/tests/tests/microformats-v1/hentry/change-log.html +73 -0
- data/vendor/tests/tests/microformats-v1/hentry/summarycontent.html +20 -0
- data/vendor/tests/tests/microformats-v1/hentry/summarycontent.json +24 -0
- data/vendor/tests/tests/microformats-v1/hfeed/simple.html +30 -0
- data/vendor/tests/tests/microformats-v1/hfeed/simple.json +49 -0
- data/vendor/tests/tests/microformats-v1/hnews/all.html +37 -0
- data/vendor/tests/tests/microformats-v1/hnews/all.json +74 -0
- data/vendor/tests/tests/microformats-v1/hnews/change-log.html +72 -0
- data/vendor/tests/tests/microformats-v1/hnews/minimum.html +25 -0
- data/vendor/tests/tests/microformats-v1/hnews/minimum.json +48 -0
- data/vendor/tests/tests/microformats-v1/hproduct/aggregate.html +26 -0
- data/vendor/tests/tests/microformats-v1/hproduct/aggregate.json +52 -0
- data/vendor/tests/tests/microformats-v1/hproduct/change-log.html +62 -0
- data/vendor/tests/tests/microformats-v1/hproduct/simpleproperties.html +13 -0
- data/vendor/tests/tests/microformats-v1/hproduct/simpleproperties.json +33 -0
- data/vendor/tests/tests/microformats-v1/hresume/affiliation.html +12 -0
- data/vendor/tests/tests/microformats-v1/hresume/affiliation.json +25 -0
- data/vendor/tests/tests/microformats-v1/hresume/change-log.html +73 -0
- data/vendor/tests/tests/microformats-v1/hresume/contact.html +18 -0
- data/vendor/tests/tests/microformats-v1/hresume/contact.json +32 -0
- data/vendor/tests/tests/microformats-v1/hresume/education.html +13 -0
- data/vendor/tests/tests/microformats-v1/hresume/education.json +29 -0
- data/vendor/tests/tests/microformats-v1/hresume/skill.html +12 -0
- data/vendor/tests/tests/microformats-v1/hresume/skill.json +33 -0
- data/vendor/tests/tests/microformats-v1/hresume/work.html +16 -0
- data/vendor/tests/tests/microformats-v1/hresume/work.json +30 -0
- data/vendor/tests/tests/microformats-v1/hreview-aggregate/change-log.html +67 -0
- data/vendor/tests/tests/microformats-v1/hreview-aggregate/hcard.html +18 -0
- data/vendor/tests/tests/microformats-v1/hreview-aggregate/hcard.json +31 -0
- data/vendor/tests/tests/microformats-v1/hreview-aggregate/justahyperlink.html +6 -0
- data/vendor/tests/tests/microformats-v1/hreview-aggregate/justahyperlink.json +19 -0
- data/vendor/tests/tests/microformats-v1/hreview-aggregate/vevent.html +13 -0
- data/vendor/tests/tests/microformats-v1/hreview-aggregate/vevent.json +22 -0
- data/vendor/tests/tests/microformats-v1/hreview/change-log.html +73 -0
- data/vendor/tests/tests/microformats-v1/hreview/item.html +8 -0
- data/vendor/tests/tests/microformats-v1/hreview/item.json +19 -0
- data/vendor/tests/tests/microformats-v1/hreview/vcard.html +23 -0
- data/vendor/tests/tests/microformats-v1/hreview/vcard.json +58 -0
- data/vendor/tests/tests/microformats-v1/includes/change-log.html +72 -0
- data/vendor/tests/tests/microformats-v1/includes/hcarditemref.html +16 -0
- data/vendor/tests/tests/microformats-v1/includes/hcarditemref.json +49 -0
- data/vendor/tests/tests/microformats-v1/includes/heventitemref.html +25 -0
- data/vendor/tests/tests/microformats-v1/includes/heventitemref.json +33 -0
- data/vendor/tests/tests/microformats-v1/includes/hyperlink.html +18 -0
- data/vendor/tests/tests/microformats-v1/includes/hyperlink.json +43 -0
- data/vendor/tests/tests/microformats-v1/includes/object.html +23 -0
- data/vendor/tests/tests/microformats-v1/includes/object.json +42 -0
- data/vendor/tests/tests/microformats-v1/includes/table.html +12 -0
- data/vendor/tests/tests/microformats-v1/includes/table.json +19 -0
- data/vendor/tests/tests/microformats-v2/h-adr/change-log.html +62 -0
- data/vendor/tests/tests/microformats-v2/h-adr/geo.html +10 -0
- data/vendor/tests/tests/microformats-v2/h-adr/geo.json +16 -0
- data/vendor/tests/tests/microformats-v2/h-adr/geourl.html +4 -0
- data/vendor/tests/tests/microformats-v2/h-adr/geourl.json +13 -0
- data/vendor/tests/tests/microformats-v2/h-adr/justaname.html +1 -0
- data/vendor/tests/tests/microformats-v2/h-adr/justaname.json +10 -0
- data/vendor/tests/tests/microformats-v2/h-adr/lettercase.html +21 -0
- data/vendor/tests/tests/microformats-v2/h-adr/lettercase.json +12 -0
- data/vendor/tests/tests/microformats-v2/h-adr/simpleproperties.html +8 -0
- data/vendor/tests/tests/microformats-v2/h-adr/simpleproperties.json +16 -0
- data/vendor/tests/tests/microformats-v2/h-as-note/note.html +56 -0
- data/vendor/tests/tests/microformats-v2/h-as-note/note.json +98 -0
- data/vendor/tests/tests/microformats-v2/h-card/baseurl.html +6 -0
- data/vendor/tests/tests/microformats-v2/h-card/baseurl.json +26 -0
- data/vendor/tests/tests/microformats-v2/h-card/change-log.html +100 -0
- data/vendor/tests/tests/microformats-v2/h-card/childimplied.html +7 -0
- data/vendor/tests/tests/microformats-v2/h-card/childimplied.json +12 -0
- data/vendor/tests/tests/microformats-v2/h-card/extendeddescription.html +10 -0
- data/vendor/tests/tests/microformats-v2/h-card/extendeddescription.json +15 -0
- data/vendor/tests/tests/microformats-v2/h-card/hcard.html +4 -0
- data/vendor/tests/tests/microformats-v2/h-card/hcard.json +19 -0
- data/vendor/tests/tests/microformats-v2/h-card/horghcard.html +4 -0
- data/vendor/tests/tests/microformats-v2/h-card/horghcard.json +19 -0
- data/vendor/tests/tests/microformats-v2/h-card/hyperlinkedphoto.html +3 -0
- data/vendor/tests/tests/microformats-v2/h-card/hyperlinkedphoto.json +12 -0
- data/vendor/tests/tests/microformats-v2/h-card/impliedname.html +15 -0
- data/vendor/tests/tests/microformats-v2/h-card/impliedname.json +90 -0
- data/vendor/tests/tests/microformats-v2/h-card/impliedphoto.html +11 -0
- data/vendor/tests/tests/microformats-v2/h-card/impliedphoto.json +72 -0
- data/vendor/tests/tests/microformats-v2/h-card/impliedurl.html +5 -0
- data/vendor/tests/tests/microformats-v2/h-card/impliedurl.json +45 -0
- data/vendor/tests/tests/microformats-v2/h-card/justahyperlink.html +1 -0
- data/vendor/tests/tests/microformats-v2/h-card/justahyperlink.json +11 -0
- data/vendor/tests/tests/microformats-v2/h-card/justaname.html +1 -0
- data/vendor/tests/tests/microformats-v2/h-card/justaname.json +10 -0
- data/vendor/tests/tests/microformats-v2/h-card/nested.html +4 -0
- data/vendor/tests/tests/microformats-v2/h-card/nested.json +18 -0
- data/vendor/tests/tests/microformats-v2/h-card/p-property.html +21 -0
- data/vendor/tests/tests/microformats-v2/h-card/p-property.json +15 -0
- data/vendor/tests/tests/microformats-v2/h-card/relativeurls.html +6 -0
- data/vendor/tests/tests/microformats-v2/h-card/relativeurls.json +29 -0
- data/vendor/tests/tests/microformats-v2/h-entry/change-log.html +90 -0
- data/vendor/tests/tests/microformats-v2/h-entry/encoding.html +3 -0
- data/vendor/tests/tests/microformats-v2/h-entry/encoding.json +14 -0
- data/vendor/tests/tests/microformats-v2/h-entry/impliedvalue-nested.html +9 -0
- data/vendor/tests/tests/microformats-v2/h-entry/impliedvalue-nested.json +27 -0
- data/vendor/tests/tests/microformats-v2/h-entry/justahyperlink.html +1 -0
- data/vendor/tests/tests/microformats-v2/h-entry/justahyperlink.json +11 -0
- data/vendor/tests/tests/microformats-v2/h-entry/justaname.html +1 -0
- data/vendor/tests/tests/microformats-v2/h-entry/justaname.json +10 -0
- data/vendor/tests/tests/microformats-v2/h-entry/scriptstyletags.html +4 -0
- data/vendor/tests/tests/microformats-v2/h-entry/scriptstyletags.json +14 -0
- data/vendor/tests/tests/microformats-v2/h-entry/summarycontent.html +20 -0
- data/vendor/tests/tests/microformats-v2/h-entry/summarycontent.json +25 -0
- data/vendor/tests/tests/microformats-v2/h-entry/u-property.html +33 -0
- data/vendor/tests/tests/microformats-v2/h-entry/u-property.json +12 -0
- data/vendor/tests/tests/microformats-v2/h-entry/urlincontent.html +13 -0
- data/vendor/tests/tests/microformats-v2/h-entry/urlincontent.json +14 -0
- data/vendor/tests/tests/microformats-v2/h-event/ampm.html +41 -0
- data/vendor/tests/tests/microformats-v2/h-event/ampm.json +21 -0
- data/vendor/tests/tests/microformats-v2/h-event/attendees.html +13 -0
- data/vendor/tests/tests/microformats-v2/h-event/attendees.json +37 -0
- data/vendor/tests/tests/microformats-v2/h-event/change-log.html +82 -0
- data/vendor/tests/tests/microformats-v2/h-event/combining.html +13 -0
- data/vendor/tests/tests/microformats-v2/h-event/combining.json +25 -0
- data/vendor/tests/tests/microformats-v2/h-event/concatenate.html +8 -0
- data/vendor/tests/tests/microformats-v2/h-event/concatenate.json +12 -0
- data/vendor/tests/tests/microformats-v2/h-event/dates.html +13 -0
- data/vendor/tests/tests/microformats-v2/h-event/dates.json +26 -0
- data/vendor/tests/tests/microformats-v2/h-event/dt-property.html +23 -0
- data/vendor/tests/tests/microformats-v2/h-event/dt-property.json +20 -0
- data/vendor/tests/tests/microformats-v2/h-event/justahyperlink.html +1 -0
- data/vendor/tests/tests/microformats-v2/h-event/justahyperlink.json +11 -0
- data/vendor/tests/tests/microformats-v2/h-event/justaname.html +1 -0
- data/vendor/tests/tests/microformats-v2/h-event/justaname.json +10 -0
- data/vendor/tests/tests/microformats-v2/h-event/time.html +47 -0
- data/vendor/tests/tests/microformats-v2/h-event/time.json +25 -0
- data/vendor/tests/tests/microformats-v2/h-feed/implied-title.html +30 -0
- data/vendor/tests/tests/microformats-v2/h-feed/implied-title.json +23 -0
- data/vendor/tests/tests/microformats-v2/h-feed/simple.html +26 -0
- data/vendor/tests/tests/microformats-v2/h-feed/simple.json +33 -0
- data/vendor/tests/tests/microformats-v2/h-geo/abbrpattern.html +5 -0
- data/vendor/tests/tests/microformats-v2/h-geo/abbrpattern.json +12 -0
- data/vendor/tests/tests/microformats-v2/h-geo/altitude.html +8 -0
- data/vendor/tests/tests/microformats-v2/h-geo/altitude.json +13 -0
- data/vendor/tests/tests/microformats-v2/h-geo/change-log.html +67 -0
- data/vendor/tests/tests/microformats-v2/h-geo/hidden.html +10 -0
- data/vendor/tests/tests/microformats-v2/h-geo/hidden.json +12 -0
- data/vendor/tests/tests/microformats-v2/h-geo/justaname.html +3 -0
- data/vendor/tests/tests/microformats-v2/h-geo/justaname.json +10 -0
- data/vendor/tests/tests/microformats-v2/h-geo/simpleproperties.html +5 -0
- data/vendor/tests/tests/microformats-v2/h-geo/simpleproperties.json +12 -0
- data/vendor/tests/tests/microformats-v2/h-geo/valuetitleclass.html +11 -0
- data/vendor/tests/tests/microformats-v2/h-geo/valuetitleclass.json +12 -0
- data/vendor/tests/tests/microformats-v2/h-news/all.html +35 -0
- data/vendor/tests/tests/microformats-v2/h-news/all.json +51 -0
- data/vendor/tests/tests/microformats-v2/h-news/change-log.html +78 -0
- data/vendor/tests/tests/microformats-v2/h-news/minimum.html +24 -0
- data/vendor/tests/tests/microformats-v2/h-news/minimum.json +40 -0
- data/vendor/tests/tests/microformats-v2/h-org/change-log.html +57 -0
- data/vendor/tests/tests/microformats-v2/h-org/hyperlink.html +1 -0
- data/vendor/tests/tests/microformats-v2/h-org/hyperlink.json +11 -0
- data/vendor/tests/tests/microformats-v2/h-org/simple.html +1 -0
- data/vendor/tests/tests/microformats-v2/h-org/simple.json +10 -0
- data/vendor/tests/tests/microformats-v2/h-org/simpleproperties.html +4 -0
- data/vendor/tests/tests/microformats-v2/h-org/simpleproperties.json +12 -0
- data/vendor/tests/tests/microformats-v2/h-product/aggregate.html +21 -0
- data/vendor/tests/tests/microformats-v2/h-product/aggregate.json +45 -0
- data/vendor/tests/tests/microformats-v2/h-product/change-log.html +62 -0
- data/vendor/tests/tests/microformats-v2/h-product/justahyperlink.html +1 -0
- data/vendor/tests/tests/microformats-v2/h-product/justahyperlink.json +11 -0
- data/vendor/tests/tests/microformats-v2/h-product/justaname.html +1 -0
- data/vendor/tests/tests/microformats-v2/h-product/justaname.json +10 -0
- data/vendor/tests/tests/microformats-v2/h-product/simpleproperties.html +10 -0
- data/vendor/tests/tests/microformats-v2/h-product/simpleproperties.json +26 -0
- data/vendor/tests/tests/microformats-v2/h-recipe/all.html +63 -0
- data/vendor/tests/tests/microformats-v2/h-recipe/all.json +54 -0
- data/vendor/tests/tests/microformats-v2/h-recipe/change-log.html +62 -0
- data/vendor/tests/tests/microformats-v2/h-recipe/minimum.html +7 -0
- data/vendor/tests/tests/microformats-v2/h-recipe/minimum.json +17 -0
- data/vendor/tests/tests/microformats-v2/h-resume/affiliation.html +12 -0
- data/vendor/tests/tests/microformats-v2/h-resume/affiliation.json +20 -0
- data/vendor/tests/tests/microformats-v2/h-resume/change-log.html +78 -0
- data/vendor/tests/tests/microformats-v2/h-resume/contact.html +17 -0
- data/vendor/tests/tests/microformats-v2/h-resume/contact.json +26 -0
- data/vendor/tests/tests/microformats-v2/h-resume/education.html +13 -0
- data/vendor/tests/tests/microformats-v2/h-resume/education.json +30 -0
- data/vendor/tests/tests/microformats-v2/h-resume/justaname.html +1 -0
- data/vendor/tests/tests/microformats-v2/h-resume/justaname.json +10 -0
- data/vendor/tests/tests/microformats-v2/h-resume/skill.html +12 -0
- data/vendor/tests/tests/microformats-v2/h-resume/skill.json +12 -0
- data/vendor/tests/tests/microformats-v2/h-resume/work.html +16 -0
- data/vendor/tests/tests/microformats-v2/h-resume/work.json +31 -0
- data/vendor/tests/tests/microformats-v2/h-review-aggregate/change-log.html +78 -0
- data/vendor/tests/tests/microformats-v2/h-review-aggregate/hevent.html +13 -0
- data/vendor/tests/tests/microformats-v2/h-review-aggregate/hevent.json +23 -0
- data/vendor/tests/tests/microformats-v2/h-review-aggregate/justahyperlink.html +8 -0
- data/vendor/tests/tests/microformats-v2/h-review-aggregate/justahyperlink.json +19 -0
- data/vendor/tests/tests/microformats-v2/h-review-aggregate/simpleproperties.html +18 -0
- data/vendor/tests/tests/microformats-v2/h-review-aggregate/simpleproperties.json +26 -0
- data/vendor/tests/tests/microformats-v2/h-review/change-log.html +84 -0
- data/vendor/tests/tests/microformats-v2/h-review/hyperlink.html +1 -0
- data/vendor/tests/tests/microformats-v2/h-review/hyperlink.json +11 -0
- data/vendor/tests/tests/microformats-v2/h-review/implieditem.html +4 -0
- data/vendor/tests/tests/microformats-v2/h-review/implieditem.json +19 -0
- data/vendor/tests/tests/microformats-v2/h-review/item.html +8 -0
- data/vendor/tests/tests/microformats-v2/h-review/item.json +20 -0
- data/vendor/tests/tests/microformats-v2/h-review/justaname.html +1 -0
- data/vendor/tests/tests/microformats-v2/h-review/justaname.json +10 -0
- data/vendor/tests/tests/microformats-v2/h-review/photo.html +1 -0
- data/vendor/tests/tests/microformats-v2/h-review/photo.json +11 -0
- data/vendor/tests/tests/microformats-v2/h-review/vcard.html +23 -0
- data/vendor/tests/tests/microformats-v2/h-review/vcard.json +48 -0
- data/vendor/tests/tests/microformats-v2/rel/change-log.html +67 -0
- data/vendor/tests/tests/microformats-v2/rel/duplicate-rels.html +10 -0
- data/vendor/tests/tests/microformats-v2/rel/duplicate-rels.json +75 -0
- data/vendor/tests/tests/microformats-v2/rel/license.html +1 -0
- data/vendor/tests/tests/microformats-v2/rel/license.json +12 -0
- data/vendor/tests/tests/microformats-v2/rel/nofollow.html +1 -0
- data/vendor/tests/tests/microformats-v2/rel/nofollow.json +12 -0
- data/vendor/tests/tests/microformats-v2/rel/rel-urls.html +8 -0
- data/vendor/tests/tests/microformats-v2/rel/rel-urls.json +33 -0
- data/vendor/tests/tests/microformats-v2/rel/varying-text-duplicate-rels.html +4 -0
- data/vendor/tests/tests/microformats-v2/rel/varying-text-duplicate-rels.json +20 -0
- data/vendor/tests/tests/microformats-v2/rel/xfn-all.html +19 -0
- data/vendor/tests/tests/microformats-v2/rel/xfn-all.json +92 -0
- data/vendor/tests/tests/microformats-v2/rel/xfn-elsewhere.html +10 -0
- data/vendor/tests/tests/microformats-v2/rel/xfn-elsewhere.json +40 -0
- metadata +533 -57
- data/CHANGELOG.rdoc +0 -6
- data/LICENSE +0 -20
- data/README.rdoc +0 -147
- data/lib/address.rb +0 -97
- data/lib/calendar.rb +0 -40
- data/lib/event.rb +0 -156
- data/lib/formatting_helpers.rb +0 -57
- data/lib/helpers.rb +0 -74
- data/lib/vcard.rb +0 -177
@@ -0,0 +1,121 @@
|
|
1
|
+
module Microformats
|
2
|
+
|
3
|
+
#stub to get around the tests for now
|
4
|
+
class Collection
|
5
|
+
|
6
|
+
def initialize(hash)
|
7
|
+
@hash = hash
|
8
|
+
end
|
9
|
+
|
10
|
+
def to_h
|
11
|
+
@hash
|
12
|
+
end
|
13
|
+
|
14
|
+
def to_hash
|
15
|
+
@hash
|
16
|
+
end
|
17
|
+
|
18
|
+
def to_json
|
19
|
+
to_hash.to_json
|
20
|
+
end
|
21
|
+
|
22
|
+
def to_s
|
23
|
+
if @hash['value']
|
24
|
+
return @hash['value']
|
25
|
+
else
|
26
|
+
super
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def [](key)
|
31
|
+
@hash[key]
|
32
|
+
end
|
33
|
+
|
34
|
+
def value
|
35
|
+
@hash['value']
|
36
|
+
end
|
37
|
+
|
38
|
+
def items
|
39
|
+
@hash['items'].map do |item|
|
40
|
+
ParserResult.new(item)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def rels
|
45
|
+
@hash['rels']
|
46
|
+
end
|
47
|
+
|
48
|
+
def rel_urls
|
49
|
+
@hash['rel-urls']
|
50
|
+
end
|
51
|
+
|
52
|
+
def respond_to?(sym, include_private = false)
|
53
|
+
has_item?(sym) || super(sym, include_private)
|
54
|
+
end
|
55
|
+
|
56
|
+
def method_missing(sym, *args, &block)
|
57
|
+
|
58
|
+
name = sym.to_s
|
59
|
+
name_dash = name.gsub('_', '-') if name.include? '_'
|
60
|
+
|
61
|
+
if not @hash['items'].nil?
|
62
|
+
result_hash = @hash['items'].select do |x|
|
63
|
+
x['type'].include?('h-' + name)
|
64
|
+
end
|
65
|
+
if result_hash.empty? and not name_dash.nil?
|
66
|
+
result_hash = @hash['items'].select do |x|
|
67
|
+
x['type'].include?('h-' + name_dash)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
super(sym, *args, &block) if result_hash.empty?
|
73
|
+
|
74
|
+
if result_hash.is_a? Array
|
75
|
+
if args[0].nil?
|
76
|
+
result_hash = result_hash[0] #will return nil for an empty array
|
77
|
+
|
78
|
+
elsif args[0] == :all
|
79
|
+
return result_hash.map do |x|
|
80
|
+
ParserResult.new(x)
|
81
|
+
end
|
82
|
+
|
83
|
+
elsif args[0].to_i < result_hash.count
|
84
|
+
result_hash = result_hash[args[0].to_i]
|
85
|
+
|
86
|
+
else
|
87
|
+
result_hash = result_hash[0] #will return nil for an empty array
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
if result_hash.nil? or result_hash.empty?
|
92
|
+
result_hash
|
93
|
+
elsif result_hash.is_a? Hash
|
94
|
+
ParserResult.new(result_hash)
|
95
|
+
else
|
96
|
+
result_hash
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
private
|
101
|
+
|
102
|
+
def has_item?(name)
|
103
|
+
name = name.to_s
|
104
|
+
name_dash = name.gsub('_', '-') if name.include? '_'
|
105
|
+
if not @hash['items'].nil?
|
106
|
+
result_hash = @hash['items'].select do |x|
|
107
|
+
x['type'].include?('h-' + name)
|
108
|
+
end
|
109
|
+
if result_hash.empty? and not name_dash.nil?
|
110
|
+
result_hash = @hash['items'].select do |x|
|
111
|
+
x['type'].include?('h-' + name_dash)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
not result_hash.empty?
|
117
|
+
end
|
118
|
+
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
@@ -0,0 +1,111 @@
|
|
1
|
+
module Microformats
|
2
|
+
|
3
|
+
#stub to get around the tests for now
|
4
|
+
class ParserResult
|
5
|
+
|
6
|
+
def initialize(hash)
|
7
|
+
@hash = hash
|
8
|
+
end
|
9
|
+
|
10
|
+
def to_h
|
11
|
+
@hash
|
12
|
+
end
|
13
|
+
|
14
|
+
def to_hash
|
15
|
+
@hash
|
16
|
+
end
|
17
|
+
|
18
|
+
def to_json
|
19
|
+
to_hash.to_json
|
20
|
+
end
|
21
|
+
|
22
|
+
def to_s
|
23
|
+
if @hash['value']
|
24
|
+
return @hash['value']
|
25
|
+
else
|
26
|
+
super
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def [](key)
|
31
|
+
@hash[key]
|
32
|
+
end
|
33
|
+
|
34
|
+
def value
|
35
|
+
@hash['value']
|
36
|
+
end
|
37
|
+
|
38
|
+
def properties
|
39
|
+
PropertySet.new( @hash['properties'])
|
40
|
+
end
|
41
|
+
|
42
|
+
def respond_to?(sym, include_private = false)
|
43
|
+
has_key?(sym) || has_property?(sym) || super(sym, include_private)
|
44
|
+
end
|
45
|
+
|
46
|
+
def method_missing(sym, *args, &block)
|
47
|
+
|
48
|
+
name = sym.to_s
|
49
|
+
name_dash = name.gsub('_', '-') if name.include? '_'
|
50
|
+
|
51
|
+
if not @hash[name].nil?
|
52
|
+
result_hash = @hash[name]
|
53
|
+
|
54
|
+
elsif not @hash['properties'].nil? and not @hash['properties'][name].nil?
|
55
|
+
result_hash = @hash['properties'][name]
|
56
|
+
|
57
|
+
elsif not name_dash.nil? and not @hash[name_dash].nil?
|
58
|
+
result_hash = @hash[name_dash]
|
59
|
+
|
60
|
+
elsif not name_dash.nil? and not @hash['properties'].nil? and not @hash['properties'][name_dash].nil?
|
61
|
+
result_hash = @hash['properties'][name_dash]
|
62
|
+
|
63
|
+
else
|
64
|
+
super(sym, *args, &block)
|
65
|
+
end
|
66
|
+
|
67
|
+
if result_hash.is_a? Array
|
68
|
+
if args[0].nil?
|
69
|
+
result_hash = result_hash[0] #will return nil for an empty array
|
70
|
+
|
71
|
+
elsif args[0] == :all
|
72
|
+
return result_hash.map do |x|
|
73
|
+
ParserResult.new(x)
|
74
|
+
end
|
75
|
+
|
76
|
+
elsif args[0].to_i < result_hash.count
|
77
|
+
result_hash = result_hash[args[0].to_i]
|
78
|
+
|
79
|
+
else
|
80
|
+
result_hash = result_hash[0] #will return nil for an empty array
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
if result_hash.nil? or result_hash.empty?
|
85
|
+
result_hash
|
86
|
+
elsif result_hash.is_a? Hash
|
87
|
+
ParserResult.new(result_hash)
|
88
|
+
else
|
89
|
+
result_hash
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
private
|
94
|
+
|
95
|
+
def has_key?(name)
|
96
|
+
name = name.to_s
|
97
|
+
name_dash = name.gsub('_', '-') if name.include? '_'
|
98
|
+
|
99
|
+
not @hash[name].nil? or not @hash[name_dash].nil?
|
100
|
+
end
|
101
|
+
|
102
|
+
def has_property?(name)
|
103
|
+
name = name.to_s
|
104
|
+
name_dash = name.gsub('_', '-') if name.include? '_'
|
105
|
+
return false if @hash['properties'].nil?
|
106
|
+
not @hash['properties'][name].nil? or not @hash['properties'][name_dash].nil?
|
107
|
+
end
|
108
|
+
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
@@ -0,0 +1,87 @@
|
|
1
|
+
module Microformats
|
2
|
+
|
3
|
+
#stub to get around the tests for now
|
4
|
+
class PropertySet
|
5
|
+
|
6
|
+
def initialize(hash)
|
7
|
+
@hash = hash
|
8
|
+
end
|
9
|
+
|
10
|
+
def to_h
|
11
|
+
@hash
|
12
|
+
end
|
13
|
+
|
14
|
+
def to_hash
|
15
|
+
@hash.to_hash
|
16
|
+
end
|
17
|
+
|
18
|
+
def to_json
|
19
|
+
@hash.to_hash.to_json
|
20
|
+
end
|
21
|
+
|
22
|
+
def [](key)
|
23
|
+
@hash[key]
|
24
|
+
end
|
25
|
+
|
26
|
+
def respond_to?(sym, include_private = false)
|
27
|
+
has_key?(sym) || super(sym, include_private)
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
def method_missing(mname, *args, &block)
|
32
|
+
|
33
|
+
if respond_to? mname
|
34
|
+
result_hash = get_val? mname
|
35
|
+
if result_hash.is_a? Array
|
36
|
+
if args[0].nil?
|
37
|
+
result_hash = result_hash[0] #will return nil for an empty array
|
38
|
+
|
39
|
+
elsif args[0] == :all
|
40
|
+
return result_hash.map do |x|
|
41
|
+
ParserResult.new(x)
|
42
|
+
end
|
43
|
+
|
44
|
+
elsif args[0].to_i < result_hash.count
|
45
|
+
result_hash = result_hash[args[0].to_i]
|
46
|
+
|
47
|
+
else
|
48
|
+
result_hash = result_hash[0] #will return nil for an empty array
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
if result_hash.is_a? Hash
|
53
|
+
ParserResult.new(result_hash)
|
54
|
+
else
|
55
|
+
result_hash
|
56
|
+
end
|
57
|
+
else
|
58
|
+
super(mname, *args, &block)
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
private
|
64
|
+
|
65
|
+
def has_key?(name)
|
66
|
+
name = name.to_s
|
67
|
+
name_dash = name.gsub('_', '-') if name.include? '_'
|
68
|
+
not @hash[name].nil? or not @hash[name_dash].nil?
|
69
|
+
end
|
70
|
+
|
71
|
+
def get_val?(name)
|
72
|
+
name = name.to_s
|
73
|
+
name_dash = name.gsub('_', '-') if name.include? '_'
|
74
|
+
|
75
|
+
if not @hash[name].nil?
|
76
|
+
result_hash = @hash[name]
|
77
|
+
|
78
|
+
elsif not @hash[name_dash].nil?
|
79
|
+
result_hash = @hash[name_dash]
|
80
|
+
else
|
81
|
+
nil
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
@@ -0,0 +1,161 @@
|
|
1
|
+
module Microformats
|
2
|
+
class TimePropertyParser < ParserCore
|
3
|
+
|
4
|
+
def parse(element, base: nil, element_type: , format_class_array: [], backcompat: nil)
|
5
|
+
@base = base
|
6
|
+
@duration_value = nil
|
7
|
+
@date_value = nil
|
8
|
+
@time_value = nil
|
9
|
+
|
10
|
+
@property_type = element_type
|
11
|
+
|
12
|
+
@fmt_classes = format_class_array
|
13
|
+
@mode_backcompat = backcompat
|
14
|
+
|
15
|
+
parse_value_class_pattern(element)
|
16
|
+
|
17
|
+
if @duration_value.nil? and @time_value.nil? and @date_value.nil?
|
18
|
+
|
19
|
+
value = nil
|
20
|
+
if ['time', 'ins', 'del'].include? element.name and not element.attribute('datetime').nil?
|
21
|
+
value = element.attribute('datetime').value.strip
|
22
|
+
elsif element.name == 'abbr' and not element.attribute('title').nil?
|
23
|
+
value = element.attribute('title').value.strip
|
24
|
+
elsif (element.name == 'data' or element.name == 'input') and not element.attribute('value').nil?
|
25
|
+
value = element.attribute('value').value.strip
|
26
|
+
else
|
27
|
+
value = element.text.strip
|
28
|
+
end
|
29
|
+
|
30
|
+
parse_dt(value)
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
if not @duration_value.nil?
|
35
|
+
@duration_value
|
36
|
+
elsif not @time_value.nil? and not @date_value.nil?
|
37
|
+
@date_value + ' ' + @time_value
|
38
|
+
elsif not @time_value.nil?
|
39
|
+
@time_value
|
40
|
+
elsif not @date_value.nil?
|
41
|
+
@date_value
|
42
|
+
else
|
43
|
+
nil
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def parse_value_class_pattern(element)
|
48
|
+
parse_node(element.children)
|
49
|
+
end
|
50
|
+
|
51
|
+
def parse_element(element)
|
52
|
+
|
53
|
+
if @duration_value.nil? or (@time_value.nil? and @date_value.nil?)
|
54
|
+
if value_title_classes(element).length >= 1
|
55
|
+
value = element.attribute('title').value.strip
|
56
|
+
elsif value_classes(element).length >= 1
|
57
|
+
if element.name == 'img' or element.name == 'area' and not element.attribute('alt').nil?
|
58
|
+
value = element.attribute('alt').value.strip
|
59
|
+
elsif element.name == 'data' and not element.attribute('value').nil?
|
60
|
+
value = element.attribute('value').value.strip
|
61
|
+
elsif element.name == 'abbr' and not element.attribute('title').nil?
|
62
|
+
value = element.attribute('title').value.strip
|
63
|
+
elsif ['time', 'ins', 'del'].include? element.name and not element.attribute('datetime').nil?
|
64
|
+
value = element.attribute('datetime').value.strip
|
65
|
+
else
|
66
|
+
value = element.text.strip
|
67
|
+
end
|
68
|
+
end
|
69
|
+
parse_dt(value, normalize: true)
|
70
|
+
|
71
|
+
p_classes = property_classes(element)
|
72
|
+
p_classes = backcompat_property_classes(element) if @mode_backcompat
|
73
|
+
if p_classes.length == 0 and format_classes(element).length == 0
|
74
|
+
parse_node(element.children)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
79
|
+
|
80
|
+
def parse_dt(data, normalize: false)
|
81
|
+
# currently the value-class-pattern page lists to normalize and remove :'s but not regular parsing, seems very odd
|
82
|
+
# https://github.com/microformats/tests/issues/29
|
83
|
+
#
|
84
|
+
#TODO this still allows a lot of non correct values such as 39th day of the month, etc
|
85
|
+
begin
|
86
|
+
case data.strip
|
87
|
+
when /^(\d{4}-[01]\d-[0-3]\d)[tT ]([0-2]\d:[0-5]\d(:[0-5]\d)?([zZ]|[-+][01]?\d:?[0-5]\d)?)$/
|
88
|
+
@date_value = $1 if @date_value.nil?
|
89
|
+
@time_value = $2.gsub(/z/, 'Z') if @time_value.nil?
|
90
|
+
when /^(\d{4}-[01]\d-[0-3]\d)[tT ]([0-2]\d:[0-5]\d(:[0-5]\d)? ?[-+]\d\d)$/
|
91
|
+
@date_value = $1 if @date_value.nil?
|
92
|
+
@time_value = $2 if @time_value.nil?
|
93
|
+
when /^(\d{4}-[01]\d-[0-3]\d)[tT ]([0-2]\d:[0-5]\d:[0-5]\d ?[-+]\d\d):?(\d\d)$/
|
94
|
+
@date_value = $1 if @date_value.nil?
|
95
|
+
if normalize
|
96
|
+
@time_value = $2 + $3 if @time_value.nil?
|
97
|
+
else
|
98
|
+
@time_value = $2 + ':' + $3 if @time_value.nil?
|
99
|
+
end
|
100
|
+
when /^(\d{4}-[01]\d-[0-3]\d)[tT ]([0-2]\d:[0-5]\d)( ?[-+]\d\d:?\d\d)$/
|
101
|
+
@date_value = $1 if @date_value.nil?
|
102
|
+
if normalize
|
103
|
+
@time_value = $2 + $3.gsub(/:/,'') if @time_value.nil?
|
104
|
+
else
|
105
|
+
@time_value = $2 + $3 if @time_value.nil?
|
106
|
+
end
|
107
|
+
when /^P\d*W$/
|
108
|
+
@duration_value = data if @duration_value.nil?
|
109
|
+
|
110
|
+
when /^P(\d+Y)?(\d+M)?(\d+D)?(T(\d+H)?(\d+M)?(\d+S)?)?$/
|
111
|
+
@duration_value = data if @duration_value.nil?
|
112
|
+
|
113
|
+
when /^(\d{4})-([01]?\d)-([0-3]?\d)$/
|
114
|
+
@date_value = DateTime.new($1.to_i, $2.to_i, $3.to_i).strftime('%F') if @date_value.nil?
|
115
|
+
|
116
|
+
when /^(\d{4})-([0-3]\d{2})$/
|
117
|
+
@date_value = data if @date_value.nil?
|
118
|
+
|
119
|
+
when /^(\d{4})-([01]?\d)$/
|
120
|
+
@date_value = data if @date_value.nil?
|
121
|
+
|
122
|
+
when /^[0-2]\d:[0-5]\d(:[0-5]\d)?([zZ]|[-+][01]\d:?\d\d)?$/
|
123
|
+
if normalize
|
124
|
+
@time_value = data.gsub(/z/, 'Z').gsub(/([+-]\d\d):(\d\d)/, '\1\2') if @time_value.nil?
|
125
|
+
else
|
126
|
+
@time_value = data.gsub(/z/, 'Z') if @time_value.nil?
|
127
|
+
end
|
128
|
+
|
129
|
+
when /^[0-2]\d:[0-5]\d[zZ]?$/
|
130
|
+
@time_value = Time.parse(data).strftime('%H:%M') if @time_value.nil?
|
131
|
+
when /^([0-2]\d:[0-5]\d:[0-5]\d[-+][01]\d:?[0-5]\d)$/
|
132
|
+
Time.parse(data).strftime('%T') #to make sure this time doesn't throw an error
|
133
|
+
@time_value = $1 if @time_value.nil?
|
134
|
+
|
135
|
+
when /^([0-2][0-0]:[0-5]\d[-+][01]\d:?[0-5]\d)$/
|
136
|
+
Time.parse(data).strftime('%H:%M') #to make sure this time doesn't throw an error
|
137
|
+
@time_value = $1 if @time_value.nil?
|
138
|
+
|
139
|
+
when /^([01]?\d):?([0-5]\d)?p\.?m\.?$/i
|
140
|
+
@time_value = ($1.to_i + 12).to_s + ':' + $2.to_s.rjust(2,'0') if @time_value.nil?
|
141
|
+
when /^([01]?\d):?([0-5]\d)?a\.?m\.?$/i
|
142
|
+
@time_value = $1.to_s.rjust(2,'0') + ':' + $2.to_s.rjust(2,'0') if @time_value.nil?
|
143
|
+
when /^([01]?\d):([0-5]\d):([0-5]\d)?p\.?m\.?$/i
|
144
|
+
@time_value = ($1.to_i + 12).to_s + ':' + $2.to_s.rjust(2,'0') + ':'+ $3.to_s.rjust(2,'0') if @time_value.nil?
|
145
|
+
when /^([01]?\d):([0-5]\d):([0-5]\d)?a\.?m\.?$/i
|
146
|
+
@time_value = $1.to_s.rjust(2,'0') + ':' + $2.to_s.rjust(2,'0') + ':'+ $3.to_s.rjust(2,'0') if @time_value.nil?
|
147
|
+
|
148
|
+
else
|
149
|
+
t = Time.parse(data)
|
150
|
+
@time_value = t.strftime('%T') if @time_value.nil?
|
151
|
+
@date_value = t.strftime('%F') if @date_value.nil?
|
152
|
+
end
|
153
|
+
|
154
|
+
rescue
|
155
|
+
nil
|
156
|
+
end
|
157
|
+
|
158
|
+
end
|
159
|
+
|
160
|
+
end
|
161
|
+
end
|