This repository has been archived by the owner on Jun 21, 2022. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a new macro
CompatGroup
. This macro takes as an argument the name of a CSS module (e.g. "CSS Animations"). It uses https://github.com/mdn/data/blob/master/css/properties.json to fetch the properties in that group, and renders a table containing JSON data for those properties. This enables us to embed a single table in pages like https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Grid_Layout that gives an overview of browser support for that area.To do this is also splits the existing
CompatBeta
macro. At the moment this macro takes a path through the compat data object as an argument, resolves that into an array of JSON compat objects, then renders those objects.To enable
CompatGroup
to share the rendering code (which is most of the work) this PR also splits out the rendering work fromCompatBeta
into a new macroCompatRender
.So now we have:
CompatRender
: given an array of JSON objects, one for each table row, render a tableCompatBeta
: given a path through the JSON data, get the JSON objects, flattening them if needed, then callCompatRender
CompatGroup
: given the name of a CSS module, get the JSON objects for the properties it contains, then callCompatRender
The macro is called
CompatGroup
even though it's much more specific than this, currently only dealing with CSS modules. Maybe in future it could do a similar trick with JS and Web APIs, but we'd need solid metadata first.I've done some manual testing to try to confirm that we haven't regressed the existing
Compat
macro with this change.