Various respec enhancements ...

I thought this audience might be interested in some changes I've made to respec. I forked the respec repository a while back to create a flavor that would work for PCISIG Specifications (PCI Express hardware specs).

My version has diverged quite a bit from Robin's version so I haven't created pull requests, but there are a few features I thought might be interesting to make folks aware of:


1.       Register pictures - PCISIG specs are chock full of diagrams of hardware registers. These were being drawn by hand in Illustrator. I added code to respec to automatically draw these figures using a JSON representation and to optionally create that JSON representation from an HTML table elsewhere in the document. For instructions, see http://sglaser.github.io/regpict

2.       Lots of <dfn> classes. I wanted to be able to have a bunch of <dfn> types that were formatted differently by CSS. If you include <dfn class="field">foo</dfn>, then any <a>foo</a> fields will automatically get the right class (assuming no ambiguity - if it's ambiguous, you get a message and have to put the class attribute on the <a> tag).

3.       Automatic subscripts in <dfn>. I remember the innerHTML for each <dfn> and copy it to the <a>. That way if you have <dfn>T<sub>active</sub></dfn> and you reference it as <a>Tactive</a>, you get the <sub> stuff in the expansion.

4.       Enhanced figure numbering. PCISIG figures are numbered within a chapter. If you set the config property "figFmt", you can alter how they are named and numbered.

5.       Table numbering. Per chapter, like figure numbering but using "tblFmt".

6.       Table of Tables. Like Table of Figures. If you have <section id="tot">, you get one.

7.       Expanded references. If you reference a section, figure, etc. The generated HTML includes the figure/section/table number and the figure/section/table caption. You can use css to hide what you don't want. This way, print media can have "See Figure 4-2" without having to work hard.

8.       Dump <dfn> table. If you set the addDefinitionMap config propter to true, you get a table at the end of your document with every <dfn> in the document.

9.       Dump section, figure and table names. If you set the addXrefMap config property to true, you get a table at the end of your document with the caption and id values for every section, figure, and table in the document.

My fork of respec is http://github.com/sglaser/respec. I've pulled Robin's latest changes in, but as I said earlier, I haven't submitted any pull requests.

An example that uses most of the features above is http://sglaser.github.io/respec/examples/xxx.html (with JavaScript) and http://sglaser.github.io/respec/examples/xxx-snap.html (no JavaScript -- respec snapshot output)..

Feel free to copy / reuse whatever you find interesting / useful. Same license as respec.

Steve Glaser



-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain
confidential information.  Any unauthorized review, use, disclosure or distribution
is prohibited.  If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------

Received on Monday, 25 August 2014 09:29:02 UTC