Home Miscellaneous Split documents Defined macros
 The guide of UDO
 The syntax of UDO
 Miscellaneous

Macros

Macros are userdefined placeholders that you can use for different purposes.

When using the !macro command you tell UDO the name of the macro in first place. The name of the macro is followed by its contents which may be empty, too.

Let me show you some examples:

!macro HTML Hypertext Markup Language
!macro UDO  (!B)U(!b)niversal (!B)Do(!b)cument
!macro DOSG (!T)UDO6GDOS.LZH(!t)
!ifdest [html]
  !macro PICPATH gif/
!else
  !macro PICPATH img/
!endif
[...]
The (!HTML) ...
The (!UDO) Format ...
The archive named (!DOSG) ...
!image (!PICPATH)/tiger

Macros can help you to save time when typing often used long words. Furthermore macros can help you to change the contents of your file by simply changing the contents for macros (e.g. if your program name changed and you use a macro for the name of your program). Another example is the usage of standardized text (e.g. a standard disclaimer) where you use macros instead of the name of the program etc. These standardized texts can be included with !include. In the following example a disclaimer is included and the name of the program is defined by a macro:

[doku.u]
!macro PRG Windows95
[disclaim.u]
(!PRG) is provided ""as is"" without a
warranty of any kind.
Use it on your own risk.

Since UDO Release 6 you can call macros with parameters. You can set the position of the parameters in the !macro command by inserting `(!1)', `(!2)' till `(!9)'. To call a macro with parameters you have to write brackets (`[...]') around them.

The following small example shows how to use a macro for text that shall be printed in bold-italic style:

!macro BI (!B)(!1)(!b)
...
This text is printed (!BI [bold and italic]).

The "(!1)" in the macro line will be replaced by the words "bold and italic".


Please note:

  1. When naming the macros you should be cautious not to use pre-defined UDO command names like "B" or "nl". If you don't you will get problems with bold text ((!B)) or the newline command ((!nl)).
     
  2. You shouldn't use too many macros because every additional macro slows down the conversion of the source file. The maximum number of macro is 1000.
     


Copyright © www.udo-open-source.org
Last updated on November 5, 2006

Home Miscellaneous Split documents Defined macros