microformats / microformats2-parsing

For collecting and handling issues with the microformats2 parsing specification: http://microformats.org/wiki/microformats2-parsing
14 stars 6 forks source link

Should the value-title feature of the value-class-pattern be officially deprecated for mf2? #18

Open Zegnat opened 6 years ago

Zegnat commented 6 years ago

The microformats2 parsing specification relies on the older value-class-pattern parsing. This includes a feature for using title attributes as a value through a value-title class. This feature is marked “under consideration for deprecation” but not actually deprecated.

Should this be deprecated now? Current parser support seems very spotty. Of the parsers testable on microformats.io, only Node gets it right. PHP and Python run into some unknown failure, and Go simply doesn’t implement it.

Parser behaviour

Test taken from wiki with an added h-x as root to enable parsing:

<div class="h-x"><span class='dt-start'><span class='value-title' title='2008'>last year</span></span></div>

Node

{
    "type": [ "h-x" ],
    "properties": {
        "start": [ "2008" ],
        "name": [ "last year" ]
    }
}

PHP

{
    "type": [ "h-x" ],
    "properties": {
        "start": [ "T" ],
        "name": [ "last year" ]
    }
}

Python

{
    "type": [ "h-x" ],
    "properties": {
        "start": [ ],
        "name": [ "last year" ]
    }
}

Go

{
    "type": [ "h-x" ],
    "properties": {
        "name": [ "last year" ],
        "start": [ "last year" ]
    }
}
sknebel commented 6 years ago

My understanding was that this was a mf1 feature and thus is relevant only in backcompat cases (e.g. it is used on the homepage of microformats.org).

Seems like it might be a good idea to move the mf2 things to an extra page or mark the very clearly which section is relevant to clarify this.

gRegorLove commented 6 years ago

VCP is the first step of parsing dt- values, whether mf2 or backcompat. I read the value-title section of VCP as a special exception about where to find the "value", particularly with this bit:

Parsing rules for value-title are the same as for value above, with the following change:

  • Where a microformats property has a child element with class name of value-title, the content of the title attribute of that element must be parsed, rather than the portion of the element that would be parsed for a class name of value.

However, YYYY is not a valid format for the date portion according to VCP, only YYYY-MM-DD and YYYY-DDD. That does seem a bit odd and makes me wonder if that value-title example on the wiki was contrived or actually published somewhere.

All that said, I probably lean towards deprecating it.

Zegnat commented 6 years ago

My understanding was that this was a mf1 feature and thus is relevant only in backcompat cases

VCP is the first step of parsing dt- values, whether mf2 or backcompat.

Both p- and dt- parsing start with parsing for the value-class-pattern. u- parsing will fallback to it if it didn’t detect specific URL attributes. Every time the only description in the mf2 spec is a link to the VCP wiki page.

YYYY is not a valid format for the date portion according to VCP, only YYYY-MM-DD and YYYY-DDD.

Apologies. I simply copied the example from the wiki without checking if it was valid.

It also seems to be the reason why the parsers were different. Switching dt- to p- in the example actually has every parser report the correct value for start ("2008"), so seemingly all support value-title. So all the parser differences above are because VCP for date time values is hard, he.

Doesn’t change the fact I would like to see this marked as deprecated :wink: