Pages: 1
Print
Author Topic: Mapping Bold, Italic, and Underline toolbar buttons to attributes  (Read 981 times)
Su-Laine Yeo
Solutions Consultant
Member

Posts: 260


« on: February 04, 2010, 06:52:08 PM »

You can configure XMetaL to map the B, I, and U (Bold, Italic, and Underline) toolbar buttons to particular elements, by editing the .CTM file for your customization. For example, the following code in the .CTM file says that <b> is the element type for bold, <i> for italic, and <u> for underline:

Code:
<TogglingInlines>
    <Bold>
      <Name ns="">b</Name>
    </Bold>
    <Italic>
      <Name ns="">i</Name>
    </Italic>
    <Underline>
      <Name ns="">u</Name>
    </Underline>
  </TogglingInlines>

In some schemas, formatting is expressed as attributes rather than as elements. For example, bold may be expressed as <emphasis style="bold">, italic as  <emphasis style="italic">, and underline as  <emphasis style="underline">.

If your schema does this, you can still use the B, I, and U toolbar buttons to insert the appropriate markup, however it cannot be done through the .CTM file, and it requires scripting. 

XMetaL Author 6.0 has an example of such a script for DocBook documents. To see it, click Help > Samples > Anatomy and Physiology (Docbook) and use the B, I, and U toolbar buttons there. The code behind it is in the docbookxi.js file and the  docbookxi.mcr file in C:\Program Files\XMetaL 6.0\Author\Rules\DocBook\5.0xi. You are free to copy this code for any other customization in XMetaL.
« Last Edit: February 04, 2010, 08:02:50 PM by Su-Laine Yeo » Logged

Su-Laine Yeo
Solutions Consultant
JustSystems Canada, Inc.
Pages: 1
Print
Jump to: