velocity-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christoph Reck (JIRA)" <j...@apache.org>
Subject [jira] Updated: (VELOCITY-441) Provide class to be called from command-line to translate any file with special suffix.
Date Mon, 29 May 2006 07:50:30 GMT
     [ http://issues.apache.org/jira/browse/VELOCITY-441?page=all ]

Christoph Reck updated VELOCITY-441:
------------------------------------

    Attachment: Transformer.java

find attached a tool using anakia for transformations. It may also take CSV or just run a
plain VTL file against the context.

It may use a CSV tool, Anakia, DOM reader and/or a XmlConfiguration reader.
The setup of these tools should be replaced by the VelocityToolbox manager (Nathan there was
a thread on this...). Use examples:
#set( $now = $date.clone() )
#set( $LF = $Context.formDecode("%0A") )
#set( $Integer = 1 )
#set( $Long = $Integer.longValue() )
#set( $cdLimit = $Long.valueOf("640000000") )

I also used a ClassTool to setup e.g. a FileWriter:
## ------------------------------------------------------------------------
## Macro to write a text to a file.
## ------------------------------------------------------------------------
#macro( fileWrite $filename $text )
  #set( $out = $Class.newInstance("java.io.FileOutputStream", $filename) )
  #set( $data = $text.getBytes() )
  #call( $out.write($data) )
  #call( $out.close() )
#end

It would also be sensible to add a command line parameter to define the VelociMacro file
to load at startup (maybe via ToolboxManager?).

Cheers,
Christoph


> Provide class to be called from command-line to translate any file with special suffix.
> ---------------------------------------------------------------------------------------
>
>          Key: VELOCITY-441
>          URL: http://issues.apache.org/jira/browse/VELOCITY-441
>      Project: Velocity
>         Type: Improvement

>   Components: Build
>     Versions: 1.4
>  Environment: WindowsXP
>     Reporter: Colbert Philippe
>  Attachments: Transformer.java
>
> This is a simple but important feature to have.   To standadize the use of Velocity,
provide a class that can be called from the command-line that will do the translation from
*.vm ---> final-file.   The class will look for any file that has one of the special suffixes
(specified by as parameters) and will translate it.
> The name convention for the translation would like this that:
> someFileName.velocity ---> someFileName
> someFileName.vm ---> someFileName
> Example:
> myFile.html.velocity ---> myFile.html
> The user would specify the list of suffixes as parameter in Java (like String[] suffixes
= { ".velocity", ".vm" }.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org


Mime
View raw message