This repository was archived by the owner on Jun 21, 2022. It is now read-only.
Add CompatGroup macro - #650
Closed
wbamberg wants to merge 4 commits into
Closed
Conversation
Author
|
I've added some basic tests for this macro. Would love feedback on whether this is a good way to structure tests and whether there are any conditions I've missed that I should have got. We should probably also have tests for |
Contributor
|
Would be lovely to see progress on this but am not sure if or how I can be of any help; I'm eager to see this eventually expand to API documentation. |
Author
|
It doesn't seem likely this will get merged. |
Member
|
For the record: A more recent idea to maybe achieve this was notion to add keywords to things in BCD (or to stumptown). See this great comment by Will: mdn/browser-compat-data#4051 (comment) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
CompatBetamacro. 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
CompatGroupto share the rendering code (which is most of the work) this PR also splits out the rendering work fromCompatBetainto 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 callCompatRenderCompatGroup: given the name of a CSS module, get the JSON objects for the properties it contains, then callCompatRenderThe macro is called
CompatGroupeven 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
Compatmacro with this change.