MarkupTool
----------

                 Key: VELTOOLS-97
                 URL: https://issues.apache.org/jira/browse/VELTOOLS-97
             Project: Velocity Tools
          Issue Type: New Feature
          Components: GenericTools
    Affects Versions: 2.x
            Reporter: Nathan Bubna
            Priority: Minor
             Fix For: 2.x


As i grow continually more fond of tools and less fond of macros (though things 
are finally starting to look up for macros in 1.6 and the possibility of Raghu 
implementing blockmacros), i find myself starting to wish for tools that aid 
with markup (mostly html or xml).  The idea has occurred to me that i might 
find a general MarkupTool for manipulating markup in flexible, repeatable ways. 
  The API i have in mind might be used something like this:

#set( $foo = $markup.foo.attr('bar', 0) )
$foo
#if( $foo.bar == 0 )
$foo.body($text.danger).attr({'black' : 'white', 'zebras' : $crossing})
#end

which would output

<foo bar="0"/>
<foo bar="0" black="white" zebras="crossing">Danger!</foo>

It's also not hard to imagine ways to allow default attributes/values for 
various tags in the configuration for the tool, like 

<tool class="org.apache.velocity.tools.generic.MarkupTool" 
img="border:0,class:thumb"/>

So that doing just

$markup.img.attr('src',$imglink)

would produce something like

<img border="0" class="thumb" src="http://foo.com/bar.jpg"/>

Granted, i don't have that many situations where this would be useful, but 
there have been a few.  Also, i wonder if it might serve as a base class for a 
JSPTaglibTool (see  
http://velocity.markmail.org/search/?q=jsp+tag#query:jsp%20tag%20from%3A%22Nathan%20Bubna%22+page:2+mid:ebotko7hanut3uhx+state:results
 for more on this)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to