Skip to content

Commit 46a90f9

Browse files
committed
Upate hreview backcompat
Parse rel="self bookmark" as u-url
1 parent 7daaefd commit 46a90f9

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

Mf2/Parser.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1647,6 +1647,15 @@ public function backcompat(DOMElement $el, $context = '', $isParentMf2 = false)
16471647
}
16481648
}
16491649

1650+
$rel_self_bookmark = $this->xpath->query('.//*[contains(concat(" ", normalize-space(@rel), " "), " self ") and contains(concat(" ", normalize-space(@rel), " "), " bookmark ")]', $el);
1651+
1652+
if ( $rel_self_bookmark->length ) {
1653+
foreach ( $rel_self_bookmark as $tempEl ) {
1654+
$this->addMfClasses($tempEl, 'u-url');
1655+
$this->addUpgraded($tempEl, array('self', 'bookmark'));
1656+
}
1657+
}
1658+
16501659
$this->upgradeRelTagToCategory($el);
16511660
break;
16521661

tests/Mf2/ClassicMicroformatsTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -761,6 +761,7 @@ public function testParsesClassicHreview() {
761761
</div>
762762
<p>Visit date: <span>April 2005</span></p>
763763
<p>Food eaten: <span>Florentine crepe</span></p>
764+
<p>Permanent link for review: <a rel="self bookmark" href="http://example.com/crepe">http://example.com/crepe</a></p>
764765
</div>
765766
END;
766767
$parser = new Parser($input);

0 commit comments

Comments
 (0)