W3C home > Mailing lists > Public > spec-prod@w3.org > April to June 2010

Recent updates to ReSpec2

From: Gregg Kellogg <gregg@kellogg-assoc.com>
Date: Sat, 29 May 2010 20:38:56 -0400
To: Spec Prod <spec-prod@w3.org>
Message-ID: <D6F9D6FE-1590-40E0-93E4-3ADBAB9C82E4@kellogg-assoc.com>
I've checked in a couple of the features to ReSpec2 I mentioned previously:

 *   Generation of Figure Captions,
 *   References to figures, optionally using the figure number and title,
 *   A "Table of Figures",
 *   References to sections, optionally using the section number and title,
 *   Added Shane's diff tool to the save options <Shift>-<CTRL>-<ALT>-S.

I've included an excerpt from the documentation.


6.1 Section References

A references may be made to a section<http://kellogg-assoc.com/cme_spec/documentation.html#dfn-section> using a elements with an href identifying the section id. Identified references are given the class "sec-ref". If an anchor has empty content, content will be manufactured using the number and title of the section.

Consider the following example of a reference to 6.1Section References<http://kellogg-assoc.com/cme_spec/documentation.html#section-references>.

<a href='#section-references'></a>

will result in the following

<a class='sec-ref' href='#section-references'>
  <span class='secno'>6.1</span>
  <span class='sec-title'>Section References</span>

7. Figures

ReSpec<http://kellogg-assoc.com/cme_spec/documentation.html#dfn-respec> supports figures by creating captions, filling in references to figures with the figure number and title are added to anchors with empty content. It also supports the creation of a LoF. Figure support is included by adding the core/figure module to the ReSpec configuration.

7.1 Captions

Mark a Figure by giving the element a class of "figure". ReSpec will look for a relevant title and create a caption following the figure accordingly. The caption title is determined by looking for attributes in the following order:

 1.  the title attribute of the matched element
 2.  the alt attribute of the matched element, if it is an img
 3.  the first title attribute of a descendant element
 4.  the alt attribute of a descendant img

A caption is created in a p element with class "caption". If the caption does not have an id attribute, one is manufactured using logic equivalent to definition<http://kellogg-assoc.com/cme_spec/documentation.html#dfn-definition>. The element is located relative to the matched element using the following rules:

 1.  If the matched element is a div, the caption is appended to the element content.
 2.  If the matched element is an img, the element is wrapped in a div with class "figure" and the caption is added to the div
 3.  Otherwise, the caption element is inserted after the matched element

<img class="figure" href="foo.png" title="Foo"/>

1Caption Example

results in the following:

<div class="figure">
  <img class="figure" href="foo.png" title="Foo"/>
  <p class="caption"><span class="figno">1</span>Foo</p>

2Caption Result

Note that p.caption>span.figno may be styled to include contextual text such as "Figure" and trailing whitespace or punctuation.

7.2 Figure References

References to figures are made using a elements with an href identifying the figure id. Identified references are given the class "fig-ref". If an anchor has empty content, content will be manufactured using the figure number and title of the image.

Consider the following example of a reference to 1Caption Example<http://kellogg-assoc.com/cme_spec/documentation.html#fig1>.

<a href='#fig-foo'></a>

3Figure reference example

will result in the following

<a class='fig-ref' href='#fig-foo'>
  <span class='figno'>1</span>
  <span class='fig-title'>Foo</span>

4Figure reference result

7.3 Table of Figures

If a section with an id of "tof" is found, the content of the section will be replaced with a generated ToC, for example:

Table of Figures

 1.  1Caption Example<http://kellogg-assoc.com/cme_spec/documentation.html#fig1>
 2.  2Caption Result<http://kellogg-assoc.com/cme_spec/documentation.html#fig-caption-result>
 3.  3Figure reference example<http://kellogg-assoc.com/cme_spec/documentation.html#fig-figure-reference-example>
 4.  4Figure reference result<http://kellogg-assoc.com/cme_spec/documentation.html#fig-figure-reference-result>

Received on Sunday, 30 May 2010 00:40:12 UTC

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