[ 
https://issues.apache.org/jira/browse/VELOCITY-253?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13003004#comment-13003004
 ] 

Claude Brisson edited comment on VELOCITY-253 at 3/5/11 5:13 PM:
-----------------------------------------------------------------

I submitted a structured whitespace globber implementation that uses an early 
filtering of unwanted whitespaces while resources are loaded - it's an alpha 
version, and I don't think that it can replace a proper implementation included 
in the parser, but I made some use of it so I share it on the wiki: 
http://wiki.apache.org/velocity/StructuredGlobbingResourceLoader


      was (Author: claude):
    I submitted a structured whitespace globber implementation that uses an 
early filtering of unwanted whitespaces while resources are loaded - it's an 
alpha version, and I don't think that it can replace a proper implementation 
included in the parser, but I made some use of it so I share it on the wiki: 
http://wiki.apache.org/jakarta-velocity/StructuredGlobbingResourceLoader

  
> Enhance whitespace gobbling
> ---------------------------
>
>                 Key: VELOCITY-253
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-253
>             Project: Velocity
>          Issue Type: Wish
>          Components: Engine
>    Affects Versions: 1.0-Release
>         Environment: Operating System: other
> Platform: Other
>            Reporter: Christoph Reck
>             Fix For: 2.x
>
>
> I expect that when adding velocity markup to an existing text file
> to not affect the spacing in the output. This includes indented #foreach
> directives and inner indented #if/#set/#macro directives.
> So the rule I proposed was to allow adding velocity markup, one per line,
> and still have the same output - e.g. add an #if statement around
> existing text to conditionally mask it out. Or add an #foreach around
> a table row and be able to repeat the body with dynamic data, etc.
> As sonn as a directive is placed wihtin other text in the same line, 
> any whitespace around it should remain untouched.
> If a line is looks like this:
>   DirectiveLine ::= LineEnd TabsAndSpaces? Directive TabsAndSpaces? LineEnd
>   TabsAndSpaces ::= (#x20 | #x09)+
>   LineEnd       ::= StartOfStream | ((#x0D #x0A) | #x0D | #x0A) | EndOfStream
> then the first "TabsAndSpaces?" and the closing "TabsAndSpaces? LineEnd"
> should be gobbled. (Note that it supports multiline directives, that is
> why "DirectiveLine" is not simply "Line".) If you whant the first
> "LineEnd" to be gobbled prepend a ## before it (makes the EOL part of 
> the previous line!).
> This has been an isse since velocity birth and discussed in many 
> user and developer threads. Some users agree with my proposals,
> some say that velocity sould not touch any whitespaces and a 
> code formatter should be run after the template rendering.
> The proposal is not 100% BC, but a switch could allow the classic 
> style (by default), or to pass all whitespaces.
> A new directive could be created to control the gobbling for 
> the enclosed parts within a template.

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to