Hi! Last weekend I had a look at the generator. I found out that you don't use your own template engine but extend a velocity ant-task which creates the Velocity environment and generates the templates. This is a problem because my "solution" requires full access to the velocity environment. I have to create a (small but) special Velocity resource loader that is linked to the Velocity engine. But I cannot do this without copying most of the code of the velocity task (org.apache.velocity.texen.ant.TexenTask). It's not much, because I just need to overwrite the TexenTask.execute() method and add/remove two lines of code. But I'm not sure if that is what you want (the original TexenTask.execute() method has 200 lines of code and comments).
bye Thoralf > -----Ursprüngliche Nachricht----- > Von: Thoralf Rickert [mailto:[EMAIL PROTECTED] > Gesendet: Montag, 10. Juli 2006 12:38 > An: Apache Torque Developers List > Betreff: AW: Velocity Templates > > > > Sorry, I did not read that out of your message. > > Yes, you'are right - the "on-the-fly" info is important but > not mentioned. > > > This would be > > a good feature in my opinion. Regarding the "nothing between > > #if and #else" problem: a line break is not enough ? > > If there is something like this: > > public void helloWorld() > { > #if($useLog) > > #else > System.out.println("Hello World called"); > #end > } > > Then it isn't a problem. But without the empty line - it > breaks. But I think, it's easy to test. I think, your > test-cases should show every problem and it's very easy to > revert to a working system (just uncomment one line of code). > > > > > > Thomas > > > > "Thoralf Rickert" <[EMAIL PROTECTED]> schrieb am 10.07.2006 > > 11:59:43: > > > > > No, I don't want to change the templates. They will be changed > > > virtually during loading into the velocity renderer in a stream. > > > > > > > > > > -----Ursprüngliche Nachricht----- > > > > Von: Thomas Fischer [mailto:[EMAIL PROTECTED] > > > > Gesendet: Montag, 10. Juli 2006 10:17 > > > > An: Apache Torque Developers List > > > > Betreff: Re: Velocity Templates > > > > > > > > > > > > Hi, > > > > > > > > The spaces in front of the velocity commands exist > > because it makes > > > > the templates themselves readable. I'd put more emphasis > > on keeping > > > > the templates readable than the generated code, so I'd > > rather leave > > > > the spaces where they are. > > > > > > > > Thomas > > > > > > > > "Thoralf Rickert" <[EMAIL PROTECTED]> schrieb am > > 10.07.2006 > > > > 09:43:18: > > > > > > > > > Hi! > > > > > > > > > > I think there is an open discussion thread (in 2005) about the > > > > > generated code style in the Base* classes but I can't > > find it. The > > > > > "problem" is that the generated code looks a little bit > > > > ugly because > > > > > of too many spaces. This is a velocity problem, because > > of leading > > > > > spaces in front of velocity commands like #if and #end. > > > > > > > > > > We've the same problem in one of our projects where we use > > > > > velocity templates to render XHTML pages. There I > made a small > > > > > patch in our VelocityTemplateLoader to generate better code. > > > > > > > > > > Here is an example of a template: > > > > > public void helloWorld() > > > > > { > > > > > #if($useLog) > > > > > log.debug("Hello World called"); > > > > > #else > > > > > System.out.println("Hello World called"); > > > > > #end > > > > > } > > > > > > > > > > These leading spaces makes the code "unattractive" and > > sometimes > > > > > unreadable. The patch is to remove any leading spaces in > > > > front of any > > > > > velocity command. It's a line-by-line replacement regex > > > > with "^\s#" to > > > > > "#". The result that is send to the renderer looks like this. > > > > > > > > > > public void helloWorld() > > > > > { > > > > > #if($useLog) > > > > > log.debug("Hello World called"); > > > > > #else > > > > > System.out.println("Hello World called"); > > > > > #end > > > > > } > > > > > > > > > > > > > > > The solution is simple but doesn't fix every problem. Of > > > > course this > > > > > could generate other problems. For example the following > > > > code compiles > > > > > well without the patch. > > > > > > > > > > But with the patch it creates a velocity compile error, > > because of > > > > > missing output between #if and #else > > > > > > > > > > public void helloWorld() > > > > > { > > > > > #if($useLog) > > > > > #else > > > > > System.out.println("Hello World called"); > > > > > #end > > > > > } > > > > > > > > > > If you're interested in such a patch I would make it for the > > > > > torque-generator. > > > > > > > > > > bye > > > > > Thoralf > > > > > > > > > > > > > > > > > > > > > -------------------------------------------------------------------- > > > > - > > > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > > > > > > > -------------------------------------------------------------------- > > > > - > > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
