microformats2 2.9.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (313) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +125 -25
  3. data/Rakefile +0 -60
  4. data/lib/microformats2.rb +7 -15
  5. data/lib/microformats2/absolute_uri.rb +5 -1
  6. data/lib/microformats2/format_parser.rb +321 -46
  7. data/lib/microformats2/parser.rb +86 -6
  8. data/lib/microformats2/parser_core.rb +343 -0
  9. data/lib/microformats2/property_parser.rb +104 -34
  10. data/lib/microformats2/results/collection.rb +121 -0
  11. data/lib/microformats2/results/parser_result.rb +111 -0
  12. data/lib/microformats2/results/property_set.rb +87 -0
  13. data/lib/microformats2/time_property_parser.rb +161 -0
  14. data/lib/microformats2/version.rb +1 -1
  15. data/microformats2.gemspec +2 -1
  16. data/spec/lib/microformats2/absolute_uri_spec.rb +2 -2
  17. data/spec/lib/microformats2/parser_spec.rb +36 -5
  18. data/spec/lib/microformats2_spec.rb +5 -5
  19. data/spec/spec_helper.rb +0 -1
  20. data/vendor/tests/.gitignore +25 -0
  21. data/vendor/tests/LICENSE.md +36 -0
  22. data/vendor/tests/README.md +48 -0
  23. data/vendor/tests/app.js +84 -0
  24. data/vendor/tests/composer.json +5 -0
  25. data/vendor/tests/css/testsuite.css +159 -0
  26. data/vendor/tests/interface.js +18 -0
  27. data/vendor/tests/package.json +27 -0
  28. data/vendor/tests/tests/microformats-mixed/h-card/change-log.html +63 -0
  29. data/vendor/tests/tests/microformats-mixed/h-card/mixedpropertries.html +14 -0
  30. data/vendor/tests/tests/microformats-mixed/h-card/mixedpropertries.json +22 -0
  31. data/vendor/tests/tests/microformats-mixed/h-card/tworoots.html +1 -0
  32. data/vendor/tests/tests/microformats-mixed/h-card/tworoots.json +10 -0
  33. data/vendor/tests/tests/microformats-mixed/h-entry/mixedroots.html +16 -0
  34. data/vendor/tests/tests/microformats-mixed/h-entry/mixedroots.json +38 -0
  35. data/vendor/tests/tests/microformats-mixed/h-resume/change-log.html +68 -0
  36. data/vendor/tests/tests/microformats-mixed/h-resume/mixedroots.html +16 -0
  37. data/vendor/tests/tests/microformats-mixed/h-resume/mixedroots.json +31 -0
  38. data/vendor/tests/tests/microformats-v1/adr/change-log.html +63 -0
  39. data/vendor/tests/tests/microformats-v1/adr/simpleproperties.html +8 -0
  40. data/vendor/tests/tests/microformats-v1/adr/simpleproperties.json +15 -0
  41. data/vendor/tests/tests/microformats-v1/geo/abbrpattern.html +5 -0
  42. data/vendor/tests/tests/microformats-v1/geo/abbrpattern.json +11 -0
  43. data/vendor/tests/tests/microformats-v1/geo/change-log.1.html +78 -0
  44. data/vendor/tests/tests/microformats-v1/geo/change-log.html +63 -0
  45. data/vendor/tests/tests/microformats-v1/geo/hidden.html +10 -0
  46. data/vendor/tests/tests/microformats-v1/geo/hidden.json +11 -0
  47. data/vendor/tests/tests/microformats-v1/geo/simpleproperties.html +6 -0
  48. data/vendor/tests/tests/microformats-v1/geo/simpleproperties.json +11 -0
  49. data/vendor/tests/tests/microformats-v1/geo/valuetitleclass.html +11 -0
  50. data/vendor/tests/tests/microformats-v1/geo/valuetitleclass.json +11 -0
  51. data/vendor/tests/tests/microformats-v1/hcalendar/ampm.html +41 -0
  52. data/vendor/tests/tests/microformats-v1/hcalendar/ampm.json +21 -0
  53. data/vendor/tests/tests/microformats-v1/hcalendar/attendees.html +13 -0
  54. data/vendor/tests/tests/microformats-v1/hcalendar/attendees.json +37 -0
  55. data/vendor/tests/tests/microformats-v1/hcalendar/change-log.html +68 -0
  56. data/vendor/tests/tests/microformats-v1/hcalendar/combining.html +15 -0
  57. data/vendor/tests/tests/microformats-v1/hcalendar/combining.json +31 -0
  58. data/vendor/tests/tests/microformats-v1/hcalendar/concatenate.html +7 -0
  59. data/vendor/tests/tests/microformats-v1/hcalendar/concatenate.json +12 -0
  60. data/vendor/tests/tests/microformats-v1/hcalendar/time.html +44 -0
  61. data/vendor/tests/tests/microformats-v1/hcalendar/time.json +22 -0
  62. data/vendor/tests/tests/microformats-v1/hcard/change-log.html +68 -0
  63. data/vendor/tests/tests/microformats-v1/hcard/email.html +14 -0
  64. data/vendor/tests/tests/microformats-v1/hcard/email.json +11 -0
  65. data/vendor/tests/tests/microformats-v1/hcard/format.html +6 -0
  66. data/vendor/tests/tests/microformats-v1/hcard/format.json +11 -0
  67. data/vendor/tests/tests/microformats-v1/hcard/hyperlinkedphoto.html +3 -0
  68. data/vendor/tests/tests/microformats-v1/hcard/hyperlinkedphoto.json +8 -0
  69. data/vendor/tests/tests/microformats-v1/hcard/justahyperlink.html +1 -0
  70. data/vendor/tests/tests/microformats-v1/hcard/justahyperlink.json +8 -0
  71. data/vendor/tests/tests/microformats-v1/hcard/justaname.html +1 -0
  72. data/vendor/tests/tests/microformats-v1/hcard/justaname.json +8 -0
  73. data/vendor/tests/tests/microformats-v1/hcard/multiple.html +74 -0
  74. data/vendor/tests/tests/microformats-v1/hcard/multiple.json +65 -0
  75. data/vendor/tests/tests/microformats-v1/hcard/name.html +11 -0
  76. data/vendor/tests/tests/microformats-v1/hcard/name.json +15 -0
  77. data/vendor/tests/tests/microformats-v1/hcard/single.html +14 -0
  78. data/vendor/tests/tests/microformats-v1/hcard/single.json +24 -0
  79. data/vendor/tests/tests/microformats-v1/hentry/change-log.html +73 -0
  80. data/vendor/tests/tests/microformats-v1/hentry/summarycontent.html +20 -0
  81. data/vendor/tests/tests/microformats-v1/hentry/summarycontent.json +24 -0
  82. data/vendor/tests/tests/microformats-v1/hfeed/simple.html +30 -0
  83. data/vendor/tests/tests/microformats-v1/hfeed/simple.json +49 -0
  84. data/vendor/tests/tests/microformats-v1/hnews/all.html +37 -0
  85. data/vendor/tests/tests/microformats-v1/hnews/all.json +74 -0
  86. data/vendor/tests/tests/microformats-v1/hnews/change-log.html +72 -0
  87. data/vendor/tests/tests/microformats-v1/hnews/minimum.html +25 -0
  88. data/vendor/tests/tests/microformats-v1/hnews/minimum.json +48 -0
  89. data/vendor/tests/tests/microformats-v1/hproduct/aggregate.html +26 -0
  90. data/vendor/tests/tests/microformats-v1/hproduct/aggregate.json +52 -0
  91. data/vendor/tests/tests/microformats-v1/hproduct/change-log.html +62 -0
  92. data/vendor/tests/tests/microformats-v1/hproduct/simpleproperties.html +13 -0
  93. data/vendor/tests/tests/microformats-v1/hproduct/simpleproperties.json +33 -0
  94. data/vendor/tests/tests/microformats-v1/hresume/affiliation.html +12 -0
  95. data/vendor/tests/tests/microformats-v1/hresume/affiliation.json +25 -0
  96. data/vendor/tests/tests/microformats-v1/hresume/change-log.html +73 -0
  97. data/vendor/tests/tests/microformats-v1/hresume/contact.html +18 -0
  98. data/vendor/tests/tests/microformats-v1/hresume/contact.json +32 -0
  99. data/vendor/tests/tests/microformats-v1/hresume/education.html +13 -0
  100. data/vendor/tests/tests/microformats-v1/hresume/education.json +29 -0
  101. data/vendor/tests/tests/microformats-v1/hresume/skill.html +12 -0
  102. data/vendor/tests/tests/microformats-v1/hresume/skill.json +33 -0
  103. data/vendor/tests/tests/microformats-v1/hresume/work.html +16 -0
  104. data/vendor/tests/tests/microformats-v1/hresume/work.json +30 -0
  105. data/vendor/tests/tests/microformats-v1/hreview-aggregate/change-log.html +67 -0
  106. data/vendor/tests/tests/microformats-v1/hreview-aggregate/hcard.html +18 -0
  107. data/vendor/tests/tests/microformats-v1/hreview-aggregate/hcard.json +31 -0
  108. data/vendor/tests/tests/microformats-v1/hreview-aggregate/justahyperlink.html +6 -0
  109. data/vendor/tests/tests/microformats-v1/hreview-aggregate/justahyperlink.json +19 -0
  110. data/vendor/tests/tests/microformats-v1/hreview-aggregate/vevent.html +13 -0
  111. data/vendor/tests/tests/microformats-v1/hreview-aggregate/vevent.json +22 -0
  112. data/vendor/tests/tests/microformats-v1/hreview/change-log.html +73 -0
  113. data/vendor/tests/tests/microformats-v1/hreview/item.html +8 -0
  114. data/vendor/tests/tests/microformats-v1/hreview/item.json +19 -0
  115. data/vendor/tests/tests/microformats-v1/hreview/vcard.html +23 -0
  116. data/vendor/tests/tests/microformats-v1/hreview/vcard.json +58 -0
  117. data/vendor/tests/tests/microformats-v1/includes/change-log.html +72 -0
  118. data/vendor/tests/tests/microformats-v1/includes/hcarditemref.html +16 -0
  119. data/vendor/tests/tests/microformats-v1/includes/hcarditemref.json +49 -0
  120. data/vendor/tests/tests/microformats-v1/includes/heventitemref.html +25 -0
  121. data/vendor/tests/tests/microformats-v1/includes/heventitemref.json +33 -0
  122. data/vendor/tests/tests/microformats-v1/includes/hyperlink.html +18 -0
  123. data/vendor/tests/tests/microformats-v1/includes/hyperlink.json +43 -0
  124. data/vendor/tests/tests/microformats-v1/includes/object.html +23 -0
  125. data/vendor/tests/tests/microformats-v1/includes/object.json +42 -0
  126. data/vendor/tests/tests/microformats-v1/includes/table.html +12 -0
  127. data/vendor/tests/tests/microformats-v1/includes/table.json +19 -0
  128. data/vendor/tests/tests/microformats-v2/h-adr/change-log.html +62 -0
  129. data/vendor/tests/tests/microformats-v2/h-adr/geo.html +10 -0
  130. data/vendor/tests/tests/microformats-v2/h-adr/geo.json +16 -0
  131. data/vendor/tests/tests/microformats-v2/h-adr/geourl.html +4 -0
  132. data/vendor/tests/tests/microformats-v2/h-adr/geourl.json +13 -0
  133. data/vendor/tests/tests/microformats-v2/h-adr/justaname.html +1 -0
  134. data/vendor/tests/tests/microformats-v2/h-adr/justaname.json +10 -0
  135. data/vendor/tests/tests/microformats-v2/h-adr/lettercase.html +21 -0
  136. data/vendor/tests/tests/microformats-v2/h-adr/lettercase.json +12 -0
  137. data/vendor/tests/tests/microformats-v2/h-adr/simpleproperties.html +8 -0
  138. data/vendor/tests/tests/microformats-v2/h-adr/simpleproperties.json +16 -0
  139. data/vendor/tests/tests/microformats-v2/h-as-note/note.html +56 -0
  140. data/vendor/tests/tests/microformats-v2/h-as-note/note.json +98 -0
  141. data/vendor/tests/tests/microformats-v2/h-card/baseurl.html +6 -0
  142. data/vendor/tests/tests/microformats-v2/h-card/baseurl.json +26 -0
  143. data/vendor/tests/tests/microformats-v2/h-card/change-log.html +100 -0
  144. data/vendor/tests/tests/microformats-v2/h-card/childimplied.html +7 -0
  145. data/vendor/tests/tests/microformats-v2/h-card/childimplied.json +12 -0
  146. data/vendor/tests/tests/microformats-v2/h-card/extendeddescription.html +10 -0
  147. data/vendor/tests/tests/microformats-v2/h-card/extendeddescription.json +15 -0
  148. data/vendor/tests/tests/microformats-v2/h-card/hcard.html +4 -0
  149. data/vendor/tests/tests/microformats-v2/h-card/hcard.json +19 -0
  150. data/vendor/tests/tests/microformats-v2/h-card/horghcard.html +4 -0
  151. data/vendor/tests/tests/microformats-v2/h-card/horghcard.json +19 -0
  152. data/vendor/tests/tests/microformats-v2/h-card/hyperlinkedphoto.html +3 -0
  153. data/vendor/tests/tests/microformats-v2/h-card/hyperlinkedphoto.json +12 -0
  154. data/vendor/tests/tests/microformats-v2/h-card/impliedname.html +15 -0
  155. data/vendor/tests/tests/microformats-v2/h-card/impliedname.json +90 -0
  156. data/vendor/tests/tests/microformats-v2/h-card/impliedphoto.html +11 -0
  157. data/vendor/tests/tests/microformats-v2/h-card/impliedphoto.json +72 -0
  158. data/vendor/tests/tests/microformats-v2/h-card/impliedurl.html +5 -0
  159. data/vendor/tests/tests/microformats-v2/h-card/impliedurl.json +45 -0
  160. data/vendor/tests/tests/microformats-v2/h-card/justahyperlink.html +1 -0
  161. data/vendor/tests/tests/microformats-v2/h-card/justahyperlink.json +11 -0
  162. data/vendor/tests/tests/microformats-v2/h-card/justaname.html +1 -0
  163. data/vendor/tests/tests/microformats-v2/h-card/justaname.json +10 -0
  164. data/vendor/tests/tests/microformats-v2/h-card/nested.html +4 -0
  165. data/vendor/tests/tests/microformats-v2/h-card/nested.json +18 -0
  166. data/vendor/tests/tests/microformats-v2/h-card/p-property.html +21 -0
  167. data/vendor/tests/tests/microformats-v2/h-card/p-property.json +15 -0
  168. data/vendor/tests/tests/microformats-v2/h-card/relativeurls.html +6 -0
  169. data/vendor/tests/tests/microformats-v2/h-card/relativeurls.json +29 -0
  170. data/vendor/tests/tests/microformats-v2/h-entry/change-log.html +90 -0
  171. data/vendor/tests/tests/microformats-v2/h-entry/encoding.html +3 -0
  172. data/vendor/tests/tests/microformats-v2/h-entry/encoding.json +14 -0
  173. data/vendor/tests/tests/microformats-v2/h-entry/impliedvalue-nested.html +9 -0
  174. data/vendor/tests/tests/microformats-v2/h-entry/impliedvalue-nested.json +27 -0
  175. data/vendor/tests/tests/microformats-v2/h-entry/justahyperlink.html +1 -0
  176. data/vendor/tests/tests/microformats-v2/h-entry/justahyperlink.json +11 -0
  177. data/vendor/tests/tests/microformats-v2/h-entry/justaname.html +1 -0
  178. data/vendor/tests/tests/microformats-v2/h-entry/justaname.json +10 -0
  179. data/vendor/tests/tests/microformats-v2/h-entry/scriptstyletags.html +4 -0
  180. data/vendor/tests/tests/microformats-v2/h-entry/scriptstyletags.json +14 -0
  181. data/vendor/tests/tests/microformats-v2/h-entry/summarycontent.html +20 -0
  182. data/vendor/tests/tests/microformats-v2/h-entry/summarycontent.json +25 -0
  183. data/vendor/tests/tests/microformats-v2/h-entry/u-property.html +33 -0
  184. data/vendor/tests/tests/microformats-v2/h-entry/u-property.json +12 -0
  185. data/vendor/tests/tests/microformats-v2/h-entry/urlincontent.html +13 -0
  186. data/vendor/tests/tests/microformats-v2/h-entry/urlincontent.json +14 -0
  187. data/vendor/tests/tests/microformats-v2/h-event/ampm.html +41 -0
  188. data/vendor/tests/tests/microformats-v2/h-event/ampm.json +21 -0
  189. data/vendor/tests/tests/microformats-v2/h-event/attendees.html +13 -0
  190. data/vendor/tests/tests/microformats-v2/h-event/attendees.json +37 -0
  191. data/vendor/tests/tests/microformats-v2/h-event/change-log.html +82 -0
  192. data/vendor/tests/tests/microformats-v2/h-event/combining.html +13 -0
  193. data/vendor/tests/tests/microformats-v2/h-event/combining.json +25 -0
  194. data/vendor/tests/tests/microformats-v2/h-event/concatenate.html +8 -0
  195. data/vendor/tests/tests/microformats-v2/h-event/concatenate.json +12 -0
  196. data/vendor/tests/tests/microformats-v2/h-event/dates.html +13 -0
  197. data/vendor/tests/tests/microformats-v2/h-event/dates.json +26 -0
  198. data/vendor/tests/tests/microformats-v2/h-event/dt-property.html +23 -0
  199. data/vendor/tests/tests/microformats-v2/h-event/dt-property.json +20 -0
  200. data/vendor/tests/tests/microformats-v2/h-event/justahyperlink.html +1 -0
  201. data/vendor/tests/tests/microformats-v2/h-event/justahyperlink.json +11 -0
  202. data/vendor/tests/tests/microformats-v2/h-event/justaname.html +1 -0
  203. data/vendor/tests/tests/microformats-v2/h-event/justaname.json +10 -0
  204. data/vendor/tests/tests/microformats-v2/h-event/time.html +47 -0
  205. data/vendor/tests/tests/microformats-v2/h-event/time.json +25 -0
  206. data/vendor/tests/tests/microformats-v2/h-feed/implied-title.html +30 -0
  207. data/vendor/tests/tests/microformats-v2/h-feed/implied-title.json +23 -0
  208. data/vendor/tests/tests/microformats-v2/h-feed/simple.html +26 -0
  209. data/vendor/tests/tests/microformats-v2/h-feed/simple.json +33 -0
  210. data/vendor/tests/tests/microformats-v2/h-geo/abbrpattern.html +5 -0
  211. data/vendor/tests/tests/microformats-v2/h-geo/abbrpattern.json +12 -0
  212. data/vendor/tests/tests/microformats-v2/h-geo/altitude.html +8 -0
  213. data/vendor/tests/tests/microformats-v2/h-geo/altitude.json +13 -0
  214. data/vendor/tests/tests/microformats-v2/h-geo/change-log.html +67 -0
  215. data/vendor/tests/tests/microformats-v2/h-geo/hidden.html +10 -0
  216. data/vendor/tests/tests/microformats-v2/h-geo/hidden.json +12 -0
  217. data/vendor/tests/tests/microformats-v2/h-geo/justaname.html +3 -0
  218. data/vendor/tests/tests/microformats-v2/h-geo/justaname.json +10 -0
  219. data/vendor/tests/tests/microformats-v2/h-geo/simpleproperties.html +5 -0
  220. data/vendor/tests/tests/microformats-v2/h-geo/simpleproperties.json +12 -0
  221. data/vendor/tests/tests/microformats-v2/h-geo/valuetitleclass.html +11 -0
  222. data/vendor/tests/tests/microformats-v2/h-geo/valuetitleclass.json +12 -0
  223. data/vendor/tests/tests/microformats-v2/h-news/all.html +35 -0
  224. data/vendor/tests/tests/microformats-v2/h-news/all.json +51 -0
  225. data/vendor/tests/tests/microformats-v2/h-news/change-log.html +78 -0
  226. data/vendor/tests/tests/microformats-v2/h-news/minimum.html +24 -0
  227. data/vendor/tests/tests/microformats-v2/h-news/minimum.json +40 -0
  228. data/vendor/tests/tests/microformats-v2/h-org/change-log.html +57 -0
  229. data/vendor/tests/tests/microformats-v2/h-org/hyperlink.html +1 -0
  230. data/vendor/tests/tests/microformats-v2/h-org/hyperlink.json +11 -0
  231. data/vendor/tests/tests/microformats-v2/h-org/simple.html +1 -0
  232. data/vendor/tests/tests/microformats-v2/h-org/simple.json +10 -0
  233. data/vendor/tests/tests/microformats-v2/h-org/simpleproperties.html +4 -0
  234. data/vendor/tests/tests/microformats-v2/h-org/simpleproperties.json +12 -0
  235. data/vendor/tests/tests/microformats-v2/h-product/aggregate.html +21 -0
  236. data/vendor/tests/tests/microformats-v2/h-product/aggregate.json +45 -0
  237. data/vendor/tests/tests/microformats-v2/h-product/change-log.html +62 -0
  238. data/vendor/tests/tests/microformats-v2/h-product/justahyperlink.html +1 -0
  239. data/vendor/tests/tests/microformats-v2/h-product/justahyperlink.json +11 -0
  240. data/vendor/tests/tests/microformats-v2/h-product/justaname.html +1 -0
  241. data/vendor/tests/tests/microformats-v2/h-product/justaname.json +10 -0
  242. data/vendor/tests/tests/microformats-v2/h-product/simpleproperties.html +10 -0
  243. data/vendor/tests/tests/microformats-v2/h-product/simpleproperties.json +26 -0
  244. data/vendor/tests/tests/microformats-v2/h-recipe/all.html +63 -0
  245. data/vendor/tests/tests/microformats-v2/h-recipe/all.json +54 -0
  246. data/vendor/tests/tests/microformats-v2/h-recipe/change-log.html +62 -0
  247. data/vendor/tests/tests/microformats-v2/h-recipe/minimum.html +7 -0
  248. data/vendor/tests/tests/microformats-v2/h-recipe/minimum.json +17 -0
  249. data/vendor/tests/tests/microformats-v2/h-resume/affiliation.html +12 -0
  250. data/vendor/tests/tests/microformats-v2/h-resume/affiliation.json +20 -0
  251. data/vendor/tests/tests/microformats-v2/h-resume/change-log.html +78 -0
  252. data/vendor/tests/tests/microformats-v2/h-resume/contact.html +17 -0
  253. data/vendor/tests/tests/microformats-v2/h-resume/contact.json +26 -0
  254. data/vendor/tests/tests/microformats-v2/h-resume/education.html +13 -0
  255. data/vendor/tests/tests/microformats-v2/h-resume/education.json +30 -0
  256. data/vendor/tests/tests/microformats-v2/h-resume/justaname.html +1 -0
  257. data/vendor/tests/tests/microformats-v2/h-resume/justaname.json +10 -0
  258. data/vendor/tests/tests/microformats-v2/h-resume/skill.html +12 -0
  259. data/vendor/tests/tests/microformats-v2/h-resume/skill.json +12 -0
  260. data/vendor/tests/tests/microformats-v2/h-resume/work.html +16 -0
  261. data/vendor/tests/tests/microformats-v2/h-resume/work.json +31 -0
  262. data/vendor/tests/tests/microformats-v2/h-review-aggregate/change-log.html +78 -0
  263. data/vendor/tests/tests/microformats-v2/h-review-aggregate/hevent.html +13 -0
  264. data/vendor/tests/tests/microformats-v2/h-review-aggregate/hevent.json +23 -0
  265. data/vendor/tests/tests/microformats-v2/h-review-aggregate/justahyperlink.html +8 -0
  266. data/vendor/tests/tests/microformats-v2/h-review-aggregate/justahyperlink.json +19 -0
  267. data/vendor/tests/tests/microformats-v2/h-review-aggregate/simpleproperties.html +18 -0
  268. data/vendor/tests/tests/microformats-v2/h-review-aggregate/simpleproperties.json +26 -0
  269. data/vendor/tests/tests/microformats-v2/h-review/change-log.html +84 -0
  270. data/vendor/tests/tests/microformats-v2/h-review/hyperlink.html +1 -0
  271. data/vendor/tests/tests/microformats-v2/h-review/hyperlink.json +11 -0
  272. data/vendor/tests/tests/microformats-v2/h-review/implieditem.html +4 -0
  273. data/vendor/tests/tests/microformats-v2/h-review/implieditem.json +19 -0
  274. data/vendor/tests/tests/microformats-v2/h-review/item.html +8 -0
  275. data/vendor/tests/tests/microformats-v2/h-review/item.json +20 -0
  276. data/vendor/tests/tests/microformats-v2/h-review/justaname.html +1 -0
  277. data/vendor/tests/tests/microformats-v2/h-review/justaname.json +10 -0
  278. data/vendor/tests/tests/microformats-v2/h-review/photo.html +1 -0
  279. data/vendor/tests/tests/microformats-v2/h-review/photo.json +11 -0
  280. data/vendor/tests/tests/microformats-v2/h-review/vcard.html +23 -0
  281. data/vendor/tests/tests/microformats-v2/h-review/vcard.json +48 -0
  282. data/vendor/tests/tests/microformats-v2/rel/change-log.html +67 -0
  283. data/vendor/tests/tests/microformats-v2/rel/duplicate-rels.html +10 -0
  284. data/vendor/tests/tests/microformats-v2/rel/duplicate-rels.json +75 -0
  285. data/vendor/tests/tests/microformats-v2/rel/license.html +1 -0
  286. data/vendor/tests/tests/microformats-v2/rel/license.json +12 -0
  287. data/vendor/tests/tests/microformats-v2/rel/nofollow.html +1 -0
  288. data/vendor/tests/tests/microformats-v2/rel/nofollow.json +12 -0
  289. data/vendor/tests/tests/microformats-v2/rel/rel-urls.html +8 -0
  290. data/vendor/tests/tests/microformats-v2/rel/rel-urls.json +33 -0
  291. data/vendor/tests/tests/microformats-v2/rel/varying-text-duplicate-rels.html +4 -0
  292. data/vendor/tests/tests/microformats-v2/rel/varying-text-duplicate-rels.json +20 -0
  293. data/vendor/tests/tests/microformats-v2/rel/xfn-all.html +19 -0
  294. data/vendor/tests/tests/microformats-v2/rel/xfn-all.json +92 -0
  295. data/vendor/tests/tests/microformats-v2/rel/xfn-elsewhere.html +10 -0
  296. data/vendor/tests/tests/microformats-v2/rel/xfn-elsewhere.json +40 -0
  297. metadata +285 -37
  298. data/lib/microformats2/collection.rb +0 -136
  299. data/lib/microformats2/format.rb +0 -151
  300. data/lib/microformats2/implied_property/foundation.rb +0 -59
  301. data/lib/microformats2/implied_property/name.rb +0 -34
  302. data/lib/microformats2/implied_property/photo.rb +0 -28
  303. data/lib/microformats2/implied_property/url.rb +0 -24
  304. data/lib/microformats2/property.rb +0 -21
  305. data/lib/microformats2/property/date_time.rb +0 -28
  306. data/lib/microformats2/property/embedded.rb +0 -9
  307. data/lib/microformats2/property/foundation.rb +0 -143
  308. data/lib/microformats2/property/text.rb +0 -16
  309. data/lib/microformats2/property/url.rb +0 -26
  310. data/spec/lib/microformats2/collection_spec.rb +0 -252
  311. data/spec/lib/microformats2/implied_property/name_spec.rb +0 -31
  312. data/spec/lib/microformats2/implied_property/photo_spec.rb +0 -31
  313. data/spec/lib/microformats2/implied_property/url_spec.rb +0 -58
