microformats / php-mf2

php-mf2 is a pure, generic microformats-2 parser for PHP. It makes HTML as easy to consume as JSON.
Creative Commons Zero v1.0 Universal
194 stars 38 forks source link

Allow numbers in vendor prefixes #158

Closed gRegorLove closed 6 years ago

gRegorLove commented 6 years ago

Minimal example from https://aaronparecki.com/2018/03/21/18/

<li class="h-entry">
  <data class="p-name" value="Coffee"></data>
  <div class="p-p3k-drank h-p3k-food">
    <span class="value">Coffee</span>
  </div>
</li>

Currently parses:

    "items": [
        {
            "type": [
                "h-entry"
            ],
            "properties": {
                "name": [
                    "Coffee"
                ]
            }
        }
    ]

Expected output via mf2py dev

    "items": [
        {
            "type": [
                "h-entry"
            ], 
            "properties": {
                "name": [
                    "Coffee"
                ], 
                "p3k-drank": [
                    {
                        "type": [
                            "h-p3k-food"
                        ], 
                        "properties": {
                            "name": [
                                "Coffee"
                            ]
                        }, 
                        "value": "Coffee"
                    }
                ]
            }
        }
    ]

Per spec update: https://github.com/microformats/microformats2-parsing/issues/28

gRegorLove commented 6 years ago

See also: https://github.com/kartikprabhu/mf2py/blob/experimental/test/examples/class_names_format.html