Next / Previous / Contents / TCC Help System / NM Tech homepage

6.1. Templates for block elements

For example, in a DocBook document, a procedure has this structure:

      <procedure>
        <step>
          <para>
            First step....
          </para>
        </step>
        <step>
          <para>
            Second step....
          </para>
        </step>
        ...
      </procedure>

If you are going to be writing a lot of DocBook procedures, it saves time to have two small template files lying around that you can insert into your document. The first—call it proc—contains the skeleton of a procedure with one step:

      <procedure>
        <step>
          <para>

          </para>
        </step>
      </procedure>

In this skeleton, the line inside the para element is empty, so you can fill in the text of the step.

The second template file contains just the skeleton of a step. Let's call this file step:

        <step>
          <para>

          </para>
        </step>

So the workflow for writing a procedure becomes:

  1. Insert a copy of the proc file.

  2. Fill in the text of the first step.

  3. For each additional step, insert a copy of the step file, and fill in its text.

If you are finicky about maintaining proper indentation, and the template file isn't indented correctly for your current context, that's easy to fix. Just after inserting the template, issue the command indent-region (M-C-\). In nxml-mode, this command re-indents all the lines in the region; since the region is set to the inserted portion just after using insert-file, only the text just inserted will be re-indented.