[Date Index][Thread Index]
[Date Prev][Date Next][Thread Prev][Thread Next]
Re: image sizes, extended navbar:button
- From: Denis Barbier <nospam@thanx>
- Date: Wed, 6 Mar 2002 14:12:25 +0100
On Wed, Mar 06, 2002 at 12:05:31PM +0100, Veres Ferenc wrote:
[...]
> >But you may define something like
> > <define-tag navbar:render:lang>
> > <preserve name array-langs l />
> ><set-var %attributes />
> > <set-var array-langs=<lang:list /> />
> > <foreach l array-langs>
> > <subst-in-string "<dUmMy:lang:<get-var l />>
> > <navbar:render name=<get-var name /> select=<get-var l /> nohints />
> > </dUmMy:lang:<get-var l />>" "dUmMy:" "" />
> > </foreach>
> > <restore name array-langs l />
> > </define-tag>
> >and call it with
> > <navbar:render:lang name=language nohints>
> >
> >It's tricky, I may explain it in detail if you are interested.
> >
> Fine tricks in this. I tried it, works, I read the code more times, I
> just don't understand one little thing: Why do you use this <DUMMY:
> thing, can't you simple use <<get-var l>>.
This is due to mp4h parser.
In short, mp4h looks for tag names, then expand attributes, and then
call macro with expanded attributes. Expanded text is then rescanned.
Thus after reading '<', mp4h finds that next char is not a valid
candidate for tag name and concludes that first '<' is not at beginning
of a tag, and skips it.
Note: I won't change this behaviour, think e.g. to Perl here documents:
<perl>
print <<'EOT';
blah
EOT
</perl>
Anything could happen if mp4h tries to expand <<
Moreover, wml_p5_divert did also use << in the past.
> I did not find <lang:en> in the docs, just <lang:area> and <en> but I
> think this is equal to the second one (as it works).
It is documented in wml::std::lang(1). <en> is a shortcut for <lang:en>
is 'short' attribute was passed to <lang:new>.
> But why need the dummy and search-replace thing, not simple generating
> the <en><navbar..</en> in the foreach loop?
<foreach l array-langs>
<<get-var l />>
<navbar:render name=<get-var name /> select=<get-var l /> nohints />
</<get-var l />>
</foreach>
indeed expands to
<en>[expansion of <navbar..>]</en>
<hu>[expansion of <navbar..>]</hu>
...
But this text must be processed twice to give expected result, first
pass only shows lines above.
The search-replace trick ensure that this text is processed twice, one
as argument of <subst-in-string>, and another one when <subst-in-string>
expanded text is rescanned.
In your case, your solution could work, but I use to write this
<subst-in-string> trick since it works well with all situations.
--
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