Browse Source

Sort out h-card backcompat

master
J. King 1 year ago
parent
commit
b467e82c32
  1. 5
      lib/Parser.php
  2. 7
      tests/cases/StandardTest.php

5
lib/Parser.php

@ -37,12 +37,14 @@ class Parser {
'additional-name' => ['h-card' => ["p", "additional-name"]], 'additional-name' => ['h-card' => ["p", "additional-name"]],
'adr' => ['h-card' => ["p", "adr"]], 'adr' => ['h-card' => ["p", "adr"]],
'affiliation' => ['h-resume' => ["p", "affiliation", ["vcard"]]], 'affiliation' => ['h-resume' => ["p", "affiliation", ["vcard"]]],
'agent' => ['h-card' => ["p", "agent"]],
'attendee' => ['h-event' => ["p", "attendee"]], 'attendee' => ['h-event' => ["p", "attendee"]],
'author' => ['h-entry' => ["p", "author", ["vcard"]], 'h-recipe' => ["p", "author", ["vcard"]], 'h-feed' => ["p", "author", ["vcard"]]], 'author' => ['h-entry' => ["p", "author", ["vcard"]], 'h-recipe' => ["p", "author", ["vcard"]], 'h-feed' => ["p", "author", ["vcard"]]],
'bday' => ['h-card' => ["dt", "bday"]], 'bday' => ['h-card' => ["dt", "bday"]],
'best' => ['h-review' => ["p", "best"], 'h-review-aggregate' => ["p", "best"]], 'best' => ['h-review' => ["p", "best"], 'h-review-aggregate' => ["p", "best"]],
'brand' => ['h-product' => ["p", "brand"]], 'brand' => ['h-product' => ["p", "brand"]],
'category' => ['h-card' => ["p", "category"], 'h-entry' => ["p", "category"], 'h-event' => ["p", "category"], 'h-product' => ["p", "category"]], 'category' => ['h-card' => ["p", "category"], 'h-entry' => ["p", "category"], 'h-event' => ["p", "category"], 'h-product' => ["p", "category"]],
'class' => ['h-card' => ["p", "class"]],
'contact' => ['h-resume' => ["p", "contact", ["vcard"]]], 'contact' => ['h-resume' => ["p", "contact", ["vcard"]]],
'count' => ['h-review-aggregate' => ["p", "count"]], 'count' => ['h-review-aggregate' => ["p", "count"]],
'country-name' => ['h-adr' => ["p", "country-name"], 'h-card' => ["p", "country-name"]], 'country-name' => ['h-adr' => ["p", "country-name"], 'h-card' => ["p", "country-name"]],
@ -77,6 +79,7 @@ class Parser {
'location' => ['h-event' => ["p", "location", ["adr", "vcard"]]], 'location' => ['h-event' => ["p", "location", ["adr", "vcard"]]],
'logo' => ['h-card' => ["u", "logo"]], 'logo' => ['h-card' => ["u", "logo"]],
'longitude' => ['h-card' => ["p", "longitude"], 'h-event' => ["p", "longitude"], 'h-geo' => ["p", "longitude"]], 'longitude' => ['h-card' => ["p", "longitude"], 'h-event' => ["p", "longitude"], 'h-geo' => ["p", "longitude"]],
'mailer' => ['h-card' => ["p", "mailer"]],
'nickname' => ['h-card' => ["p", "nickname"]], 'nickname' => ['h-card' => ["p", "nickname"]],
'note' => ['h-card' => ["p", "note"]], 'note' => ['h-card' => ["p", "note"]],
'nutrition' => ['h-recipe' => ["p", "nutrition"]], 'nutrition' => ['h-recipe' => ["p", "nutrition"]],
@ -97,7 +100,9 @@ class Parser {
'skill' => ['h-resume' => ["p", "skill"]], 'skill' => ['h-resume' => ["p", "skill"]],
'site-description' => ['h-feed' => ["p", "summary"]], 'site-description' => ['h-feed' => ["p", "summary"]],
'site-title' => ['h-feed' => ["p", "name"]], 'site-title' => ['h-feed' => ["p", "name"]],
'sound' => ['h-card' => ["u", "sound"]],
'source-org' => ['h-news' => ["p", "source-org"]], 'source-org' => ['h-news' => ["p", "source-org"]],
'sort-string' => ['h-card' => ["p", "sort-string"]],
'street-address' => ['h-adr' => ["p", "street-address"], 'h-card' => ["p", "street-address"]], 'street-address' => ['h-adr' => ["p", "street-address"], 'h-card' => ["p", "street-address"]],
'summary' => ['h-event' => ["p", "name"], 'h-recipe' => ["p", "summary"], 'h-resume' => ["p", "summary"], 'h-review' => ["p", "name"], 'h-review-aggregate' => ["p", "name"]], 'summary' => ['h-event' => ["p", "name"], 'h-recipe' => ["p", "summary"], 'h-resume' => ["p", "summary"], 'h-review' => ["p", "name"], 'h-review-aggregate' => ["p", "name"]],
'tel' => ['h-card' => ["p", "tel"]], 'tel' => ['h-card' => ["p", "tel"]],

7
tests/cases/StandardTest.php

@ -15,9 +15,8 @@ class StandardTest extends \PHPUnit\Framework\TestCase {
protected const SUPPRESSED = [ protected const SUPPRESSED = [
"microformats-v2/rel/duplicate-rels", // this test has a spurious newline at the beginning of a value "microformats-v2/rel/duplicate-rels", // this test has a spurious newline at the beginning of a value
"microformats-v1/hcard/name", // this test does not follow rules for structured img parsing "microformats-v1/hcard/name", // this test does not follow rules for structured img parsing
"microformats-v1/hcard/multiple", // this test has multiple violations of defined rules
"microformats-v1/hcard/multiple",
"microformats-v1/hcard/single",
"microformats-v1/hproduct/aggregate", "microformats-v1/hproduct/aggregate",
"microformats-v1/hresume/affiliation", "microformats-v1/hresume/affiliation",
"microformats-v1/hresume/education", "microformats-v1/hresume/education",
@ -98,6 +97,10 @@ class StandardTest extends \PHPUnit\Framework\TestCase {
case "microformats-v1/hfeed/simple": case "microformats-v1/hfeed/simple":
$this->fixDates($exp['items'][0]['children'][0]['properties']['updated']); $this->fixDates($exp['items'][0]['children'][0]['properties']['updated']);
break; break;
case "microformats-v1/hcard/single":
$this->fixDates($exp['items'][0]['properties']['bday']);
$this->fixDates($exp['items'][0]['properties']['rev']);
break;
} }
return $exp; return $exp;
} }

Loading…
Cancel
Save