Skip to content

"value" of nested microformats when no matching property exists #151

@sknebel

Description

@sknebel

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions