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

Re: Why does <set-var %body> not work?

Hi Alex!

I can only try to explain why the construction with foraech doesn't work.
Probably it assigns the values to variables which have names with leading
spaces. The WML-passes with big numbers make from several space-characters
one - so you don't see the extra spaces in the output (The key is ...).

The solution could be, for instance, to insert
<subst-in-var x "^ *" "" />
<subst-in-var x " *$" "" />
just after the <foreach x array> in your construction.

Allthough, simply <set-var x /> still doesn't work. And it would be
interesting to know the reason. Probably it tries to assign an empty value to
a variable named 'key=value' that is with a name with the equal sign inside.


> BTW: Even splitting %body manually via <foreach> didn't work:
> <define-tag CONFIGURATION endtag=required>\
> <set-var array="%body">;;; Works
> <foreach x array>;;; Works
> 	Setting <get-var <attributes-quote x>>...;;; Works
> 	<set-var key=<match <get-var <attributes-quote x>> "=.*$" action=delete>>
> 	<set-var val=<match <get-var <attributes-quote x>> "^[^=]+=" action=delete>>
> 		The key is <get-var key>;;; Works
> 		The value is <get-var val>;;; Works
> 	<set-var <get-var key>=<get-var val>>;;; Works not
> 	<set-var <group <get-var key>=<get-var val>>>;;; Works not
> 	<set-var <attributes-quote <get-var key>=<get-var val>>>;;; Works not
> </foreach>
> </define-tag>

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