Been playing around with @sidvishnoi xref implementation, and it's simply amazeballs. Some things I thought of as I was playing around - we should extend the configuration:
• xref: true //enable it, what we have today.
• or, xref: ["list", "of", "specs"] (get automatically added to <body data-cite=""> )
• or xref: "w3c" (defaults for w3c..., which would include "html, infra, url, promises-guide, webidl, dom, fetch" to
We could come up with other cool little profiles based on different communities.
Eventually, all w3c specs would get xref: w3c by default. 😍😍😍😍
@sidvishnoi If you are not working on this, I would like to work on it.
@Swapnilr1, feel free to take it. However, we are still beta testing xref... but I guess it will be fine to set up some defaults and implement the array.
@marcoscaceres A question about the plan:
xref: ["spec1", "spec2", "spec3"] would result in <body data-cite="spec1 spec2 spec3">. xref: true still applies for the rest of the document? Or restricted to just occurrences of ["spec1", "spec2", "spec3"] in the document?
About the profiles, where do we store the profile? Do we hard-code the list of specifications in w3c profile (I am most likely wrong)?
Question 1: xref true still applies, it’s not restricted to that set.
Question 2: it’s ok to hard code them into xref for now. We can figure out where to put them later.
@marcoscaceres Hmm, one more doubt, currently we use Xref as either,
Case 1: xref: true or
Case 2: xref: { url: apiURL }.
Already clarified for Case 1, but for Case 2, is the following OK:
xref: { url: apiURL } - same current implementation.
xref: { url: apiURL, specs: ["spec1", spec2"] } (add to <body data-cite="">)
xref: { url: apiURL, specs: "w3c" } (add all of the specs in the profile to <body data-cite="">)
?
Good observation. I think what should happen is, for example:
xref: [“spec”]
Becomes internally {specs: [“spec”] }
Similarly:
xref: “w3c”
Becomes internally represented as:
{ specs: hardCodedArrayOfW3CSpecs }
And so on. Users can also use the object, as a long hand solution. However, having the declarative array of string should still be supported, with the fallback being using the detailed object structure. Hope that makes sense!
@marcoscaceres OK, just to make sure I understood,
xref: true -> convert internally to xref: { }. (conf.xref evaluates to true, and that's it)xref: [“spec1”, "spec2"] -> convert internally to xref: { specs: ["spec1", spec2"] }xref: "w3c" -> convert internally to xref: { specs: ["hardcoded"," specs"]xref: { url: apiURL } - leave as is.xref: { url: apiURL, specs: ["spec1", spec2"] } - leave as is.xref: { url: apiURL, specs: "w3c" } -> convert internally to xref: { url: apiURL, specs: ["hardcoded", "specs"]}You got it. But for consistency, no matter what user gives us (true, "w3c", or [...specs]) we would like the final conf.xref to look like
{
specs: null or [...specs],
apiURL: userProvidedTestApiUrl or DEFAULT_API_URL,
}
Most helpful comment
You got it. But for consistency, no matter what user gives us (true, "w3c", or [...specs]) we would like the final
conf.xrefto look like