XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.x
    • 2.0
    • GenericTools
    • None

    Description

      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)

      Attachments

        Activity

          People

            Unassigned Unassigned
            nbubna Nathan Bubna
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: