forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thorsten Scherler <thors...@apache.org>
Subject forrest:hooks configurations examples (was [Views] <div id="titi"/> strange behaviour)
Date Tue, 26 Jul 2005 21:38:03 GMT
Hello devs,

I just extended the behavior of forrest:hooks. Here are some example how
you can easily change the output of forrest:hooks.

The default behavior is not changed.

> * If a template embedded by a hook is empty - this is my case for
>       sub-tabs, the generated hook is :
>           o <div name="tabsLevel2" />

<forrest:hook name="testIdDiv"/>
*or*
<forrest:hook name="testIdDiv" type="div"/>
will be transformed into 
<div name="testIdDiv" />

The same is true for @class attribute for forrest:hooks.
<forrest:hook class="testClassDiv"/>
*or*
<forrest:hook class="testClassDiv" type="div"/>
will be transformed into 
<div class="testClassDiv" />

Another feature is that you can as well output span elements for
forrest:hooks instead of div elements.
<forrest:hook name="testId" type="span"/>
will be transformed into 
<span id="testId" />

Alternative to enable:
> So I'm not blocked, but can we change the hook generation in order 
> to generate :
> 
>     * <div name="tabsLevel2"></div>
> 
>     Rather than :
> 
>     * <div name="tabsLevel2" />
> 
>     If a template does not generate anything...

You can use the @nbsp='true' attribute to enable this behaviour:
<forrest:hook name="testIdDiv" nbsp="true"/>
will be transformed into (with a &#160; aka &nbsp;)
<div id="testIdDiv"> </div>

Here is a small summary example:
<forrest:hook class="testClass" type="span" nbsp="true"/>
<forrest:hook name="testId" type="span"/>
<forrest:hook class="testClassDiv" />
<forrest:hook name="testIdDiv" type="div" nbsp="true"/>

will be transformed to:

<span class="testClass"> </span>
<span id="testId" />
<div class="testClassDiv" />
<div id="testIdDiv"> </div>

Thanks for reporting/requesting the &nbsp; bug/feature, Cyriaque. That reminded me about
the @type='span' on my todos. ;-)

HTH 

salu2
-- 
thorsten

"Together we stand, divided we fall!" 
Hey you (Pink Floyd)


Mime
View raw message