cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sylvain Wallez <sylv...@apache.org>
Subject Re: [Design] JXTG 2.0 (Just say yes!)
Date Fri, 03 Dec 2004 18:13:44 GMT
Stefano Mazzocchi wrote:

> Leszek Gawron wrote:
>
>> Jonas Ekstedt wrote:
>>
>>> I think the reason for taglibs are that rendering an object is often
>>> more complicated than simply outputting a value. For example, suppose
>>> you want to render a calendar covering the current month. This is a
>>> typical component that would lend itself well as a tag class. The
>>> template writer would simply do:
>>>
>>> <calendar:month current-date="${myDate}"/>
>>>
>>> The tag might output something like this:
>>>
>>> <month value="2">
>>>   <week value="12">
>>>     <day value="5" name="Monday"/>
>>>     <day value="6" name="Tuesday" current="true"/>
>>>     <day value="7" name="Wednesday"/>
>>>     ...
>>>   </week>
>>>   ...
>>> </month>
>>>
>>> Later transformations would transform it into a table or whatever. This
>>> type of calendar would be very hard to do for a template author without
>>> the help of a tag library.
>>
>>
>> I have completely no time these days so I was just waiting for the 
>> single post to say: Cannot agree more here :)
>
>
> I cannot disagree more.
>
> ${myDate as month}
>
> will do the above without mentioning tags (and will be much more 
> Dreamweaver-friendly).


Hehe, this is exactly what I outlined in my "What do we need taglibs 
for?" post. The fight is merely about tags vs brace-expansion syntax, 
but not about the underlying feature.

<snip/>

>> * wiki renderers
>>   currently I do something like to parse wiki syntax:
>>
>>> function radeoxToSAX( str, consumer ) {
>>>     var radeoxStr = radeoxEngine.render( str, radeoxContext );
>>>     var buffer = new java.lang.StringBuffer("<root>" );
>>>     buffer.append( radeoxStr )
>>>     buffer.append( "</root>" );
>>>     var is = new Packages.org.xml.sax.InputSource( new 
>>> java.io.StringReader( buffer.toString() ) );
>>>
>>>     var parser = null;
>>>     var includeConsumer = new 
>>> org.apache.cocoon.xml.IncludeXMLConsumer( consumer, consumer );
>>>     includeConsumer.setIgnoreRootElement( true );
>>>     try {           parser = cocoon.getComponent( 
>>> Packages.org.apache.excalibur.xml.sax.SAXParser.ROLE );
>>>         parser.parse( is, includeConsumer );        } finally {
>>>         if ( parser != null ) cocoon.releaseComponent( parser );
>>>     }
>>> }
>>
>>
>> <jx:macro name="radeox-string">
>>     <jx:parameter name="value"/>
>>     <jx:set var="ignored" value="${cocoon.session.radeox( value,
>>                                            cocoon.consumer )}"/>
>> </jx:macro>
>
>
> OH COME ON! you can do a generator and cinclude a subpipeline for that.


Or ${wikistring as radeox} :-)

Sylvain

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }


Mime
View raw message