DocBook has no ``bold tag'' but it is customary to use the emphasis
element with attribute role
equals to bold
. The following macro automates this:
<command name="convertToBold"> <macro repeatable="true" undoable="true" label="Convert to Bold"> <sequence> <command name="convert" parameter="[implicitElement] emphasis" /> <command name="putAttribute" parameter="role bold" /> </sequence> </macro> </command>
Using a sequence element:
The macro converts anything convertible to an emphasis
element (generally text selection, but not only text selection) to an emphasis
element.
If step #1 is successful, the macro adds attribute role
with value bold
to the newly created emphasis
element.
Note that if the first step of a sequence cannot be executed (this is tested before attempting to actually execute the sequence construct), the whole sequence construct cannot be executed.
Step #2 works without an "[implicitElement]
" parameter for command putAttribute because the newly created emphasis
element has been automatically selected by the convert command of step #1.
This is often the case. A quick way to learn this is to first perform interactively what needs to be automated by the macro.