I would be very interested in a solution to this problem. From a code layout point of view this would be an important feature. Consider:

<div>
   &quot;

#if ($somevar)
   $somevar
#else
   nothing here
#end

   &quot;
</div>

This nicely formatted code makes it easy to see what's going on but will make the html render with spaces in it like so (if $somevar is false or null):

' nothing here '

Now this is a silly example and in this case it would be much easier to simply do this to eliminate the problem:


<div>

#if ($somevar)
   &quot;$somevar&quot;
#else
   &quot;nothing here&quot;
#end

</div>

but in more complex examples you'd either have a great amount of duplicated HTML, which makes it bad to maintain and update, or you'd have to make unreadable code (everything on one line with no white spaces).

I converted an old nasty taglibbed jsp into velocity and although I cleaned up the html (removing 20+ unnecessary nested tables) the filesize of the velocity version was actually slightly bigger than the old version because of all the whitespace.

So... I would very much like velocity to perhaps remove whitespace between a directive (i.e. a # statement) and any other code.

Paul.

Timothy Stone wrote:
List,

We noticed in #parse'ing an .vm file, excess whitespace, or linefeeds, are appearing in our templates after merge.

For example, where a '+' indicates a line feed or carriage return:

[mystyles.vm]
+
#set( $foo = "Copyright (c)")
+
#set( $bar = "2006" )
+


[myemail.txt]
#parse("mystyles.vm")
+
Dear bloated warthog,
blah
+
blah
+
blah
+
Regards,
Man in Black
+
${foo} ${bar}

[The final output]
+
+
+
+
Dear bloated warthog,
blah
+
blah
+
blah
+
Regards,
Man in Black
+
Copyright (c) 2006

Can these extra lines be managed in some way?

Thanks,
Tim



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



--

*Paul Loy
Software Developer*

Peoples Archive Ltd.
Middlesex House
34-42 Cleveland Street
London, W1T 4LB

Tel: +44 (0) 20 7323 0323
Fax: +44 (0) 20 7580 1938
[EMAIL PROTECTED]

Reply via email to