You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Rodrigo Reyes <ro...@instaservi.com> on 2003/08/13 17:46:20 UTC

Character precision...

Hi all
    I have been using Velocity quite a while. It is great for generating
HTML, where extra spaces are no problem. Still, now I have to generate some
reports which need have "character precision". Has someone done that with
Velocity? Maybe with some other tool? Thanx...

Rodrigo



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


Re: Character precision...

Posted by Rodrigo Reyes <ro...@instaservi.com>.
Thanx Dave... I will give this a try...

Rodrigo

----- Original Message ----- 
From: "Dave Newton" <da...@solaraccess.com>
To: "Velocity Users List" <ve...@jakarta.apache.org>
Sent: Wednesday, August 13, 2003 11:52 AM
Subject: Re: Character precision...


> On Wed, 2003-08-13 at 12:15, Rodrigo Reyes wrote:
> > Mmmm... Interesting... Please, give me an example...
> > > Liberal sprinklings of the ## (double comment character) really spruce
> > > things up a bit. I generate text emails with velocity all the time; as
> > > long as I ## lots of places I'm ok.
>
> Here's an example of the top of one of my really old template files. The
> interesting bit for you may be the trailing ## so that the output of the
> macro doesn't get a newline.
>
> Hope this helps!
>
> Dave
>
> ##--------------------------------------------------------------------
> ## Macros and misc
> ##--------------------------------------------------------------------
> #macro(cdval $cd)
> #if (${cd.quote})
> #if(${cd.sqlified})
> "'" + StringUtils.sqlify(${cd.name.lower()}) + "'"##
> #else
> "'" + ${cd.name.lower()} + "'"##
> #end
> #else
> ${cd.name.lower()}##
> #end
> #end
> ##
> ##
> #macro(tscast $col)
> #if (${col.isdate})
> (FigTimestamp) ##
> #end
> #end
> ##
> ##--------------------------------------------------------------------
> ## Header stuff
> ##--------------------------------------------------------------------
> ##
> package ${beaninfo.packagename};
>
> import java.sql.*;
>
> import com.solaraccess.util.StringUtils;
> import com.solaraccess.util.SolarException;
> #if (${beaninfo.havetimestamp})
> import com.solaraccess.util.FigTimestamp;
> #end
>
> /**
>  * ${beaninfo.tablename} row bean
>  */
>
> public class ${classname} extends DBRow {
>
> [... snip ...]
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org



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


Re: Character precision...

Posted by Rodrigo Reyes <ro...@instaservi.com>.
Thanx Dave... I will give this a try...

Rodrigo

----- Original Message ----- 
From: "Dave Newton" <da...@solaraccess.com>
To: "Velocity Users List" <ve...@jakarta.apache.org>
Sent: Wednesday, August 13, 2003 11:52 AM
Subject: Re: Character precision...


> On Wed, 2003-08-13 at 12:15, Rodrigo Reyes wrote:
> > Mmmm... Interesting... Please, give me an example...
> > > Liberal sprinklings of the ## (double comment character) really spruce
> > > things up a bit. I generate text emails with velocity all the time; as
> > > long as I ## lots of places I'm ok.
>
> Here's an example of the top of one of my really old template files. The
> interesting bit for you may be the trailing ## so that the output of the
> macro doesn't get a newline.
>
> Hope this helps!
>
> Dave
>
> ##--------------------------------------------------------------------
> ## Macros and misc
> ##--------------------------------------------------------------------
> #macro(cdval $cd)
> #if (${cd.quote})
> #if(${cd.sqlified})
> "'" + StringUtils.sqlify(${cd.name.lower()}) + "'"##
> #else
> "'" + ${cd.name.lower()} + "'"##
> #end
> #else
> ${cd.name.lower()}##
> #end
> #end
> ##
> ##
> #macro(tscast $col)
> #if (${col.isdate})
> (FigTimestamp) ##
> #end
> #end
> ##
> ##--------------------------------------------------------------------
> ## Header stuff
> ##--------------------------------------------------------------------
> ##
> package ${beaninfo.packagename};
>
> import java.sql.*;
>
> import com.solaraccess.util.StringUtils;
> import com.solaraccess.util.SolarException;
> #if (${beaninfo.havetimestamp})
> import com.solaraccess.util.FigTimestamp;
> #end
>
> /**
>  * ${beaninfo.tablename} row bean
>  */
>
> public class ${classname} extends DBRow {
>
> [... snip ...]
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org



Re: Character precision...

Posted by "Geir Magnusson Jr." <ge...@adeptra.com>.
On Wednesday, August 13, 2003, at 12:52 PM, Dave Newton wrote:

> On Wed, 2003-08-13 at 12:15, Rodrigo Reyes wrote:
>> Mmmm... Interesting... Please, give me an example...
>>> Liberal sprinklings of the ## (double comment character) really 
>>> spruce
>>> things up a bit. I generate text emails with velocity all the time; 
>>> as
>>> long as I ## lots of places I'm ok.
>
> Here's an example of the top of one of my really old template files. 
> The
> interesting bit for you may be the trailing ## so that the output of 
> the
> macro doesn't get a newline.
>
> Hope this helps!

I think that this is brilliant.  I never thought of this. I tend to be 
a stick in the mud on the whole subject of "pretty templates vs pretty 
output" as I tend to think of the debate.  We should add a hint section 
to the UG or put a FAQ section...

-- 
Geir Magnusson Jr                                   203-956-2604(w)
Adeptra, Inc.                                       203-434-2093(m)
geirm@adeptra.com                                   203-247-1713(m)


Re: Character precision...

Posted by Dave Newton <da...@solaraccess.com>.
On Wed, 2003-08-13 at 12:15, Rodrigo Reyes wrote:
> Mmmm... Interesting... Please, give me an example...
> > Liberal sprinklings of the ## (double comment character) really spruce
> > things up a bit. I generate text emails with velocity all the time; as
> > long as I ## lots of places I'm ok.

Here's an example of the top of one of my really old template files. The
interesting bit for you may be the trailing ## so that the output of the
macro doesn't get a newline.

Hope this helps!

Dave

##--------------------------------------------------------------------
## Macros and misc
##--------------------------------------------------------------------
#macro(cdval $cd)
#if (${cd.quote})
#if(${cd.sqlified})
"'" + StringUtils.sqlify(${cd.name.lower()}) + "'"##
#else
"'" + ${cd.name.lower()} + "'"##
#end
#else
${cd.name.lower()}##
#end
#end
##
##
#macro(tscast $col)
#if (${col.isdate})
(FigTimestamp) ##
#end
#end
##
##--------------------------------------------------------------------
## Header stuff
##--------------------------------------------------------------------
##
package ${beaninfo.packagename};

import java.sql.*;

import com.solaraccess.util.StringUtils;
import com.solaraccess.util.SolarException;
#if (${beaninfo.havetimestamp})
import com.solaraccess.util.FigTimestamp;
#end

/**
 * ${beaninfo.tablename} row bean
 */

public class ${classname} extends DBRow {

[... snip ...]



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


Re: Character precision...

Posted by Dave Newton <da...@solaraccess.com>.
On Wed, 2003-08-13 at 12:15, Rodrigo Reyes wrote:
> Mmmm... Interesting... Please, give me an example...
> > Liberal sprinklings of the ## (double comment character) really spruce
> > things up a bit. I generate text emails with velocity all the time; as
> > long as I ## lots of places I'm ok.

Here's an example of the top of one of my really old template files. The
interesting bit for you may be the trailing ## so that the output of the
macro doesn't get a newline.

Hope this helps!

Dave

##--------------------------------------------------------------------
## Macros and misc
##--------------------------------------------------------------------
#macro(cdval $cd)
#if (${cd.quote})
#if(${cd.sqlified})
"'" + StringUtils.sqlify(${cd.name.lower()}) + "'"##
#else
"'" + ${cd.name.lower()} + "'"##
#end
#else
${cd.name.lower()}##
#end
#end
##
##
#macro(tscast $col)
#if (${col.isdate})
(FigTimestamp) ##
#end
#end
##
##--------------------------------------------------------------------
## Header stuff
##--------------------------------------------------------------------
##
package ${beaninfo.packagename};

import java.sql.*;

import com.solaraccess.util.StringUtils;
import com.solaraccess.util.SolarException;
#if (${beaninfo.havetimestamp})
import com.solaraccess.util.FigTimestamp;
#end

/**
 * ${beaninfo.tablename} row bean
 */

public class ${classname} extends DBRow {

[... snip ...]



Re: Character precision...

Posted by Rodrigo Reyes <ro...@instaservi.com>.
Mmmm... Interesting... Please, give me an example...

Rodrigo

----- Original Message ----- 
From: "Dave Newton" <da...@solaraccess.com>
To: "Velocity Users List" <ve...@jakarta.apache.org>
Sent: Wednesday, August 13, 2003 11:10 AM
Subject: Re: Character precision...


> On Wed, 2003-08-13 at 11:46, Rodrigo Reyes wrote:
> > Hi all
> >     I have been using Velocity quite a while. It is great for generating
> > HTML, where extra spaces are no problem. Still, now I have to generate
some
> > reports which need have "character precision". Has someone done that
with
> > Velocity? Maybe with some other tool? Thanx...
>
> Liberal sprinklings of the ## (double comment character) really spruce
> things up a bit. I generate text emails with velocity all the time; as
> long as I ## lots of places I'm ok.
>
> Dave
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>



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


Re: Character precision...

Posted by Rodrigo Reyes <ro...@instaservi.com>.
Mmmm... Interesting... Please, give me an example...

Rodrigo

----- Original Message ----- 
From: "Dave Newton" <da...@solaraccess.com>
To: "Velocity Users List" <ve...@jakarta.apache.org>
Sent: Wednesday, August 13, 2003 11:10 AM
Subject: Re: Character precision...


> On Wed, 2003-08-13 at 11:46, Rodrigo Reyes wrote:
> > Hi all
> >     I have been using Velocity quite a while. It is great for generating
> > HTML, where extra spaces are no problem. Still, now I have to generate
some
> > reports which need have "character precision". Has someone done that
with
> > Velocity? Maybe with some other tool? Thanx...
>
> Liberal sprinklings of the ## (double comment character) really spruce
> things up a bit. I generate text emails with velocity all the time; as
> long as I ## lots of places I'm ok.
>
> Dave
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>



Re: Character precision...

Posted by Dave Newton <da...@solaraccess.com>.
On Wed, 2003-08-13 at 11:46, Rodrigo Reyes wrote:
> Hi all
>     I have been using Velocity quite a while. It is great for generating
> HTML, where extra spaces are no problem. Still, now I have to generate some
> reports which need have "character precision". Has someone done that with
> Velocity? Maybe with some other tool? Thanx...

Liberal sprinklings of the ## (double comment character) really spruce
things up a bit. I generate text emails with velocity all the time; as
long as I ## lots of places I'm ok.

Dave



Re: Character precision...

Posted by Dave Newton <da...@solaraccess.com>.
On Wed, 2003-08-13 at 11:46, Rodrigo Reyes wrote:
> Hi all
>     I have been using Velocity quite a while. It is great for generating
> HTML, where extra spaces are no problem. Still, now I have to generate some
> reports which need have "character precision". Has someone done that with
> Velocity? Maybe with some other tool? Thanx...

Liberal sprinklings of the ## (double comment character) really spruce
things up a bit. I generate text emails with velocity all the time; as
long as I ## lots of places I'm ok.

Dave



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