Recent updates to ReSpec2

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.

Gregg

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>
</a>

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>
</div>

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>
</a>

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>

Gregg

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