kartikprabhu / backcompat-rules

A set of backwards compatibility rules for parsing microformats.
0 stars 0 forks source link

hreview backcompat #1

Open kartikprabhu opened 6 years ago

kartikprabhu commented 6 years ago

According to http://microformats.org/wiki/h-review#Parser_Compatibility hreview backcompat should check for both self and bookmark in rel.

And all the weird item rules

kartikprabhu commented 6 years ago

Proposal for properties that need to be nested in other things for backcompat maybe use the following example from hreview["url"]

old format

        "url": [
            "p-item", 
            "h-item", 
            "u-url"
        ]

new format

        "url": [
            {
                "parent": [
                    "p-item", 
                    "h-item"
                ],
                "self": [
                    "u-url"
                ]
            }
        ]

Alternative:

  1. use type instead of parent and use properties instead of self keys

cc: @gregorlove @kevinmarks @tantek thoughts/suggestions ?

kevinmarks commented 6 years ago

The question is how much of the existing hreview content is using the non-nested markup.

kartikprabhu commented 6 years ago

@kevinmarks yes @gregorlove I think is sorting through the examples in the wild. I am going to wait on this.

However there are also other funny rules http://microformats.org/wiki/h-review#Parser_Compatibility that are not represented. Mainly the ones about item. item is parsed differently depending on whether it comes alone or along with vcard or hproduct or vevent. Also the h-item rule only applies inside a hreview that is item is not its own microformat but only makes sense inside hreview.

gRegorLove commented 6 years ago

I have not found hReviews with fn, url, or photo properties without an intervening item yet. I also haven't tracked down in which version of the hReview specification that was ever shown as a valid way to author hReview. The only mention seems to be in the h-review parser compatibility section.

@kartikprabhu: php-mf2 currently treats the various hReview.item backcompats with simple class replacement. As far as I know it's working well, so the general format you've set in this repo should work.

kartikprabhu commented 6 years ago

@gRegorLove how does php-mf2 then distinguish between item and item vevent ?

gRegorLove commented 6 years ago

The item x variants are special cased before the base class replacements are done: https://github.com/indieweb/php-mf2/blob/master/Mf2/Parser.php#L1528

kartikprabhu commented 6 years ago

related discussion: https://chat.indieweb.org/microformats/2018-03-19#t1521484129193800