microformats/php-mf2

Fix u- parsing for <video> with poster attribute

gRegorLove opened this issue · 1 comments

video element's poster attribute should be used when parsing for u-, per http://microformats.org/wiki/microformats2-parsing##else+if+video

Isolated example from microformats test suite:

<div class="h-entry">
    <p class="p-name">microformats.org at 7</p>
    <video class="u-photo" poster="posterimage.jpg">
        Sorry, your browser doesn't support embedded videos.
    </video>
</div>

Expected result:

{
    "items": [{
        "type": ["h-entry"],
        "properties": {
            "name": ["microformats.org at 7"],
            "photo": ["posterimage.jpg"]
        }
    }],
    "rels": {},
    "rel-urls": {}
}

Test: https://github.com/microformats/tests/blob/master/tests/microformats-v2/h-entry/u-property.html
Expected: https://github.com/microformats/tests/blob/master/tests/microformats-v2/h-entry/u-property.json

The example test is a little unrealistic, since there is no actual video file referenced. Is there a better example we could use for the test that references both a poster image as well as a video file? I believe it would be something like this.

<div class="h-entry">
    <p class="p-name">microformats.org at 7</p>
    <video class="u-photo" poster="posterimage.jpg">
        <source class="u-video" src="video.mp4" type="video/mp4">
        Sorry, your browser doesn't support embedded videos.
    </video>
</div>
{
    "items": [{
        "type": ["h-entry"],
        "properties": {
            "name": ["microformats.org at 7"],
            "photo": ["posterimage.jpg"],
            "video": ["video.mp4"]
        }
    }],
    "rels": {},
    "rel-urls": {}
}