0

I am using Castle nVelocity to create templates to produce some text files. I have found that if I do something like the following in my template, that my output line is indented in the resulting file as it is in the template.

#foreach( $row in $report.Rows )
    Output this row: ${row}
#end

To get the output I want I have to write my template like this:

#foreach( $row in $report.Rows )
Output this row: ${row}
#end

Is there a way to tell nVelocity to gobble the white space so that the line will not be indented in the output but so that I can leave it indented in the template for readability?

zaq
  • 2,571
  • 3
  • 31
  • 39

1 Answers1

0

No you cannot do this with out of the box functionality.

Look into using a TransformationFilter http://docs.castleproject.org/MonoRail.Advanced-Topics.ashx#Transformation_Filters_14 which will allow you to manipulate the stream of data before it is sent to the client.

  • That's too bad. Makes the templates rather unreadable. I will eventually look for another template library since I don't really want to have to manipulate the datastream. – zaq Aug 21 '12 at 18:24
  • ok. If you change your mind you can use see TransformFilter examples at https://github.com/castleproject/MonoRail/tree/master/MR2/src/Castle.MonoRail.Framework/TransformFilters – Evangelos Skianis Aug 21 '12 at 18:31