-
-
Notifications
You must be signed in to change notification settings - Fork 389
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
Contextualizing definitions for export #4522
Comments
Also see tobie/pr-preview#144 |
This appears to be an issue with |
@jandrieu, and just as an aside.... I think to fix the (but there should really be no reason to be using jQuery nowadays) |
We removed jquery a while ago in the "latest" common.js... we should just update the vc-use-cases repo w/ the new https://github.com/w3c/vc-data-model/blob/main/common.js#L131-L185 IOW, this is a |
Also, /cc @gkellogg (who, I believe, wrote the initial
Yes, agreed. I haven't suggested moving some of this to ReSpec yet because it's unclear if I'll try to describe the feature and then see if ReSpec already does this (it might, the In general, we wanted to define ONE terminology file that multiple specs in the WG used. We want a shared terminology file, which is pulled in via The problem with including one terminology file is that not every spec uses all of the terminology, and that results in ReSpec linting warnings. So, the There are at least two problems w/ this approach:
The "ideal" solution, which might already be implemented in ReSpec, or might be so ideal that it's impossible to achieve, is to be able to pull terminology definitions into a specification from any other specification and have them appear in the "Terminology" section of a specification. I don't believe this is currently possible because not every specification defines their terminology like you would find in a dictionary, with the term listed and then a brief description provided. Many definitions are provided in-line in a paragraph that talks about other things. I think W3C has made a few attempts at a "global glossary", and I'm not sure those attempts were resounding successes? I do know that ReSpec does have the ability to reference terms in other specifications, which is useful, but not quite the feature we're looking for here. Mainly because people tend to complain when we cross-link too heavily between specs, especially when reading a single paragraph sends you off into 3-4 other specifications (hooray for proper architectural layering?). The grumbling typically goes like this: "Ugh, why are you making me jump all around to all these specifications when all I want to do is find out how to implement this thing you've specified." (which is a legitimate gripe). So, I think the solution we're looking for here provides for an option to transclude the terminology that we need into the specification and put each term in, verbatim, to a particular Terminology section. Does ReSpec provide this feature today? If not, is this a "generally useful feature"? |
I think it's an antipattern to define the same terms across multiple specifications (sorry VC folks), but it would be generally useful to be able to find full definitions and copy them into the local spec. @tabatkins should also be involved, since it'd be good for the design to work across both Respec and Bikeshed. Right now, as Manu says, definitions are marked with What if we
Then referring specs could generate a Terminology section that included the actual definitions, instead of just a list of "Terms defined by reference". We could also have clicks on references pop up an inline definition (speced/bikeshed#1321) instead of always linking away to the defining spec. |
The All of this is challenging to handle before FPWD, when mutual references are published. But, there are many other challenges of managing a document series. Some specs choose to define terms in a given section, others scatter them through the document, and both ways are reasonable, IMO. But, now that ReSpec supports automating the terms defined and used in the specification using @jyasskin's ideas about something like |
Basically, what @jyasskin said. Defining things across multiple specs should no longer necessary (and bit of an anti-pattern). We have exceptional tooling now for definitions across with "xref" and a bunch of stuff that W3C has built. Even with data-include, there is still a risk of things getting out of sync (specially on TR), so it's best to just define in one place and let ReSpec do the linking to the canonical definition.
Agree. But that's basically what the Web's standard @jyasskin proposal is compelling. <p>
<span class="def">The <dfn>whatever thing</dfn> is the whatever to use</span>.
However, <span class="def"><dfn>this other thing</dfn> is also defined here, and could be show elsewhere</span>
</p> And we just have |
CSS specs often use of the A couple of examples of somewhat lengthy FWIW, Reffy already tries to extract textual definitions from CSS specs when it cannot find anything better (see code). That remains clumsy and essentially unusable, except to provide contextual information to readers reviewing the data. The ability to extract definitions in HTML, instead of text, has been in the back of our mind for some time. This would also be useful for reference documentation projects such as MDN. |
Right, there is no way to extract "the definition" of a term automatically, given current spec-writing practices. It would have to be something spec authors explicitly indicate, and given the very large body of standards that are not actively maintained, it would not be something one could rely on for the vast majority of terms. You could probably do a halfway reasonable approach by taking the entire paragraph a term is defined in, or the first paragraph of the dd corresponding to a definition dt, but it would be a very rough approach, and would fail in many cases. And when the definition is a heading, I don't think there's any automatic extraction that would work. |
discussing this with @tidoust, we would be willing to run an experimentation in this space to see if there is a pattern that could usefully be generalized to other specs. This would mean:
does this feel compelling? the respec work would include both client-side and server-side changes, so getting some sense if people would be ready to put in the work would be useful before we put this in motion. |
Yes, it sounds compelling. If we had this feature, I can volunteer to update the W3C Verifiable Credential and Data Integrity specs to use it instead of what we're doing today... and advocate for other specs to upgrade to the new mechanism as well. |
Yeah, I think this is a reasonable direction to explore. Given that I already have a CSS Index spec auto-genned from Bikeshed, I'd appreciate a more complete definition for them too. ^_^ |
In the generated spec, we are going to need something like a From an authoring perspective, the easier, the better. For the same reason, authors will need some way to relate definition text with a Authoring tools could start by only supporting two cases for that attribute:
Regardless, one possible source of confusion for authors is that the |
Agree with (1) - a I'm not certain what you're referring to with your (2). You're referring to the |
Only half-joking: |
I was thinking that, in the source, it might be more convenient for authors to refer to the For instance, an IDL interface |
I would not try to invent a new reference mechanism for this one location. If you don't want to guess at the generated ID, you can create the ID manually on the definition. |
Happy to see where this goes. Might be good to just start with some very simple cases (inline "dfn" or "dt > dfn + dd" cases) and go from there. |
I offer the VC Data Model v2.0 and Data Integrity specifications as a sacrifice. We do the inline "dt > dfn + dd" thing in those specs (so, it should be fairly straightforward). |
Implements the logic discussed in https://github.com/w3c/respec/issues/4522 For each term defined in the specification being processed, the code now looks for some element flagged with a `data-defines="#term-id"` attribute. If such an element exists, a `prose` property gets added to the definition in the `dfns` extract with the HTML contents of that element. The code applies some clean up to the HTML markup it attaches to the `prose` property: - All asides that authoring tools may add here and there get dropped - Any element that is not a simple block or inline content element gets dropped - All attributes are dropped The clean up logic may need refinement over time once we gain experience with actual definitions. Open questions include: - Should we be stricter, e.g., only allowing `<p>`, `<br>`, and very common inline elements? - Should we keep `href` attributes (with an absolute URL) for `<a>` elements? - Should we keep `title` attributes for `<abbr>` elements? - Should we keep `class` attributes for `<pre>` elements to help with syntax highlighting? - Should we keep tables? Images? There is no good mechanism in Reffy to report potential issues encountered during extraction for the time being. In the meantime, warnings get logged when the code bumps into elements that seem surprising in the context of a term definition.
Via w3c/reffy#1444 (comment). @jyasskin's proposal suggests a The only advanced scenario that comes to mind would be that of a multi-page spec. But that seems bad practice to have the actual definition of a term in a different page from the term itself anyway. |
Yeah, I'd just take it as an id. The definition should always live next to the term being defined. |
I see two reasons:
|
Implements the logic discussed in https://github.com/w3c/respec/issues/4522 For each term defined in the specification being processed, the code now looks for some element flagged with a `data-defines="#term-id"` attribute. If such an element exists, a `htmlProse` property gets added to the definition in the `dfns` extract with the HTML contents of that element. The code applies some clean up to the HTML markup it attaches to the `prose` property: - All asides that authoring tools may add here and there get dropped - Any element that is not a simple block or inline content element gets dropped - All attributes are dropped, except dir, href, lang, title The clean up logic may need refinement over time once we gain experience with actual definitions. Open questions include: - Should we be stricter, e.g., only allowing `<p>`, `<br>`, and very common inline elements? - Should we keep `class` attributes for `<pre>` elements to help with syntax highlighting? - Should we keep tables? Images? There is no good mechanism in Reffy to report potential issues encountered during extraction for the time being. In the meantime, warnings get logged when the code bumps into elements that seem surprising in the context of a term definition.
As discussed in speced#4522 See also w3c/reffy#1444
Specifically, it looks like the request is to put |
Oooh, excellent, thank you! I'll do a pass this weekend on the Verifiable Credentials Data Model spec as well as the Data Integrity spec, which re-uses many of the definitions. I think I might be able to exercise both markup styles provided by the new feature. |
I believe I did the necessary bits in "vc-data-model" here: w3c/vc-data-model@e577060#diff-0eb547304658805aad788d320f10bf1f292797b5e6d745a3bf617584da017051R647 ... and in the rest of the spec here: ... and now I think I need to wait 6 hours to a day for those refs to show up in webref? Once that's done, I plan to start cross-referencing from the vc-data-integrity specification to the vc-data-model specification... and if that works, will be ready to attempt some sort of auto-generate-the-terminology-section PR. I will note that there is another approach that feels compelling, which is showing the terminology definition when you hover over the term, like what's done in Spec-Up (mouse over "verifiable credential" link to see the preview): https://hyperledger.github.io/anoncreds-spec/#terminology -- which obviates the need to click and jump to a separate specification. I'll note that the Spec-Up approach might make it so that auto-generating the terminology section is less ideal (because it removes the need to click and go "somewhere else" to figure out what the term means). We would (most likely?) want to preserve the link that jumps to the definition for a11y reasons. We might also want to include a "Go to definition" link if we choose to take the "term preview" approach that Spec-Up uses. |
needed for w3c/respec#4522 Will add the following entry: ``` { "url": "https://www.w3.org/TR/vc-data-model-2.0/", "seriesComposition": "full", "shortname": "vc-data-model-2.0", "series": { "shortname": "vc-data-model", "currentSpecification": "vc-data-model-2.0", "title": "Verifiable Credentials Data Model", "shortTitle": "Verifiable Credentials Data Model", "releaseUrl": "https://www.w3.org/TR/vc-data-model/", "nightlyUrl": "https://w3c.github.io/vc-data-model/" }, "seriesVersion": "2.0", "categories": [], "organization": "W3C", "groups": [ { "name": "Verifiable Credentials Working Group", "url": "https://www.w3.org/2017/vc/" } ], "release": { "url": "https://www.w3.org/TR/vc-data-model-2.0/", "status": "Candidate Recommendation Draft", "filename": "Overview.html" }, "nightly": { "url": "https://w3c.github.io/vc-data-model/", "status": "Editor's Draft", "alternateUrls": [], "repository": "https://github.com/w3c/vc-data-model", "filename": "index.html" }, "title": "Verifiable Credentials Data Model v2.0", "source": "w3c", "shortTitle": "Verifiable Credentials Data Model v2.0", "standing": "good" } ```
needed for w3c/respec#4522 Will add the following entry: ``` { "url": "https://www.w3.org/TR/vc-data-model-2.0/", "seriesComposition": "full", "shortname": "vc-data-model-2.0", "series": { "shortname": "vc-data-model", "currentSpecification": "vc-data-model-2.0", "title": "Verifiable Credentials Data Model", "shortTitle": "Verifiable Credentials Data Model", "releaseUrl": "https://www.w3.org/TR/vc-data-model/", "nightlyUrl": "https://w3c.github.io/vc-data-model/" }, "seriesVersion": "2.0", "categories": [], "organization": "W3C", "groups": [ { "name": "Verifiable Credentials Working Group", "url": "https://www.w3.org/2017/vc/" } ], "release": { "url": "https://www.w3.org/TR/vc-data-model-2.0/", "status": "Candidate Recommendation Draft", "filename": "Overview.html" }, "nightly": { "url": "https://w3c.github.io/vc-data-model/", "status": "Editor's Draft", "alternateUrls": [], "repository": "https://github.com/w3c/vc-data-model", "filename": "index.html" }, "title": "Verifiable Credentials Data Model v2.0", "source": "w3c", "shortTitle": "Verifiable Credentials Data Model v2.0", "standing": "good" } ```
Hm, yeah, is the idea that we'd generate a terminology section for links with these detected definitions, and have the link jump you to there (with a link to the actual source there, next to the definition)? Similar to how biblios work today? Bikeshed has recently gained the ability to show info panels on links; see flexbox, for example. (Have to be on a device with a pointer; the panel shows up on mousedown. Drag into the panel before releasing to keep it up.) I could definitely embed the definition there, to make it accessible without disrupting the link itself. |
The VC terms and definitions have landed in webref: https://github.com/w3c/webref/blob/main/ed/dfns/vc-data-model-2.0.json. List of definitions
jq '.dfns[]|select(.access =="public" and .htmlProse)|.for[0] +"/" + .linkingText[0] + ": " + .htmlProse' vc-data-model-2.0.json )
The terms are thus already auto-linkable from any Respec or Bikeshed spec. The next steps to enable the automatic inclusion of the definition prose in ReSpec would be to:
While the second step won't work until the first one is deployed, I think it's likely already possible to draft a pull request to experiment with various markup options to achieve the intended result (taking accessibility into account in particular). Any taker for the first step? I'll get to it at some point if nobody else does, but certainly wouldn't mind someone else stepping up :) |
with speced/respec-web-services#401 merged, xref now exposes |
@tabatkins wrote:
Yes, that's one potential way it could work. The other is allowing a "mouseover" affordance so the individual doesn't even need to jump to the terminology section (but that has a11y challenges that will need to be worked through).
Yep, exactly. I think the jury is still out on the fine-tuning / end result, but the bits required are more or less there now to build the experience. |
FWIW, I've updated webdex to include the definition along with the existing data there, see e.g. https://dontcallmedom.github.io/webdex/c.html#claim%20validation%40%40vc-data-model%25%25dfn |
Excellent, looks great @dontcallmedom... and that's effectively the same sort of functionality that we'd need for building terminology sections in specs, right? I've got an action item (this weekend) to convert the Data Integrity spec over to use the new format introduced here and the interesting thing in that spec is that it has a terminology section, but we'd want to include terminology linked to in other specs (such as infra and VC data model). I expect we'd need effectively the same sort of code used in webdex to transclude those external definitions into the existing definitions in the existing terminology section. Perhaps that would be done through another CSS class like? <dl class="termlist definitions external-definitions"> ... and then some of the questions become:
|
Description of problem
The terminology include file is being processed, but restrictReferences() is failing, which results in unused terms appearing in the final document, each of which generates a warning.
URL to affected spec or repo:
https://w3c.github.io/vc-use-cases/
What happened (e.g., it crashed)?:
Expected behavior (e.g., it shouldn't crash):
Unused terms should be removed.
Optional, steps to reproduce:
See https://github.com/w3c/vc-use-cases/blob/2023-08-25-cleanup/index.html and https://github.com/w3c/vc-use-cases/blob/2023-08-25-cleanup/terms.html.
Fails under Chrome Version 116.0.5845.96 (Official Build) (x86_64) on MacBook Pro, macOS Monterey 12.6.7.
The text was updated successfully, but these errors were encountered: