|
|
There are 2 different macro types at
Leo<HTML>
. Soft and hard
macros. Both macros are simple text substitutions. The different
is the calling sheme. Soft macros are called explicitely. Hard macros
are more dangerous but more puwerful too.
| |
|
Hard Macro Tag Definition:
<macro
|
| | | | (type: simple_tag) |
|
name="foobar" |
|
|
|
(info: name of the macro) |
|
text="bla bla bla bla" |
|
|
|
(info: substitution text) |
|
hard |
|
|
|
(info: macro is a hard macro) |
> |
|
The name of the macro is the text that should be substituted by the text
that is definied at the text option. To define a hard macro, the
macro has to be marked as such a macro type by setting the hard option.
Example:
<macro name="foobar" text="The Foo Bar" hard>
|
If the compiler finds now the text "foobar" it will be substituated by "The Foo Bar".
Example:
// before substituation
The quick brown fox jumps over the foobar.
// after subtitution
The quick brown fox jumps over the The Foo Bar.
|
But be careful with hard macros if you try to substitute "foobar" by "The foobar Foo"
Leo<HTML>
will hang in an endles loop. Later i'll explain you an other technic
which will allow this.
| |
|
Soft Macro Definition:
<macro
|
| | | | (type: simple_tag) |
|
name="foobar" |
|
|
|
(info: name of the macro) |
|
text="bla bla bla bla" |
|
|
|
(info: substitution text) |
|
soft |
(optional) |
|
|
(info: macro is a soft macro) |
> |
|
The declaration of a soft macro is very equal to a hard macros definition.
But a softmacro is marked with the soft Option. If weather the soft
or hard option is set the macro will be a soft macro.
Soft Macro Call Definition:
<macro
|
| | | | (type: simple_tag) |
|
macro_name |
|
|
|
(info: name of the macro) |
|
PARAMETER_X |
(optional) |
|
|
(info: kind of parameter) |
> |
|
Example:
<macro name="foobar" text="The Foo Bar">
|
But the soft macro has to be called this way:
Example:
// before substituation
The quick brown fox jumps over the
<macro foobar>
// after subtitution
The quick brown fox jumps over the The Foo Bar.
|
It's really simple. Such a macro is not very flexible.
But there is the PARAMETER_X option that makes the stuff
a little bit simplier:
Example:
// definition
<macro name="foobar" text="The PARAMETER_1 Foo PARAMETER_2">
// call it
The quick brown fox jumps over the <macro foobar PARAMETER_1="real" PARAMETER_2="Bar">.
// Result
The quick brown fox jumps over the The real Foo Bar .
|
Macros are a very simple tool. Simple, but often usefule. If you wan't more flexibility
you'll have to use Own Tags.
|
|
|
This page was created by
King Leo
. Page generator was
Leo<HTML>
version
0.99.0
.
|