Hello again,
<snip>
> So my proposal states not to gobble the whitespace around
> (Directive|Schmoo)+ which avoids the #**# and the empty line...
>
> Only gobble when WhiteSpace(Directive|Comment|Schmoo){1,1}WhiteSpace
>
by 'Shmoo', do you you mean a macro invocation (as opposed to a
definition)?
> > {eat-WS}#foreach( $d in $row.data ){eat-WS}
> > $d#if( $velocityCount < $row.size() ),
> > {eat-WS}#end{eat-WS}
> > {eat-WS}#end{eat-WS}
>
> only a tick better than the first example ;)
>
agreed..
> >
> Yes, I've thought about the parser consequences for my proposed solution.
>
> One idea I had is to make an AST-postprocessor to strip whitespaces
> from text nodes post-parsing. This would not require changing the
> velocity parser! But would have a small performacne impact.
>
> The real solution is to keep the parser from creating the whitespace
> nodes until the directives|text nodes in a line was created. If something
> other than one and only one directive was on the same line, then the
> parser creates the whitespace nodes before and after the normal line
> content. I've not written any parser yet, but can imagine its not that
> easy to do this.
As I mentioned earlier: this proposal, while elegant in concept, might
be very awkward to implement given my structure, but I have an idea
forming which may or may not work out.
I'm considering a 'conditional-whitespace' node type with an array to
define the condition on a per-line basis. During actual output
rendering, we could decide then what to do..
For the moment, anyone actually _using_ Veracity in production setting
(which is just me, I'm pretty sure) should consider Structured behaviour
to be liable to change.
> >
> > With #pragma-selectable whitespace handling, some of these awkward
> > solutions might be avoided by explicitly specifying preferred handling
> > on a block-by-block basis.
>
> Yup!
>
> An enhanced BNF, which considers VTL-comments is in:
> http://marc.theaimsgroup.com/?l=velocity-user&m=101902732218948&w=2
>
> DirectiveLine ::= LineEnd TabsAndSpaces? Markup TabsAndSpaces? LineEnd
> TabsAndSpaces ::= (#x20 | #x09)+
> LineEnd ::= StartOfStream | ((#x0D #x0A) | #x0D | #x0A) | EndOfStream
> Markup ::= Directive | ## | Multi-line-comment
> Multi-line-comment ::= (#**? ((#x0D #x0A) | #x0D | #x0A) *?*#)
>
Thanks, I'll give them a read before any further major whitespace
surgery.
> Side note - #local is already reserved for a directive from Geir,
> which lists a set of context variables which then are removed/restored
> after the corresponding #end.
>
> Maybe you could use another name like #use( ... ) ?
>
Interesting... #use is reserved in the back of my head to be employed in
the perl-sense of 'yank some utilities/libraries' , although #pragma
might cover this ground.. how about #lset(...), then re-implement
#local to be visible within the current directive block, or document if
not in a directive block?
> Both approaches for seem OK to me. Your solution is a bit simpler
> because it avoids the (indented)block with an #end. But this is at
> the same time its drawback, since you cannot control until where
> the context pollution lasts within the same template. OTOH, this
> drawback is of little importance, since the scope is limited to
> one file on which the author has control.
Bear in mind that #local/(proposed #lset) as it stands when used inside
a macro does not pollute outside the macro, which was the primary usage
I had in mind initially.. Outside of macros, the ability to stay
visible to the end of page while not polluting parents should be handy:
#if($array.length == 0)
#local($msg = "No results were found")
#elseif($array.length > $maxperpage)
#local($msg = "Do you want to see details on the first $maxperpage")
#else
#local($msg = "Do you want to see details on all $array.length?")
#end
<b>$msg</b>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
--
- michael dykman
- [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]