@@ -0,0 +1,161 @@
1
+ module Microformats2
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
@@ -1,3 +1,3 @@
1
1
  module Microformats2
2
- VERSION = "2.9.0"
2
+ VERSION = "3.0.0"
3
3
  end
@@ -17,9 +17,10 @@ Gem::Specification.new do |gem|
17
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
18
  gem.require_paths = ["lib"]
19
19
 
20
+ gem.required_ruby_version = ">= 2.0"
21
+
20
22
  gem.add_runtime_dependency "nokogiri"
21
23
  gem.add_runtime_dependency "json"
22
- gem.add_runtime_dependency "activesupport"
23
24
 
24
25
  gem.add_development_dependency "rake"
25
26
  gem.add_development_dependency "rspec"
@@ -3,7 +3,7 @@ require "microformats2/absolute_uri"
3
3
 
4
4
  describe Microformats2::AbsoluteUri do
5
5
  describe "#absolutize" do
6
- subject { Microformats2::AbsoluteUri.new(base, relative).absolutize }
6
+ subject { Microformats2::AbsoluteUri.new(relative, base: base).absolutize }
7
7
  let(:base) { nil }
8
8
 
9
9
  context "when relative is nil" do
@@ -18,7 +18,7 @@ describe Microformats2::AbsoluteUri do
18
18
 
