microformats / php-mf2

php-mf2 is a pure, generic microformats-2 parser for PHP. It makes HTML as easy to consume as JSON.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fix backcompat parsing for geo property

gRegorLove opened this issue · comments

With this test, when the geo property is backcompat parsed as p-geo h-geo, the parser is incorrectly adding an implied p-name for the h-geo.

Simplified HTML:

<div class="vcard">
  <div class="fn">John Doe</div>
  <div>Location: <abbr class="geo" title="30.267991;-97.739568">Brighton</abbr></div>
</div>

parsed:

"items": [
    {
        "type": [
            "h-card"
        ],
        "properties": {
            "name": [
                "John Doe"
            ],
            "geo": [
                {
                    "type": [
                        "h-geo"
                    ],
                    "properties": {
                        "name": [
                            "30.267991;-97.739568"
                        ]
                    },
                    "value": "30.267991;-97.739568"
                }
            ]
        }
    }
]

expected:

"items": [
    {
        "type": [
            "h-card"
        ],
        "properties": {
            "name": [
                "John Doe"
            ],
            "geo": [
                {
                    "type": [
                        "h-geo"
                    ],
                    "properties": {},
                    "value": "30.267991;-97.739568"
                }
            ]
        }
    }
]

I think this switch needs a case for geo.