You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by Scott Eade <se...@backstagetech.com.au> on 2007/05/04 05:39:42 UTC
StringTool anyone?
Is there any interest in a pull tool that provides various (admittedly
arbitrary) String related functions for use in templates?
I have one here that is pretty much a wrapper for various functions in
commons-lang - StringUtils, WordUtils, StringEscapeUtils
It currently provides:
* defaultString(String str)
* defaultString(String str, String defaultStr)
* caps(String input)
* nocaps(String input)
* escapeHtml(String str)
* escapeJava(String str)
* escapeJavaScript(String str)
* escapeJavaScriptHtml(String str)
* escapeXml(String str)
I can commit for the up coming 2.3.3 if people are interested.
Scott
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org
Re: StringTool anyone?
Posted by Scott Eade <se...@backstagetech.com.au>.
Thomas Vandahl wrote:
> Scott Eade wrote:
>
>> Is there any interest in a pull tool that provides various (admittedly
>> arbitrary) String related functions for use in templates?
>>
>
> Of course it would be desirable to have such a thing in the standard
> distribution. Especially, because probably everybody wrote something
> like this for their own purposes.
>
At the end of the day we are probably all going to have different
requirements. I just committed a small addition to turbine's
DateFormatter class, but my requirements may not be representative of
what others need.
Martin Lidgard's suggestion of Velocity Tools Generic Tools is probably
the way to go - he posted a response to someone's query on the user list
a while back that showed how easy it is to use these with Turbine:
> you need to activate each tool in the velocity-tools-generic-1.2.jar by
> adding a line in TurbineResources.properties:
>
> tool.global.numberTool = org.apache.velocity.tools.generic.NumberTool
> tool.global.escTool = org.apache.velocity.tools.generic.EscapeTool
> tool.global.renderTool = org.apache.velocity.tools.generic.RenderTool
> tool.global.sortTool = org.apache.velocity.tools.generic.SortTool
>
Seems trivial. This would provide for the escaping methods I have, but
interestingly VT GT doesn't seem to have any basic String manipulation
methods (not everything can be done in VTL). It could probably replace
DateFormatter really easily - in fact we should consider deprecating it
with this in mind.
We should probably try and add a few comments in the Pull Service
documentation on this for the pending release - I need to update the
UIManager reference to UITool anyway.
> As we are at it, would it be interesting to add formatting facilities to
> the LocalizationTool for, say, floating point numbers, currency values
> and such?
>
And Dates. It looks like VT GT DateTool does this already, and
NumberTool handles the floating point and currency values. Try as I
might though, these things sometimes still need to be done outside of
templates, which is something the l10n service handles. Also, it might
be nice if the l10n service is a one stop localization shop rather than
providing three tools.
Scott
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org
Re: StringTool anyone?
Posted by Thomas Vandahl <tv...@apache.org>.
Scott Eade wrote:
> Is there any interest in a pull tool that provides various (admittedly
> arbitrary) String related functions for use in templates?
Of course it would be desirable to have such a thing in the standard
distribution. Especially, because probably everybody wrote something
like this for their own purposes.
As we are at it, would it be interesting to add formatting facilities to
the LocalizationTool for, say, floating point numbers, currency values
and such?
Bye, Thomas.
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-dev-help@jakarta.apache.org