19
19
  context "when relative is a valid absolute URI" do
20
20
  let(:relative) { "http://google.com" }
21
- it { should eq("http://google.com/") }
21
+ it { should eq("http://google.com") }
22
22
  end
23
23
 
24
24
  context "when relative is a valid non-absolute URI" do
@@ -6,7 +6,7 @@ describe Microformats2::Parser do
6
6
 
7
7
  describe "#http_headers" do
8
8
  it "starts as a blank hash" do
9
- parser.http_headers.should eq({})
9
+ expect(parser.http_headers).to eq({})
10
10
  end
11
11
 
12
12
  describe "open file" do
@@ -15,10 +15,10 @@ describe Microformats2::Parser do
15
15
  end
16
16
 
17
17
  it "doesn't save #http_headers" do
18
- parser.http_headers.should eq({})
18
+ expect(parser.http_headers).to eq({})
19
19
  end
20
20
  it "saves #http_body" do
21
- parser.http_body.should include "<!DOCTYPE html>"
21
+ expect(parser.http_body).to include "<!DOCTYPE html>"
22
22
  end
23
23
  end
24
24
 
@@ -31,11 +31,42 @@ describe Microformats2::Parser do
31
31
  end
32
32
 
33
33
  it "saves #http_headers" do
34
- parser.http_headers.should eq({"content-length" => "3"})
34
+ expect(parser.http_headers).to eq({"content-length" => "3"})
35
35
  end
