Next / Previous / Contents / Shipman's homepage

6.2. Templates for inline elements

Inline elements can also benefit from the template technique.

Another example of a frequently used element in DocBook is the code element, used to indicate text that is typed by the user. Here is a template file, named us, for this element:

<code >
</code >

The workflow for marking up a bit of text as user input goes like this:

  1. Insert the us template file.

  2. Move to the end of the start tag (with C-e) and type the text to be marked up.

  3. Use C-d to delete the newline so that the end tag abuts the end of the marked-up text.

Note the extra spaces before the closing “>” of the tags in the template. Because XML allows whitespace before the closing “>” of a tag, this furnishes more places where long lines can be broken by the fill-paragraph (M-q) command, or the action of auto-fill-mode.