Login | Register
My pages Projects Community openCollabNet

A.1.  Conditions, and how they are used

[ fromfile: grammar.xml id: conditions ]

Any element can have a condition (sometimes shortened to just a c) attribute. For example:


<pb>
<li> This shows up in in all versions. </li>
<li condition="slides"> This is in the slides </li>
<li c="textbook"> This is a much longer sentence for the textbook. </li>
</pb>

To process a document, you can select multiple conditional values as separate -c options, or as strings separated by commas (no spaces) after a single -c.

     $ python xml2docbook.py -c remark -c slides,html
     $ python xml2docbook.py -c all
  

The first executes the script with conditions remark, slides, and html switched on, and all other conditons switched off. The second example switches "all" conditions on.

Condition attributes are used in a variety of ways. You can define new conditions to suit your particular document through the use of plugins (see Section 2.2) and decide which ones to switch on or off by customizing the ant build scripts. Only some of them have special meaning inside the python scripts, and those meanings are listed here.

Currently used Conditions

html

For HTML output

pdf

pdf output

ps

ps output - converts as needed, all png images to eps and substitutes the extensions of all <img> src attributes.

fromfile

displays the red "fromfile" information at the top of each page.

slides

renders all <pb> tags as <itemizedlist>

textbook

renders all <pb> tags as <para>, and ignores the enclosed <li> tags.

remark

output in red/italic

todo

like remark

solution

solutions guide

instructor

instructor's notes