36
36
  it "saves #http_body" do
37
- parser.http_body.should eq("abc")
37
+ expect(parser.http_body).to eq("abc")
38
38
  end
39
39
  end
40
40
  end
41
+
42
+ describe "microformat-tests/tests" do
43
+ cases_dir = "vendor/tests/tests/*"
44
+ #cases_dir = "vendor/tests/tests/microformats-mixed"
45
+ #cases_dir = "vendor/tests/tests/microformats-v1"
46
+ #cases_dir = "vendor/tests/tests/microformats-working"
47
+ #cases_dir = "vendor/tests/tests/microformats-v2" #limit to only v2 for now
48
+ Dir[File.join(cases_dir, "*")].each do |page_dir|
49
+ describe page_dir.split("/")[-2..-1].join("/") do
50
+ Dir[File.join(page_dir, "*")].keep_if { |f| f =~ /([.]json$)/ }.each do |json_file|
51
+ it "#{json_file.split("/").last}" do
52
+
53
+ if json_file =~ /\/includes\//
54
+ pending "include-pattern are not yet implemented"
55
+ elsif json_file =~ /\/h-entry\/urlincontent/
56
+ pending "known issue / this is an aspect of nokogiri / won't fix"
57
+ elsif json_file =~ /\/hcard\/email/
58
+ pending "believed issue with the test suite, test needs to be fixed"
59
+ end
60
+ #pending "These are dynamic tests that are not yet passing so commenting out for now"
61
+ html_file = json_file.gsub(/([.]json$)/, ".html")
62
+ html = open(html_file).read
63
+ json = open(json_file).read
64
+
65
+ expect(JSON.parse(Microformats2.parse(html, base: 'http://example.com').to_json)).to eq(JSON.parse(json))
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end
71
+
41
72
  end
