Marcos Caceres
2017-01-30 06:05:58 UTC
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
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