w3c / reffy

Reffy is a Web spec crawler and analyzer tool. It is notably used to update Webref
MIT License
69 stars 23 forks source link

Extended CSS value definitions #1647

Open cdoublev opened 4 weeks ago

cdoublev commented 4 weeks ago

When a spec extends a production rule whose LHS links to its definition in another spec, reffy reports it as a dangling production rule:

Do you think they could escape this segregation and move to the global values?

I presume this would require parsing the link before extracting the text content, and carry it forward to set rule.href, which does not seem ideal.

I also do not know if the extracted definition href would need to point to the other spec.

tidoust commented 3 weeks ago

Do you think they could escape this segregation and move to the global values?

Yes, that would seem a good thing to do.

There should be a way to tell that this is an extension of a base definition. For properties, we have newValues. Perhaps we could record the syntax in a newValue property here, although I note that the semantics are slightly different: for newValues, these are additional values, whereas the extension here seems to always overwrite the base definition.

I presume this would require parsing the link before extracting the text content, and carry it forward to set rule.href, which does not seem ideal.

An additional complication is that these <pre> blocks may contain more than one production rule :( That is what the split on reSplitLines a couple of lines after the one you referenced attempts to take care of: https://github.com/w3c/reffy/blob/30ab8e13c8f5b645cb2f1a4a91237a752fb5ae17/src/browserlib/extract-cssdfn.mjs#L568-L574

I also do not know if the extracted definition href would need to point to the other spec.

For property extensions, we simply do not put capture any href. I would suggest to do the same.