velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christoph Reck <Christoph.R...@dlr.de>
Subject Re: Whitespace, redux
Date Thu, 11 Apr 2002 08:31:58 GMT
+0 to your rule in a) which contains the BNF to something 
   *very* similar to what I proposed. 

+1 If you leave the (WSSchomo? Directive)* out of it. 
   I see the requirement that if you place multiple directives 
   in one line, you are embedding something in your text.
   The whitespaces around a directive should only be gobbled
   when it has been placed standalone in a line.
   Geir, for character stream users, they could just put
   a #**# upfront any directive to inhibit gobbling.
Porposal Update: 
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 (it is part of the
previous line!).

Daniel, could you live with this simplification?
Note that the #echo directive you propose can be easily achieved 
with a macro: #macro(echo $text)$text#end

Geir, should one of us tackle this issue and send a patch, 
including the test suite? Then give the proposal a +1.
I've currelty more than 100% Workload - and I know others also - 
but soemeone could yell up and say that its itching him and wants 
to schedule it in to get it resolved.

:) Christoph Reck

Daniel Dekany wrote:
>[snip]
> 
> I think a more general purpose and more obvious rule would be:
> 
> a)
> If a line is looks like this:
>   TemplateLine ::=
>       WSSchomo? Directive (WSSchomo? Directive)* WSSchomo? LineEnd
>   WSSchomo ::= (#x20 | #x09)+
>   LineEnd ::= ((#x0D #x0A) | #x0D | #x0A) | EndOfStream
> then the first "WSSchomo?" and the closing "WSSchomo? LineEnd" should be
> gobbled. (Note that it supports multiline directives, that is why
> "TemplateLine" is not simply "Line".)

Typo:
  s/WSSchomo/WSSchmoo/g
or even clearer
  s/WSSchomo/TabsAndSpaces/g

> 
> b)
> Directive #echo('whatever') can be used to output any text, and combined
> with the whitespace gobbling it gives total controll over whitespaces:
>   #if($foo)
>     #echo('whitespace tamed')
>   #else
>     #echo(' <- one-space')
>     #echo($test)
>   #end
> and it is also a good way to do a safe context independent escaping of
> reserved characters:
>   #echo('$')foo
>   #echo('##not a commend')
> 
> --
> To unsubscribe, e-mail:   <mailto:velocity-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:velocity-user-help@jakarta.apache.org>

-- 
:) Christoph Reck

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


Mime
View raw message