Reffy and CSS specifications
Reffy was essentially restricted to specifications that define some WebIDL content. For Geek Week this year, Dominique and I wondered whether we could extend Reffy to support CSS specifications:
- Could we extract all CSS property/descriptor definitions from specifications automatically?
- Could we create a useful syntax tree out of the CSS property/descriptor value definitions automatically?
- Would it reveal potential issues in CSS specs? Would it be useful to improve the quality of the specifications, to automate the creation of tests, or to create/maintain documentation?
We identified and added about 100 CSS specifications to the list of specifications crawled by Reffy, looking at specifications published as W3C Technical reports, as well as Editor’s Drafts from the CSS Working Group, the FX Task Force and the Houdini Task Force.
Reffy can now successfully extract all CSS property/descriptor definitions from these specifications (544 CSS properties as of today), and parse all value definitions that follow the Value Definition Syntax.
A number of issues have been raised against CSS specifications along the way (see CSS Value Definition Syntax issues for details), notably to report invalid value definitions per the syntax and editorial updates that would help automate the extraction and parsing of definitions. The Value Definition Syntax was most likely not created with automated parsing in mind. We could not spot places where definitions were really ambiguous for human beings, but the syntax could perhaps be improved to ease automated processing and prevent any misunderstanding.
Possible next steps
We will continue to investigate the integration with MDN data. That data is currently maintained manually by the community. The possibility to automate part of this process would improve accuracy.
We did not have enough time to run a deep analysis of the resulting syntax tree. Such an analysis might reveal further specification issues. On top of improving the quality of CSS specifications, it should be easy to create a CSS property explorer similar to WebIDLPedia (this one being restricted, as its name suggests, to the exploration of WebIDL used across specifications) out of the list of properties extracted.
The extraction and parsing currently only works for CSS properties and descriptors. It could be interesting to cover at-rules and selectors as well. This may be more challenging though, as actual prose seems to prevail in that area, with fewer parseable code definitions.