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

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



Hi!

Denis Barbier wrote:
> It seems fairly easy to add a new function, say <disjoin>, for doing
> this job. Will send a patch soon (i.e. within 24 hours).

Thanks to Peters suggestion here's something that works:

<define-tag CONFIGURATION endtag=required>\
<set-var array="%body">
<foreach x array>
	<subst-in-var x "^ *" "" />
	<subst-in-var x " *$" "" />
        <set-var key=<match <get-var <attributes-quote x>> 
	                    "=.*$" action=delete>>
        <set-var val=<match <get-var <attributes-quote x>> 
	                    "^[^=]+=" action=delete>>
	<attributes-quote <get-var key>=<get-var val>>
        <set-var <get-var key>=<get-var val>>
</foreach>
</define-tag>

<CONFIGURATION>
        DESTINATION="/fnord/"
        TITLE="example"
        BASE="foobar"
        SUFFIX="html"
        DESC="Example"
</CONFIGURATION>

DESTINATION=<get-var DESTINATION>
TITLE=<get-var TITLE>
BASE=<get-var BASE>
SUFFIX=<get-var SUFFIX>
DESC=<get-var DESC>

It's output looks like that:

1005/0 axel@kathrin:pts/1 12:05 [~/wml-test] > wml test.wml
        =""
        DESTINATION="/fnord/"
        TITLE="example"
        BASE="foobar"
        SUFFIX="html"
        DESC="Example"
        =""
DESTINATION="/fnord/"
TITLE="example"
BASE="foobar"
SUFFIX="html"
DESC="Example"
1006/0 axel@kathrin:pts/1 12:15 [~/wml-test] >

Just those empty pairs are still annoying... 

		Regards, Axel
-- 
Axel Beckert - abe@cs.uni-sb.de - http://abe.home.pages.de/
Student of Computer Science, University of Saarland (Germany)
Artificial Intelligence Laboratory (AI Lab), Prof. Dr. W. Wahlster;
WWW-Administrator IBFI Schloss Dagstuhl; Students Representative
______________________________________________________________________
Website META Language (WML)                www.engelschall.com/sw/wml/
Official Support Mailing List                   sw-wml@engelschall.com
Automated List Manager                       majordomo@engelschall.com