On 11/22/2011 11:53 PM, Guenter Milde wrote:
> On 2011-11-22, Bob Plantz wrote:
>> I wish to create both epub and pdf (for printing) versions of my book
>> from the same rst source. I create html for the epub and latex for the
>> pdf. The formats of the figures (vector graphics) need to be different
>> for each: svg for html; eps for latex.
>> I have created the source:
>> .. figure:: book_figs/decoderRing
>> :align: center
>> :class: latex
>> .. figure:: book_figs/decoderRing.svg
>> :align: center
>> :class: epub
>> When I use rst2html.py --strip-elements-with-class=latex to get html I get:
> ...
>> <div class="figure align-center">
>> </div>
> ...
>
>> In both cases I have to remove the "null" figures for each file.
>> This is acceptable; I will have to do other tweaking anyway. But if
>> there's a better way to achieve this "if-else" construct, I would like
>> to learn it.
> You choose a difficult element to start with. The "figure" directive passes
> most arguments to the included image object. Use
>
> figclass : text
> Set a "classes" attribute value on the figure element.
>
> See the "directives" doc at
> docutils/docs/ref/rst/directives.html#figure
>
> Günter
>
Thank you. I should have read the docs more carefully. Using the
following works quite well:
.. figure:: book_figs/decoderRing
:align: center
:figclass: latex
.. figure:: book_figs/decoderRing.svg
:align: center
:figclass: epub
--Bob
|