You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Andreas Kuhtz <an...@gmail.com> on 2016/11/25 18:10:04 UTC

How to prevent skip of newline after line comment

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

Re: How to prevent skip of newline after line comment

Posted by Andreas Kuhtz <an...@gmail.com>.
Hi Sergiu,

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

Regards,
Andreas

Sergiu Dumitriu <se...@gmail.com> schrieb am Fr., 25. Nov. 2016
um 19:24 Uhr:

> 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
>
> On 11/25/2016 01:10 PM, Andreas Kuhtz wrote:
> > 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
> http://purl.org/net/sergiu/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>

Re: How to prevent skip of newline after line comment

Posted by Sergiu Dumitriu <se...@gmail.com>.
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

On 11/25/2016 01:10 PM, Andreas Kuhtz wrote:
> 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
http://purl.org/net/sergiu/

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