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

Re: [wml] Nested tags

Your second approach works if you don't preserve/restore the variable
inside the macro, but use a "global" variable:

<define-container UL whitespace=delete>
<set-var IN_UL=1>
<table cellpadding=3 cellspacing=0 border=0>
<set-var IN_UL=0>
</define-container UL>

<define-container LI whitespace=delete>
<ifeq <get-var IN_UL> 1
      <td valign=top>
       <IMG ALIGN=top ALT="" src="$(ROOT)/.pics/3d-ball.gif">
</define-container LI>

This way you can use <LI> within <UL></UL> with this special meaning
and within <OL></OL> with its "normal" meaning.

Of course, for <UL> this should deal with nesting which it doesn't
right now. But it could be easily extended by incrementing IN_UL for
each <UL> and decrementing for each </UL>.

Although <OL></OL> inside <UL></UL> still would break (you'd need a
IN_OL variable to deal with this I guess).


On Mon, 10 Apr 2000, Xose Manoel Ramos wrote:

> I wonder if there is a simple way to define nested tags (i.e. tags
> that have a special meaning inside another tags). 
> Something like:
> <macro>
>   <title>Just the master</title>
>   <content>
>    This is the content
>   </content>
> </macro>  
> I mean, this tags should have only this meaning when used inside the
> <macro> tag, and otherwise have their normal meaning.
> I worked out a system using 'perl' & 'redirectors'. Later I have
> looked at 'grid.wml' and I discovered Ralph has used the same
> approach as me.
> I just wonder if somebody has thought of a better, and simpler method
> to do this. I thought of something like:
> <define-container macro>
>  <preserve __inside>
>  <set-var __inside="macro">
>  %body
>  <restore __inside>
> </define-container>
> <define-container title>
>   <when <eq <get-var __inside> macro>>
>   (...something...)
>   </when>
> </define>
> But this does not work as I should have expected.

Dr. Fritz Zaucker, Head IT Support Group
Department of Electrical Engineering,  Federal Institute of Technology
ETZ J97, Gloriastrasse 35, 8092 Zurich, Switzerland
Tel.: +41-1-632-5241 Fax: +41-1-632-1194 http://ee-staff.ethz.ch/~zaucker/
E-mail: zaucker@ee.ethz.ch (see home page for PGP key)

Website META Language (WML)                www.engelschall.com/sw/wml/
Official Support Mailing List                   sw-wml@engelschall.com
Automated List Manager                       majordomo@engelschall.com