You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Ludwig Magnusson <lu...@itcatapult.com> on 2011/02/18 10:50:43 UTC

Whitespaces and velocity 2.0

Hello!

I noticed the discussion about the whitespaces velocity generates, and I
also noticed this issue due in version 2.0 of velocity:
 <https://issues.apache.org/jira/browse/VELOCITY-253>
https://issues.apache.org/jira/browse/VELOCITY-253

Since I use velocity for html-generation the best case regarding whitespace
for me would be to be able to keep my templates well-formatted and indented
but to have all excessive whitespace omitted by the velocity engine. Is this
something that is worked on/possible/wanted in the velocity community?

/Ludwig


Re: Whitespaces and velocity 2.0

Posted by Nathan Bubna <nb...@gmail.com>.
On Fri, Feb 18, 2011 at 2:36 AM,  <ap...@recks.org> wrote:
...
> "It seems straight forward to alter the parser so that no white space is
> consumed. Then, with a property switch, the AST tree could be walked and
> altered so that white space is aggressively removed post-parse according to
> the rules provided in the issue description."

Agreed.  I was thinking (could be wrong) that this would mean having
the parser create ASTWhitespace nodes, right?  (i keep hoping to have
some time to start on Byron's approach too.  Almost had time in
January, but other things came up.)

> Initially we would need the parser modification to leave whitespace
> untouched plus at least one (default) post-processor to implement the
> backward-compatible current gobbling.

Actually, since this is 2.0, backwards compatible output is not a high
priority.  It would be very valuable, but anyone tackling this should
be free to consider other options first.

> Then it would be easy to implement and
> contribute further gobblers.
>
> Maybe someone listening wants to tackle this?

yes, please.

> Kind regards,
> Christoph
>
> Ludwig Magnusson on 2011-02-18 10:50 wrote:
>>
>> Hello!
>>
>> I noticed the discussion about the whitespaces velocity generates, and I
>> also noticed this issue due in version 2.0 of velocity:
>>  <https://issues.apache.org/jira/browse/VELOCITY-253>
>> https://issues.apache.org/jira/browse/VELOCITY-253
>>
>> Since I use velocity for html-generation the best case regarding
>> whitespace
>> for me would be to be able to keep my templates well-formatted and
>> indented
>> but to have all excessive whitespace omitted by the velocity engine. Is
>> this
>> something that is worked on/possible/wanted in the velocity community?
>>
>> /Ludwig
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
> For additional commands, e-mail: user-help@velocity.apache.org
>
>

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


Re: Whitespaces and velocity 2.0

Posted by ap...@recks.org.
Hi,

the whitespace issue has not been solved yet. Nathan kindly invited me to contribute, but my workload has not let me do it.

The approach suggested by Byron Foster in the issue seems the right way to go:
"It seems straight forward to alter the parser so that no white space is consumed. Then, with a property switch, the AST tree could be walked and altered so that white space is aggressively removed post-parse according to the rules provided in the issue description."

Initially we would need the parser modification to leave whitespace untouched plus at least one (default) post-processor to implement the backward-compatible current gobbling. Then it would be easy to implement and contribute further gobblers.

Maybe someone listening wants to tackle this?

Kind regards,
Christoph

Ludwig Magnusson on 2011-02-18 10:50 wrote:
> Hello!
>
> I noticed the discussion about the whitespaces velocity generates, and I
> also noticed this issue due in version 2.0 of velocity:
>   <https://issues.apache.org/jira/browse/VELOCITY-253>
> https://issues.apache.org/jira/browse/VELOCITY-253
>
> Since I use velocity for html-generation the best case regarding whitespace
> for me would be to be able to keep my templates well-formatted and indented
> but to have all excessive whitespace omitted by the velocity engine. Is this
> something that is worked on/possible/wanted in the velocity community?
>
> /Ludwig
>
>

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