(guess this thread has more to do on the devel  list)

The work of moving Velocity towards a textformat-aware tool is really exiting, and I 
really would like to take an active
participation in it.

Following, my thoughts on the subject :

the goal : achieve a format-aware reference rendering mechanism that is as much 
implicit and extensible as possible.
Of course, reference values are meant not to contain syntax boundaries (i.e. all 
syntax logic belongs to the template... sounds
quite reasonable...).

here is the data model  I suggest :

[template]---[format]---*[syntax]---[insertion point]

terminology :
 - format : plaintext (no char escaping) , xml , html...
 - syntax : format context. Xml syntaxes would be : attribute value, content, cdata, 
comment, ...
(for html, we could go very far, into javascript strings ("/') and http 
escaping...(%xx) that would be something, dude)
 - syntaxer (better naming ideas ?) : the object that would guess the needed syntax at 
each insertion point
 - char escaper : the object that would render references in a known syntax

Format determination : either :
 - sniffer (templates starting with <?xml... or <html... )
 - #include and #parse directives (children inherit the format and the syntax)
 - maybe we could also drop ".vm" on this occasion and use filename extensions
 - a specific #format directive
 - the servlet content type
- init properties
 - ...

The current event model is not sufficent because :
 - the format and syntaxes should (always ? at least when possible) be determined at 
the time the templates are parsed
 - the current format, as long as the syntax at the current insertion point, has to be 
known by the char escaper
 - some complex cases will surely require the mechanism to be integrated into the core 
code of Velocity

Implementation :
 - parsing time :
   . this processing step could be inserted just after the building of the tree
   . just walk the tree and determine step by step the current syntax each time an 
ASTText is encountered
   . the current syntax should be stored in nodes that have something to render 
(ASTReference, ASTDirective, and others ?)
 - rendering time :
   . issue calls to the char escaper from within ASTReference
   . the syntax is either statically known (from the parsing time) or asked to the 
parent node

Of course, the whole mechanism could be switched on/off by the appropriate init 
property

Whadayathink ?

CloD






--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to