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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to