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

Re: Combining wml::des:navbar with per-button HTML code



On Fri, 21 Jan 2000, Stephane Bortzmeyer wrote:

[...]
> But I have a problem using it in a new tag. I want to declare:
> 
> <define-tag my_button>
> 
> and to have a 'local' attribute which, if true, will call '<navbar:prolog 
> pos=next>' to generate the ePerl code.
> 
> But, when, in the definition of my_button, I call:
> 
> <preserve id>
> <preserve txt>
> <preserve url>
> <preserve local>
> <preserve remote>
> <set-var %attributes>
> # In the future, test for local will be added here
> <navbar:button id=<get-var id> txt=<get-var txt> url=<get-var url>>
> 
> It is expansed only in:
> 
> <B><font color="#FFFFFF"></font></B><BR><BR>
> 
> No URL and no text. (<B> and <BR> are in my prolog/epilog.)

Bad luck, Tobias Oetiker asked a similar question 2 days ago :-)
Anyway, here is an alternative i forgot to mention in the previous
reply:

#  ---------- beginning of working example
#use wml::std::tags

<define-tag link1>
  <preserve title>
  <set-var %attributes>
  Var title=<get-var title>
  <restore title>
</define-tag>

<define-tag project>
  <link1 %attributes>
</define-tag>

<project title="Perpetuum Mobile">
#  ---------- end of example

With your example, this expands to

<define-tag my_button>
<preserve id>
<preserve txt>
<preserve url>
<preserve local>
<preserve remote>
<set-var local=*>
<set-var %attributes>
<ifneq <get-var local> "*"
  <prog
    <navbar:prolog pos=next>...</navbar:prolog>
  >
>
#  you do not have to worry passing unknown arguments (like `local')
#  they are silenty ignored
<navbar:button pos=next %attributes>
...

-- 
Denis Barbier
WML Maintainer




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