Skip to content

Clarify parsing for mf2 property + mf2 root inside mf1 root #37

@gRegorLove

Description

@gRegorLove

If there is a nested mf2 property + mf2 root inside an mf1 root, should parsers:

  1. Parse only the child mf2 root, in children
  2. Ignore both
  3. Parse the mf2 property as if it were inside an mf2 root

Example markup derived from @chrisaldrich's post, which temporarily lost the h-entry leaving hentry with mf2 u-invitee h-card properties:

<article class="hentry">
  <a href="https://example.com" class="u-invitee h-card">John Doe</a>
  <a href="https://gregorlove.com" class="u-invitee">gRegor</a>
</article>

The second link there, sans h-card, is to contrast that mf2 properties on their own inside an mf1 root are ignored.

php-mf2 result:

"items": [
    {
        "type": [
            "h-entry"
        ],
        "properties": {
            "invitee": [
                {
                    "type": [
                        "h-card"
                    ],
                    "properties": {
                        "name": [
                            "John Doe"
                        ],
                        "url": [
                            "https://example.com"
                        ]
                    },
                    "value": "https://example.com"
                }
            ]
        }
    }
]

mf2py result:

"items": [
    {
        "type": [
            "h-entry"
        ], 
        "properties": {}, 
        "children": [
            {
                "type": [
                    "h-card"
                ], 
                "properties": {
                    "url": [
                        "https://example.com"
                    ], 
                    "name": [
                        "John Doe"
                    ]
                }
            }
        ]
    }
]

microformats-node result:

"items": [{
    "type": ["h-entry"],
    "properties": {
        "invitee": [{
            "value": "https://example.com",
            "type": ["h-card"],
            "properties": {
                "name": ["John Doe"],
                "url": ["https://example.com"]
            }
        }]
    }
}]

I'm inclined to answer 1, like mf2py does.

The quote from http://microformats.org/wiki/microformats2-parsing that seems unclear is:

if that child element itself has a microformat ("h-*" or backcompat roots) and is a property element, add it into the array of values for that property as a { } structure, add to that { } structure:

"and is a property element" could be clarified so it's explicit about what to do in backcompat.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions