IMPORTANT STUFF BELOW!

Christoph Reck wrote:
> 
> now you get a +1 if you include the 2c of John Castura.
> (having '$/bar' emit '$bar' in both undefined/defined cases).

I think $/bar emits $/bar in *all* cases since \ would be the escape :)

> Note that if the templater wants to ensure that the $-sign is
> emitted (since it is a VTL special character) then he should have
> to (post-)escape it.

Why? What about simply '$$foo'?  (I will note that I have a bug and this
doesn't work :)

 
> Another trick to achieve the same would be to define:
> #set $d = "$"
> ${d}foo => $foo
> Thus doing away wholly with escaping ;)

That would work.  These cases, I think, are very specific to debugging
and writing VTL documentation, aren't they?  Are there other uses for
escaping VTL elements to literals?

And in HTML, you would just use the entity for '$', $ or something.
(Had to do that many a time in WM...)
 
> Geir Magnusson Jr. wrote:
> >
> >   $\<reference> outputs $<reference> if a valid reference, $\<reference>
> > otherwise
> 
> leave away the otherwise.

I can't!  It's just plain schmoo if a person puts $\woogie into the
template and they don't have a reference behind it.  That's the point
here : if something looks like a VTL element (ref or directive) but
isn't then it isn't, and should be output.  Things become VTL by the
active act by the designer of putting in things that are 'backed' by the
context.


Everyone, this is important :

   The point is that I believe that something is a reference if and only
if it has a 
   value in the Context.  Otherwise it is schmoo, with the exception of
the $!<ref> 
   construct.  This is the way the current parser behaves.

   THIS MAY BE AN ASSUMPTION ON MY PART THAT IS INCORRECT.

    The following VTL :
        $foo
        $!foo
        #set $foo = "hi!"
        $foo
    
    outputs:
        $foo
        
        hi!

(lets not argue about the blank line.... it is correct according to
precise whitespace handling rules)

But I believe it is correct.  You have the option of saying to the
parser with $!foo : "Hey, if this isn't a ref, don't output anything" as
well as "Hey, it's schmoo!" with $foo not backed by something in the
Context.

Another way: You can take any content, scatter in your VTL, and if there
are and $foo type elements in the original material, you don't have to
go back and escape them or something so they will appear as they are in
the original content.  So adding VTL is an 'active' thing on the
designers part, whereas the 'passive' view says that any $foo is a
reference.  This is how WM behaves (or they have fixed it...), and I
hated it.

Futher, if you want to output the literal representation of a valid VTL
reference (a real directive, or a context-backed reference), you have to
actively go do that $\foo ( or \\$foo depending on how that debate turns
out.)

> >   #\<directive> outputs #<directive> if a valid directive, #\<directive>
> > other
> 
> ditto, above.

No.  (ditto above above :)
 

> > Isn't this a special-case use, for either writing Vel documentation or
> > debugging?  Maybe I have the wrong idea about this... Hm.
> 
> Also for any symbol loaded (HTML-)output, e.g. take a catalog with
> pricelists and serial numbers, eeky example:
>     "<th>$\price</th><th>#\Item ID</th>".

Why not just do

        <th>$Price</th><th>#ItemID</th>

See my point about non-VTL elements rendering as they are?  :D  Thanks
for the example!

geir

-- 
Geir Magnusson Jr.                               [EMAIL PROTECTED]
Dakota tribal wisdom: "when you discover you are riding a dead horse,
the best strategy is to dismount."

Reply via email to