[Date Index][Thread Index]
[Date Prev][Date Next][Thread Prev][Thread Next]

Re: define tag with optional parameter

On Wed, Dec 09, 1998, Axel Koehler wrote:

> I need a tag definition with an optional parameter.
> The tag should give  an alternate  result in the case
> that the parameter exist. 
> I mean a structure like:
> <define-tag side_begin>
> If exist (parameter) 
>   do blabla blub
> else 
>   do something completly different
> end
> </define-tag>

What is "parameter" for you? A positional parameter in the attribut line (e.g.
the second argument in the call "<side_begin A B C>") or a named parameter
(e.g.  the B in the call "<side_begin B=test>")?

The first can be done this way with Meta-HTML:

| <define-tag side_begin>
| <ifeq "%2" "" <prog
|    do something completly different
| > <prog
|    do blabla blub
| >>
| </define-tag>

The second can be done this way:

| <define-tag side_begin>
| <preserve A>
| <preserve B>
| <preserve C>
| <set-var %attributes>
| <ifeq "<get-var B>" "" <prog
|    do something completly different
| > <prog
|    do blabla blub
| >>
| <restore C>
| <restore B>
| <restore A>
| </define-tag>

Is this what you want?
                                       Ralf S. Engelschall
Website META Language (WML)                www.engelschall.com/sw/wml/
Official Support Mailing List                   sw-wml@engelschall.com
Automated List Manager                       majordomo@engelschall.com