"Slide Users Mailing List" <[EMAIL PROTECTED]> schrieb am 17.11.04 07:50:24: > > On Sun, 2004-11-14 at 02:34 +0100, Stephane Bailliez wrote: > [snip...] > > why did you make your own template language ? > > > > When I see this: > > > > <?username <h1 <?style style="<%style%>"?>>Hello > > <%username;required;text/plain%>!</h1>?> > > > > I'm already screaming of pain ! It's not readable ! > > This is something I had a problem with as well. I've never used > Velocity, but given its growing popularity there's a decent chance that > developers/designer coming to Projector have at least heard of it. Also, > since it's used elsewhere it would be a skill that could be applied to > other areas later, and hence have a greater incentive to learn (and be > less of a catch-point during product selection). It also means IDEs are > more likely to support the syntax, at least with syntax highlighting. It > was very frustrating to work on template files and have my editor tweak > out over what should be red and what should be gray.
My idea was to use a syntax that most editors support. So I took something similar to ASP syntax. But there might be problems with my <? ... ?> tags so shall we replace them with some other tag name? > > I'd like to suggest at least having a look at JXTemplate > [http://cocoon.apache.org/2.1/userdocs/flow/jxtemplate.html]. It's > extremely simple, and was very fast to pick up. The documentation is a > single page and has (I think) everything you need to know. All templates > are valid XML which is very handy for people comfortable with XSLT, and > friendly to most IDEs and editors. JXTemplate uses a jstl-like syntax or > a jxpath syntax for referencing the object graph passed to the template. > It's very easy to echo values, so for simple templates just substituting > ${header.title} for "Sample Header Title" should be enough. > > I don't think JXTemplate can handle conditional attributes, but I would > like to point out that in most cases there's a "false" value that can be > used to keep the same behavior as leaving the parameter off. The most > obvious example I can think of is the "selected" attribute for <option> > tags. Both selected="" and selected="false" should be valid for the > unselected options. I added the conditional tags because I can along this problem very often in some projects. What about image tags? You often want to skip image tags if an image is not set: <img src="<%myImage%>"> will fail if the image is empty. As I stated in the docs the use of conditional tags breakes the rules for logic free templates, but it was just born out of my experience that it causes much pain to not have such a feature. But if people don't like it, I'll remove it :-( > > One thing I don't think JXTemplate can handle (not sure on this) is > outputting non-marked-up content. This would be a problem with CSS > files, for example. I love the way the CSS theme is handled with the > example application (I've copied the idea into another system I'm > working on), so it would be a shame to lose that. > > The last thing I'll throw out here is Zope Page Templates. There's a > java implementation [http://javazpt.sourceforge.net/] (GPL'd), so it > should be portable. I've only briefly glanced at zpt, but one capability > I noticed that was interesting was the capability to replace a piece of > text, an attribute, the contents of a tag or the entire tag (and all > attributes and contents) with dynamic content. This means a template can > contain as much placeholder content as a designer needs in order to work > with the template in their IDE/whatever while still containing all of > the presentation logic that makes it a real "template". If > ease-of-designer-use is a priority, this seems like a good approach. > > -James > Hi James, Thanks for your suggestions. My primary goal was to have logic-free templating that fits to the contract-based programming pattern. So you define the dynamic variables and the content-type they require and projector 'generates' a contract out of this information for your template. The idea behind this was to enable temlate designers to build very simple templates that don't know where the content comes from, but tells the user which content they can fill in. I've not much time at the moment, but when I'm back in 'real life' again, I'll have a look at the templating languages that you mentioned and will see if they fit projectors needs. I hope to be able to extend the documentation and example application so that I can convince people that my approach is not only to build my own templating, but to implement the ideas that I had because of so many projects where templates could not be maintained anymore after some time because they got too complex. But I'm open for any suggestions and the TemplateProcessor is just a Processor and other templating engines can be plugged in. This might be good to increase the acceptance. Kind regards, Daniel > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > ________________________________________________________________ Verschicken Sie romantische, coole und witzige Bilder per SMS! Jetzt neu bei WEB.DE FreeMail: http://freemail.web.de/?mc=021193 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]