Tutorial‎ > ‎


Using entities and macros defined in config file

Macros are useful in handling repeated elements. For example, on this page you may see many strings in monospaced font which is produced by HTML <code> tags. Instead of typing endless <code></code> sequences we may define a macro named c, which permits us now to type &c{...}; when we want a <code>...</code> construction in our HTML document. The last definition in our config.xml file stands for this macro:

  <macro name="c" params="1">

Here $1 indicates where the first parameter is inserted. You may have up to 9 parameters by providing the number in params argument of a macro tag. If there are more than 1 parameter use the following syntax to call the macro: &macro_name{param1}{param2}{param3};.

Macros without parameters are called entities. They should also be defined in config.xml file with the line of the following type:

  <entity name="entity_name">entity description</entity>

... and invoked by placing &entity_name; in source or section files where we want to display entity description.

If macros and/or entities are too complex to include in config file then their content may be moved to the external file. More on macros and entities: Config file tags in Commands Reference.

Now the final phase: assembling the site.