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

define-container, preserve and -Dvarname



	I have a <define-container> tag which can have three values for an
	attribute: first is the default, hardcoded; the second is per-page
	default, called with -D option in #!wml -Dvarname=value and the third one is the
	specified value for each call.

	I've noticed that if <preserve varname> is set, -Dvarname=value is not expanded
	where it should be, while if <preserve varname> is dropped or
	commented out, the tag behaves like I want it to.

	But, then the rest of the tags (where varname is not explicitly
	defined) have the same value for the varname as the last explicitly
	defined varname	instead of the value defined in -Dvarname=value.
	
	How to avoid that problem?

	

	Here's the (very:-)) long explanation:
	
	I have a container tag <tbl>...</tbl> which is a table with a nice
	frame in chosen color and title. Here it is:
	
<define-container tbl>
<preserve bgcolor>
<preserve title>
<set-var %attributes>
<ifeq "<get-var bgcolor>" "" <set-var bgcolor="red">>
<ifeq "<get-var title>" "" <set-var title="YOU MUST HAVE A TITLE!!">>
<table width="220" cellspacing="0" cellpadding="1" border="0" \
bgcolor="<get-var bgcolor>">
<tr>
<td>
<table width="100%" \
cellspacing="0" cellpadding="2" border="0">
<tr>
<th><get-var title></th>
</tr>
<td bgcolor="white">
%body
</td>
</tr>
</table>
</td>
</tr>
</table>
<br>
<restore bgcolor>
<restore title>
</define-container>

	So, if I write 

E.1	
<tbl bgcolor="orange" title="orange border">(body)</tbl>

	I have an orange box.

	If I write 

E.2
<tbl title="default border is red">(body)</tbl>
	
	I have a red box (no bgcolor defined->use default), which is exactly what I want.

	But, what i want to do is the possibility to define bgcolor attribute
	for that particular page, via 

#!wml -Dbgcolor=blue

	E.2 still gives the red frame.
	
	If I comment out the <preserve bgcolor> line:

E.3
#<preserve bgcolor>

	Then E.2 gives me the blue frame, just like I wanted to be in
	-Dbgcolor=blue.

	The problem appeares if I have 

E.4
#!wml -Dbgcolor=blue

..
#<preserve bgcolor>
..

<tbl title="will be rendered blue">Blue is OK</tbl>

<tbl bgcolor="orange" title"Will be rendered orange">Orange is OK</tbl>

<tbl title="should be blue">But it's still Orange!!</tbl>

	How to force the third occurence of <tbl> to be in the page-default
	color?

	And if I comment out the <restore bgcolor>

E.5
#!wml -Dbgcolor=blue
..
#<preserve bgcolor>
..
#<restore bgcolor>
..

<tbl title="will be rendered blue">Blue is OK</tbl>

<tbl bgcolor="orange" title"Will be rendered orange">Orange is OK</tbl>

<tbl title="should be blue">But it's in RED now, which is the hardcoded
default!!</tbl>

	Huh:-) Sorry for such a long post, I just wanted to explain the
	problem in as much details as possible.

	Thanks!

	Davor

-- 
      v
Davor Cengija
davor@linuxfan.com
===================================
"Please allow 30 days for delivery"
______________________________________________________________________
Website META Language (WML)                www.engelschall.com/sw/wml/
Official Support Mailing List                   sw-wml@engelschall.com
Automated List Manager                       majordomo@engelschall.com