Discussion:
How to prevent skip of newline after line comment
Andreas Kuhtz
2016-11-25 18:10:04 UTC
Permalink
Hello,

Is it possible to prevent skip of newline after line comment during
rendering?
I've the following lines in a template:

Some text to display ## some comment following
Next line with some text

The result is the following:
Some text to display Next line with some text

Instead of:
Some text to display
Next line with some text

Best regards,
Andreas
Sergiu Dumitriu
2016-11-25 18:25:05 UTC
Permalink
Since you know there's a comment there which will eat the newline, you
can add an empty line after it:

Some text to display ## some comment following

Next line with some text

This will print as you want. Since the newline following the comment is
discarded, the newline on the following empty line will be moved at the
end of the first line.

Another way is to use block comments:

Some text to display #* some comment following *#
Next line with some text
Post by Andreas Kuhtz
Hello,
Is it possible to prevent skip of newline after line comment during
rendering?
Some text to display ## some comment following
Next line with some text
Some text to display Next line with some text
Some text to display
Next line with some text
Best regards,
Andreas
--
Sergiu Dumitriu
http://purl.org/net/sergiu/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-***@velocity.apache.org
For additional commands, e-mail: user-***@velocity.apache.org
Andreas Kuhtz
2016-11-25 21:17:49 UTC
Permalink
Hi Sergiu,

Thanks for your answer. That was my fallback solution :-)

Regards,
Andreas
Post by Sergiu Dumitriu
Since you know there's a comment there which will eat the newline, you
Some text to display ## some comment following
Next line with some text
This will print as you want. Since the newline following the comment is
discarded, the newline on the following empty line will be moved at the
end of the first line.
Some text to display #* some comment following *#
Next line with some text
Post by Andreas Kuhtz
Hello,
Is it possible to prevent skip of newline after line comment during
rendering?
Some text to display ## some comment following
Next line with some text
Some text to display Next line with some text
Some text to display
Next line with some text
Best regards,
Andreas
--
Sergiu Dumitriu
http://purl.org/net/sergiu/
---------------------------------------------------------------------
Loading...