logo       

Re: Formatting Issue (Whitespace): msg#00197

jakarta.velocity.user

Subject: Re: Formatting Issue (Whitespace)

To my knowledge the current whitespace handling has some
more quirks to what you state, more below...

Hiroaki Nakamura wrote:
Well, I don't think this is a problem, IMO.

The rule is simple:
- Directives begins with # and ends with the line separator (\n)
AFAIKS:
* whitespaces after an #if(...) go through
* a #set(...) directive also gobbles leading whitespaces

I haven't re-checked this, so I might be wrong...

- Everything except directives and references are raw texts (including line
separators).

Yes, I agree that it is not easy to read templates without indentations of
directives.
However, if Velocity must recognize indentations of directives, it will be much
harder to implement the parser.
And with the implementation, it will be confusing when you must have extra
spaces. For example,
-----------------------------------------------------------
#foreach($item in $list)
#if($someCondition)
some text and new line and two spaces.
#end
#end
-----------------------------------------------------------
Note two extra spaces before #end of #if.

So, I think that the current treating of whitespaces are OK.

Just my 2 yen :-)
[snip]

--
:) Christoph Reck


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise