-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add MDN annotations to spec output #89
Conversation
396b336
to
d1c367f
Compare
This change adds annotations in the margin of the spec output next to any items for which there’s a corresponding MDN article somewhere under https://developer.mozilla.org/en-US/docs/Web that has a Specifications section with a link to that item's URL. The mechanism for inserting the annotations relies on data in a JSON file containing a mapping of spec ID-attribute values to MDN article pathnames. The change adds a copy of that file to the repo, along with a makefile for updating/regenerating the JSON file. Depends on whatwg/wattsi#89
https://arcane-cove-57093.herokuapp.com/multipage/ has sample output from this. It currently adds 761 annotations |
This change adds annotations in the margin of the spec output next to any items for which there’s a corresponding MDN article somewhere under https://developer.mozilla.org/en-US/docs/Web that has a Specifications section with a link to that item's URL. The mechanism for inserting the annotations relies on data in a JSON file containing a mapping of spec ID-attribute values to MDN article pathnames. The change adds a copy of that file to the repo, along with a makefile for updating/regenerating the JSON file. Depends on whatwg/wattsi#89 Fixes #180
594d0f7
to
7f11208
Compare
Overall code seems nice and straightforward; I guess the complexity is all in assembling the JSON file :). What remains is bikeshedding on the markup and CSS. Currently this produces markup like the following: <span class="mdn">
<span class=""><b onclick="toggleStatus(this)">MDN</b> <a href="https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API">Web_Workers_API</a></span>
<span class=""><b onclick="toggleStatus(this)">MDN</b> <a href="https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers">Web_Workers_API/Using_web_workers</a></span>
</span> I would prefer something more like <div class="mdn" onclick="toggleStatus(this)">
<strong>MDN</strong>
<ul>
<li><a href="https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API">Web_Workers_API</a></li>
<li><a href="https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers">Web_Workers_API/Using_web_workers</a></li>
</ul>
</div> (or maybe WDYT? |
Oh, also: if it's possible to gather the data, using the article title instead of URL piece might be good? |
So the difficultly I ran into with using So when that gets parsed the Would have the same problem with using A possible way around that would be to insert the annotation for those cases not into the parent node of the element being annotated but instead before the next sibling of that parent node. But when I tried that, the necessary CSS got uglier (need to use negative margins) — but worse than that, in some cases it resulted in the annotation getting appended to the end of If I spent more time looking at those instances, I reckon I might be figure out how to special-case for them. But in the end, it just seemed a lot simpler and cleaner to use |
Outside of the validation/parsing/styling issue with using a So given all that, it seems like putting the MDN on a separate line in the annotation, above the link title could end up causing a lot of the annotation boxes to overlap with each. So just having the MDN part and link title on the same line seemed a better fit as far as styling. And that allows the entire annotation to be collapsed down to just the MDN prefix part in far right the margin — by clicking on the MDN prefix part itself instead of the link-title hypertext — in cases where the annotation is overlapping the spec text. |
Yes, it’s possible. It just means I’ll need to have the data-file build take the source of each linked-to article and run it through an HTML parser to extract the title. I was anyway already planning to do that in order to extract the |
38faa5a
to
70396eb
Compare
Can we put the div in the sample place that we currently put caniuse boxes, where it's valid? That is directly inside the For example right now a lot of these spans are inside IDL code blocks, but they're definitely not code, so that's not great. In particular if you drag-select the IDL you end up with MDN stuff: I take the point about there only being a single article in most cases. No |
70396eb
to
448a352
Compare
448a352 updates that wattsi code do that; that is, the link hypertext in the annos is now the MDN article title, and when you hover over the link, the article summary will be shown. |
Yeah, I can try that for the IDL blocks at least.
Yeah, I agree that’s bad |
https://arcane-cove-57093.herokuapp.com/multipage/ has the output at this point (with the change made to use the article title and show the article summary on hover) |
Ooof, now I am remembering how bad the MDN titles are... "SharedWorkerGlobalScope.close()", but that doesn't exist, it's |
Have you reported an issue about that? |
This change adds annotations in the margin of the spec output next to any items for which there’s a corresponding MDN article somewhere under https://developer.mozilla.org/en-US/docs/Web that has a Specifications section with a link to that item's URL. The mechanism for inserting the annotations relies on data in a JSON file containing a mapping of spec ID-attribute values to MDN article pathnames. The change adds a copy of that file to the repo, along with a makefile for updating/regenerating the JSON file. Depends on whatwg/wattsi#89 Fixes #180
This change adds annotations in the margin of the spec output next to any items for which there’s a corresponding MDN article somewhere under https://developer.mozilla.org/en-US/docs/Web that has a Specifications section with a link to that item's URL. The mechanism for inserting the annotations relies on data in a JSON file containing a mapping of spec ID-attribute values to MDN article pathnames. The change adds a copy of that file to the repo, along with a makefile for updating/regenerating the JSON file. Depends on whatwg/wattsi#89 Fixes #180
I changed it for the links within
It doesn’t exactly crawl all the way up to find a direct child of the body — because that doesn’t produce a good result in some cases. Specifically, there are some elements with referenced IDs that are children of https://arcane-cove-57093.herokuapp.com/multipage/ has the current output |
Yeah I agree all those should be fixed. I’ll ask about it on #mdn |
Discussed on #mdn and still not sure what’d be the best way to proceed further, but it seems like starting a thread on https://discourse.mozilla.org/c/mdn could be a good way |
This change adds annotations in the margin of the spec output next to any items for which there’s a corresponding MDN article somewhere under https://developer.mozilla.org/en-US/docs/Web that has a Specifications section with a link to that item's URL. The mechanism for inserting the annotations relies on data in a JSON file containing a mapping of spec ID-attribute values to MDN article pathnames. The change adds a copy of that file to the repo, along with a makefile for updating/regenerating the JSON file. Depends on whatwg/wattsi#89 Fixes #180
This change adds annotations in the margin of the spec output next to any items for which there’s a corresponding MDN article somewhere under https://developer.mozilla.org/en-US/docs/Web that has a Specifications section with a link to that item's URL. The mechanism for inserting the annotations relies on data in a JSON file containing a mapping of spec ID-attribute values to MDN article pathnames. The change adds a copy of that file to the repo, along with a makefile for updating/regenerating the JSON file. Depends on whatwg/wattsi#89 Fixes #180
This change adds annotations in the margin of the spec output next to any items for which there’s a corresponding MDN article somewhere under https://developer.mozilla.org/en-US/docs/Web that has a Specifications section with a link to that item's URL. The mechanism for inserting the annotations relies on data in a JSON file containing a mapping of spec ID-attribute values to MDN article pathnames. The change adds a copy of that file to the repo, along with a makefile for updating/regenerating the JSON file. Depends on whatwg/wattsi#89 Fixes #180
This change adds annotations in the margin of the spec output next to any items for which there’s a corresponding MDN article somewhere under https://developer.mozilla.org/en-US/docs/Web that has a Specifications section with a link to that item's URL. The mechanism for inserting the annotations relies on data in a JSON file containing a mapping of spec ID-attribute values to MDN article pathnames. The change adds a copy of that file to the repo, along with a makefile for updating/regenerating the JSON file. Depends on whatwg/wattsi#89 Fixes #180
ef5a467
to
7567221
Compare
LGTM. Let me move the CSS. |
f056082
to
67bd6ca
Compare
This change adds annotations in the margin of the spec output next to any items for which there’s a corresponding MDN article somewhere under https://developer.mozilla.org/en-US/docs/Web that has a Specifications section with a link to that item's URL. The change gives wattsi a new required command-line argument for specifying the filename of a JSON file containing a mapping of spec ID-attribute values to MDN article pathnames. Closes whatwg/html-build#180.
67bd6ca
to
eb731a0
Compare
So is there anything else we’re waiting on before merging this? |
2 similar comments
So is there anything else we’re waiting on before merging this? |
So is there anything else we’re waiting on before merging this? |
I'm a little scared of merging two order-dependent PRs with GitHub in its current fragile state, and how well any subsequent Travis runs and deploys will go. So if we could wait until https://status.github.com/ calms down a bit that'd be ideal. But yeah nothing blocking on the code front. |
This change adds annotations in the margin of the spec output next to any items for which there’s a corresponding MDN article somewhere under https://developer.mozilla.org/en-US/docs/Web that has a Specifications section with a link to that item's URL. The mechanism for inserting the annotations relies on data in a JSON file containing a mapping of spec ID-attribute values to MDN article pathnames. The change adds a copy of that file to the repo, along with a makefile for updating/regenerating the JSON file. Depends on whatwg/wattsi#89. Fixes #180.
This change adds annotations in the margin of the spec output next to any items for which there’s a corresponding MDN article somewhere under https://developer.mozilla.org/en-US/docs/Web that has a Specifications section with a link to that item's URL.
The change gives wattsi a new required command-line argument for specifying the filename of a JSON file containing a mapping of spec ID-attribute values to MDN article pathnames.
Addresses whatwg/html-build#180