@@ -9,25 +9,25 @@ describe Microformats2 do
9
9
  end
10
10
 
11
11
  describe "::parse" do
12
- it "returns a collection" do
13
- Microformats2.parse(@html).should be_kind_of Microformats2::Collection
12
+ it "returns ParserResult" do
13
+ expect(Microformats2.parse(@html)).to be_kind_of Microformats2::Collection
14
14
  end
15
15
  end
16
16
 
17
17
  describe "::read_html" do
18
18
  it "can be a string of html" do
19
- Microformats2.read_html(@html).should include @html
19
+ expect(Microformats2.read_html(@html)).to include @html
20
20
  end
21
21
  it "can be a file path to html" do
22
22
  html = "spec/support/lib/microformats2/simple.html"
23
- Microformats2.read_html(html).should include "<div class=\"h-card\">"
23
+ expect(Microformats2.read_html(html)).to include "<div class=\"h-card\">"
24
24
  end
25
25
  it "can be a url to html" do
26
26
  stub_request(:get, "http://google.com/").
27
27
  with(:headers => {'Accept'=>'*/*', 'User-Agent'=>'Ruby'}).
28
28
  to_return(:status => 200, :body => "google", :headers => {})
29
29
  html = "http://google.com"
30
- Microformats2.read_html(html).should include "google"
30
+ expect(Microformats2.read_html(html)).to include "google"
31
31
  end
