microformats/php-mf2

"value" of nested microformats when no matching property exists

sknebel opened this issue · 1 comments

When a nested microformat is parsed, the spec says to set the value property as such:

if it's a p-* property element, use the first p-name of the h-* child
else if it's an e-* property element, re-use its { } structure with existing value: inside.
else if it's a u-* property element and the h-* child has a u-url, use the first such u-url
else use the parsed property value per p-,u-,dt-* parsing respectively

The last step does not seem to be done for p- and dt- properties. (before the recent changes, there always was an implied name, so this happened less often)

I noticed this on http://pin13.net/mf2/?url=https%3A%2F%2Faaronparecki.com%2F2018%2F03%2F14%2F3%2F, where the "location" now has an empty value (admittedly, due to the weather being in there it wasn't great before either)

small test cases:
dt-

<div class="h-entry">
<div class="dt-dummy h-dummy">1997-12-12</div>
</div>

Output:

"properties": {
                "dummy": [
                    {
                        "type": [
                            "h-dummy"
                        ],
                        "properties": {
                            "name": [
                                "1997-12-12"
                            ]
                        }
                    }

The nested object has no value key at all!

p-

<div class="h-entry">
<div class="p-dummy h-dummy"><span class="p-kill-implied-name">foobar</span></div>
</div>

Output:

 {
            "type": [
                "h-entry"
            ],
            "properties": {
                "dummy": [
                    {
                        "type": [
                            "h-dummy"
                        ],
                        "properties": {
                            "kill-implied-name": [
                                "foobar"
                            ]
                        },
                        "value": ""
                    }
                ]
            }
        }

empty value, where it should be foobar.

u- work correctly.

EDIT: @tantek answered in chat:

No it’s not the same. Because there’s explicit p-* markup around the whole thing. Therefore that’s author / publisher intent


I'm working on this currently. I have it working for dt-.

For p- I'm wondering if this is the desired effect. It basically brings back the issue of messy implied p-name, but in the nested microformat's value instead.

For @aaronpk's post the location h-adr value would be:
Portland,\r\n Oregon\r\n \r\n \u2022\r\n \r\n 44\u00b0F

Should this be a spec clarification? Perhaps something like:

if it's a p-* property element, use the first p-name of the h-* child or empty string if no p-name of the h-* child