W3C home > Mailing lists > Public > spec-prod@w3.org > January to March 2017

[ReSpec] Powerful new cross reference feature

From: Marcos Caceres <marcos@marcosc.com>
Date: Sun, 29 Jan 2017 22:05:58 -0800
Message-ID: <CAAci2aDNYiEN+AQ6hq2JD5CmgYrZSGgyTHA=KC2VQr8p1_Tuww@mail.gmail.com>
To: spec-prod <spec-prod@w3.org>
Hi ReSpec users,
Just wanted to bring your attention to a new powerful feature. You can
now use "data-cite" attributes on `dfn` elements to have automatic
cross-references in specs.

This is extremely useful, because it means you only need to define
terms or links to WebIDL interfaces once - and those terms will then
be linked to the right spec wherever a term is used.

Furthermore, if you wrap `<code>` outside a definition, all links will
automatically get converted to `<code>` and linked to the right
external spec!

For example, here we link to "fire an event" from the DOM spec, and to
the `Window` interface in HTML:

```HTML
<p>
... then <a>fire an event</a> named "whatever" at the <a>Window</a> object.
</p>

<section>
  <h2>Dependencies</h2>
  <p>The following are defined in [[!DOM]]:
  <ul>
     <li><dfn data-cite="!DOM#fire-an-event">fire and event</dfn>.
  </ul>

  <p>The following are defined in [[!HTML]]:
  <ul>
     <!-- WRAPPING THE DEFINITION IN CODE, AUTOMATICALLY MAKES IT CODE
ELSEWHERE -->
     <li><code><dfn data-cite="!HTML#Window">fire and event</dfn></code>.
  </ul>
</section>
```

With the above, you just need to know the spec and the fragment
identifier for the term - ReSpec will do the rest. The cited spec is
also added to the references, of course.

If you'd like to see a spec that's already making use of this, check out:
https://w3c.github.io/browser-payment-api/

Again, let me know of any issues.

Kind regards,
Marcos
Received on Monday, 30 January 2017 06:07:09 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:55:22 UTC