Return-Path: Delivered-To: apmail-db-torque-dev-archive@www.apache.org Received: (qmail 60088 invoked from network); 10 Jul 2006 07:43:30 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 10 Jul 2006 07:43:30 -0000 Received: (qmail 37505 invoked by uid 500); 10 Jul 2006 07:43:28 -0000 Delivered-To: apmail-db-torque-dev-archive@db.apache.org Received: (qmail 37450 invoked by uid 500); 10 Jul 2006 07:43:28 -0000 Mailing-List: contact torque-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Apache Torque Developers List" Reply-To: "Apache Torque Developers List" Delivered-To: mailing list torque-dev@db.apache.org Received: (qmail 37393 invoked by uid 99); 10 Jul 2006 07:43:28 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 10 Jul 2006 00:43:28 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [62.109.81.242] (HELO mail.cadooz.de) (62.109.81.242) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 10 Jul 2006 00:43:27 -0700 Received: from [192.168.107.5] (helo=securemail.cadooz-ag.intern) by gateway.cadooz-ag.intern with esmtp (Exim 4.43) id 1FzqQ7-0002Rk-3E for torque-dev@db.apache.org; Mon, 10 Jul 2006 09:43:07 +0200 Received: from securemail (localhost [127.0.0.1]) by securemail.cadooz-ag.intern (Postfix) with ESMTP id EB6E26BC058 for ; Mon, 10 Jul 2006 09:43:05 +0200 (CEST) Received: from srv-master.cadooz-ag.intern (srv-master.cadooz-ag.intern [192.168.107.3]) by securemail.cadooz-ag.intern (Postfix) with ESMTP id E55376BC057 for ; Mon, 10 Jul 2006 09:43:05 +0200 (CEST) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-MimeOLE: Produced By Microsoft Exchange V6.5 Subject: Velocity Templates Date: Mon, 10 Jul 2006 09:43:18 +0200 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Velocity Templates Thread-Index: Acaj9HoumxCbZq5WT0a/6T6XZ2wxsA== From: "Thoralf Rickert" To: "Apache Torque Developers List" X-TBoneOriginalFrom: "Thoralf Rickert" X-TBoneOriginalTo: "Apache Torque Developers List" X-TBoneDomainSigned: false X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N 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.=20 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: torque-dev-unsubscribe@db.apache.org For additional commands, e-mail: torque-dev-help@db.apache.org