32
32
  end
33
33
  end
@@ -3,7 +3,6 @@ SimpleCov.start
3
3
 
4
4
  require 'rubygems'
5
5
  require 'rspec'
6
- require 'rspec/autorun'
7
6
  require 'webmock/rspec'
8
7
 
9
8
  RSpec.configure do |config|
@@ -0,0 +1,25 @@
1
+
2
+ lib-cov
3
+ *.seed
4
+ *.log
5
+ *.csv
6
+ *.dat
7
+ *.out
8
+ *.pid
9
+ *.gz
10
+
11
+ pids
12
+ logs
13
+ results
14
+
15
+ node_modules
16
+ lib
17
+ oldhtml
18
+ templates/change-log.html
19
+
20
+ npm-debug.log
21
+ _site
22
+ .DS_Store
23
+ *.svn-base
24
+
25
+
@@ -0,0 +1,36 @@
1
+ # Creative Commons Legal Code
2
+
3
+ ## CC0 1.0 Universal
4
+
5
+ http://creativecommons.org/publicdomain/zero/1.0
6
+
7
+ Official translations of this legal tool are available> CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED HEREUNDER.
8
+
9
+ ### _Statement of Purpose_
10
+
11
+ The laws of most jurisdictions throughout the world automatically confer exclusive Copyright and Related Rights (defined below) upon the creator and subsequent owner(s) (each and all, an "owner") of an original work of authorship and/or a database (each, a "Work").
12
+
13
+ Certain owners wish to permanently relinquish those rights to a Work for the purpose of contributing to a commons of creative, cultural and scientific works ("Commons") that the public can reliably and without fear of later claims of infringement build upon, modify, incorporate in other works, reuse and redistribute as freely as possible in any form whatsoever and for any purposes, including without limitation commercial purposes. These owners may contribute to the Commons to promote the ideal of a free culture and the further production of creative, cultural and scientific works, or to gain reputation or greater distribution for their Work in part through the use and efforts of others.
14
+
15
+ For these and/or other purposes and motivations, and without any expectation of additional consideration or compensation, the person associating CC0 with a Work (the "Affirmer"), to the extent that he or she is an owner of Copyright and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and publicly distribute the Work under its terms, with knowledge of his or her Copyright and Related Rights in the Work and the meaning and intended legal effect of CC0 on those rights.
16
+
17
+ **1. Copyright and Related Rights.** A Work made available under CC0 may be protected by copyright and related or neighboring rights ("Copyright and Related Rights"). Copyright and Related Rights include, but are not limited to, the following:
18
+
19
+ 1. the right to reproduce, adapt, distribute, perform, display, communicate, and translate a Work;
20
+ 2. moral rights retained by the original author(s) and/or performer(s);
21
+ 3. publicity and privacy rights pertaining to a person's image or likeness depicted in a Work;
22
+ 4. rights protecting against unfair competition in regards to a Work, subject to the limitations in paragraph 4(a), below;
23
+ 5. rights protecting the extraction, dissemination, use and reuse of data in a Work;
24
+ 6. database rights (such as those arising under Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, and under any national implementation thereof, including any amended or successor version of such directive); and
25
+ 7. other similar, equivalent or corresponding rights throughout the world based on applicable law or treaty, and any national implementations thereof.
26
+
27
+ **2. Waiver.** To the greatest extent permitted by, but not in contravention of, applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and unconditionally waives, abandons, and surrenders all of Affirmer's Copyright and Related Rights and associated claims and causes of action, whether now known or unknown (including existing as well as future claims and causes of action), in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each member of the public at large and to the detriment of Affirmer's heirs and successors, fully intending that such Waiver shall not be subject to revocation, rescission, cancellation, termination, or any other legal or equitable action to disrupt the quiet enjoyment of the Work by the public as contemplated by Affirmer's express Statement of Purpose.
28
+
29
+ **3. Public License Fallback.** Should any part of the Waiver for any reason be judged legally invalid or ineffective under applicable law, then the Waiver shall be preserved to the maximum extent permitted taking into account Affirmer's express Statement of Purpose. In addition, to the extent the Waiver is so judged Affirmer hereby grants to each affected person a royalty-free, non transferable, non sublicensable, non exclusive, irrevocable and unconditional license to exercise Affirmer's Copyright and Related Rights in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the "License"). The License shall be deemed effective as of the date CC0 was applied by Affirmer to the Work. Should any part of the License for any reason be judged legally invalid or ineffective under applicable law, such partial invalidity or ineffectiveness shall not invalidate the remainder of the License, and in such case Affirmer hereby affirms that he or she will not (i) exercise any of his or her remaining Copyright and Related Rights in the Work or (ii) assert any associated claims and causes of action with respect to the Work, in either case contrary to Affirmer's express Statement of Purpose.
30
+
31
+ **4. Limitations and Disclaimers.**
32
+
33
+ 1. No trademark or patent rights held by Affirmer are waived, abandoned, surrendered, licensed or otherwise affected by this document.
34
+ 2. Affirmer offers the Work as-is and makes no representations or warranties of any kind concerning the Work, express, implied, statutory or otherwise, including without limitation warranties of title, merchantability, fitness for a particular purpose, non infringement, or the absence of latent or other defects, accuracy, or the present or absence of errors, whether or not discoverable, all to the greatest extent permissible under applicable law.
35
+ 3. Affirmer disclaims responsibility for clearing rights of other persons that may apply to the Work or any use thereof, including without limitation any person's Copyright and Related Rights in the Work. Further, Affirmer disclaims responsibility for obtaining any necessary consents, permissions or other rights required for any use of the Work.
36
+ 4. Affirmer understands and acknowledges that Creative Commons is not a party to this document and has no duty or obligation with respect to this CC0 or use of the Work.
@@ -0,0 +1,48 @@
1
+ # Microformats test suite
2
+
3
+ This group of tests was built to test microformats parsers. The individual tests are files containing fragments of HTML. There is also a second a corresponding JSON file, which contains the expected output.
4
+
5
+ The tests are broken into sets within the tests directory of this project. They are first grouped by version. Some parsers only support a single version of microformats. They are then subdivided by the type of microformat i.e. h-card.
6
+
7
+
8
+ ## NPM
9
+
10
+ The test have been added to npm (Node Package Manager) and the latest version can be add to a project using the following command:
11
+
12
+ npm i microformat-tests --save
13
+
14
+
15
+ ## Contributing new tests or updating tests
16
+
17
+ This set of test belongs to the microformats community. If you find any errors in the current test or new patterns you believe should be in the test suite please feel free to send a pull request.
18
+
19
+ Notes on creating a new test
20
+
21
+ A test is built in two parts a HTML file, which contains a fragment of HTML to parse, and JSON file with the expected output from a parser.
22
+
23
+ 1. Within the “test” directory of this project select the correct directory for the version of microformats the test belongs to. If you are creating a test for a new microformats feature or exploring an issue please add these tests to the “experimental” directory.
24
+
25
+ 2. Within the correct directory add your new test to subdirecory with either the name of it format i.e. `h-card` or the name of the new feature.
26
+
27
+ 3. Create the HTML file. Add the smallest and clearest example of the markup you can. There is no need to add head or body tags etc.
28
+
29
+ 4. Create a JSON file with the same name as your HTML file. The JSON should be the expected output from a parser.
30
+
31
+ 5. Once you have created the test please update the change-log.html Add a `h-entry` with details of the test . At the bottom of the page please add yourself as a contributor on the authors list
32
+
33
+
34
+ ## Date format for testing purposes
35
+
36
+ Within the tests datetime formats are based on the [HTML5 profile](http://www.w3.org/TR/html5/infrastructure.html#dates-and-times) which is a subset of ISO8601 and allows a space to separate the date and time. To allow us to compare dates please provide a way for your parser to output dates/times with the follwing rules:
37
+
38
+ * Date and time are separated by a spaces ie `2015-04-29 15:34`
39
+ * Date and time keeps the authored level of specificity ie `15:34` does NOT become `15:34:00`
40
+ * Times and timezones always use the `:` separator ie `+01:30` NOT `+0130`
41
+ * If used the zulu is always uppercase ie `2015-04-29 15:34Z`
42
+
43
+
44
+ ## License
45
+
46
+ **Microformats test suite** is dedicated to the public domain using Creative Commons -- CC0 1.0 Universal.
47
+
48
+ http://creativecommons.org/publicdomain/zero/1.0
@@ -0,0 +1,84 @@
1
+ 'use strict';
2
+ // This file create a small node server so
3
+ // you view the files over http://localhost:3009/
4
+ // enter in commandline - $ node app
5
+ // Glenn Jones
6
+
7
+
8
+ var Hapi = require('hapi'),
9
+ Blipp = require('blipp'),
10
+ Pack = require('./package');
11
+
12
+
13
+ var routes = [{
14
+ method: 'GET',
15
+ path: '/{path*}',
16
+ handler: {
17
+ directory: {
18
+ path: '/tests',
19
+ listing: true,
20
+ index: false
21
+ }
22
+ }
23
+ },{
24
+ method: 'GET',
25
+ path: '/css/{path*}',
26
+ handler: {
27
+ directory: {
28
+ path: './css',
29
+ listing: true,
30
+ index: true
31
+ }
32
+ }
33
+ },{
34
+ method: 'GET',
35
+ path: '/javascript/{path*}',
36
+ handler: {
37
+ directory: {
38
+ path: './javascript',
39
+ listing: true,
40
+ index: true
41
+ }
42
+ }
43
+ }];
44
+
45
+
46
+
47
+ // Create a server with a host and port
48
+ var server = new Hapi.Server();
49
+
50
+ server.connection({
51
+ host: (process.env.PORT)? '0.0.0.0' : 'localhost',
52
+ port: parseInt(process.env.PORT, 10) || 3008
53
+ });
54
+
55
+
56
+ // hapi server settings
57
+ server.route(routes);
58
+
59
+
60
+ var goodOptions = {
61
+ opsInterval: 1000,
62
+ reporters: [{
63
+ reporter: require('good-console'),
64
+ events: { log: '*', response: '*' }
65
+ }]
66
+ };
67
+
68
+
69
+
70
+ // Register plug-in and start
71
+ server.register([{
72
+ register: require('good'),
73
+ options: goodOptions
74
+ },{
75
+ register: require('blipp'),
76
+ }], function (err) {
77
+ if (err) {
78
+ console.error(err);
79
+ }else {
80
+ server.start(function () {
81
+ console.info('Server started at ' + server.info.uri);
82
+ });
83
+ }
84
+ });