Return-Path: Delivered-To: apmail-velocity-dev-archive@www.apache.org Received: (qmail 18863 invoked from network); 9 Feb 2009 14:58:26 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 9 Feb 2009 14:58:26 -0000 Received: (qmail 49506 invoked by uid 500); 9 Feb 2009 14:58:25 -0000 Delivered-To: apmail-velocity-dev-archive@velocity.apache.org Received: (qmail 49490 invoked by uid 500); 9 Feb 2009 14:58:25 -0000 Mailing-List: contact dev-help@velocity.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Velocity Developers List" Delivered-To: mailing list dev@velocity.apache.org Received: (qmail 49479 invoked by uid 99); 9 Feb 2009 14:58:25 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 09 Feb 2009 06:58:25 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of nbubna@gmail.com designates 209.85.198.227 as permitted sender) Received: from [209.85.198.227] (HELO rv-out-0506.google.com) (209.85.198.227) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 09 Feb 2009 14:58:17 +0000 Received: by rv-out-0506.google.com with SMTP id b25so1750975rvf.49 for ; Mon, 09 Feb 2009 06:57:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=O7kgHe6PTfi49mQsR4NDH/WP0EDsZd/I3qqOgDI8XZ4=; b=IK1CrRKwvheL79b8GjNKrnZNyhSvvMj0fadPNC2s4Z8yIYZDDFxtOF48TDcd3KMfwY FZazrcc5Rew88Pwma6LY+kRjPMd/vLkcWZyh4Vi55q3a06VwHZEWI5XL6D5m5pAAlv5F j4GCRdKmHhCQQFwOSYcf19ROHbT2d6Tc3W5u4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=h+XyxJLkmklMCdeNnsd3m70KnN2DeNehHFd6iSke2h+eBJ2T6JKaY21H8W8sfp8ftP G2oO+KHbeBchSoJnVjS3lwZmzRO9FLY7zg3ZgrSbcuqUeUkMcmGJLTyTc6mr55xaSVIr hXKdbX0YiJt99dc73r58KGSCuVR3DryyD54J8= MIME-Version: 1.0 Received: by 10.141.101.16 with SMTP id d16mr3846924rvm.208.1234191476337; Mon, 09 Feb 2009 06:57:56 -0800 (PST) In-Reply-To: <67624990902071541id65f661se6e4ae93a1ed1a59@mail.gmail.com> References: <67624990902071541id65f661se6e4ae93a1ed1a59@mail.gmail.com> Date: Mon, 9 Feb 2009 06:57:56 -0800 Message-ID: <4d651da50902090657t5f3686e2ga577220202c29a33@mail.gmail.com> Subject: Re: Few suggested improvements for DisplayTools From: Nathan Bubna To: Velocity Developers List Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org comments in line... On Sat, Feb 7, 2009 at 3:41 PM, wrote: > Hello, > I wanted to share with you a few ideas I have about new simple > improvements for DisplayTools. I should be able to make patches for > them if you are interested. > > 1. Add new method > > isEmpty(object) > > that will return true if the object is null or empty (for strings it's > zero length; for collections, maps and arrays it's zero size). This > should help with annoying null checks. (Probably a better place for > this method would be Engine, not Tools) yeah, not something for tools. would be interesting to have the Uberspect pretend that every non-null reference has an isEmpty() method, or perhaps just add 0-length strings, empty collections, empty maps and 0-length arrays to the list of things that #if( $foo ) considers false. > 2. Add new "property" parameter to > > list(Object list, String delim, String finaldelim, String property) > > method that will format an array or collection of objects on selected > property (similar to SortTools). great idea! > 3. Add new method: > > stripTags(Object obj, String... allowedTags) > > that will strip all (html) tags from the text except those listed in > allowedTags (allowed tags are passed like this: "br","img","p"). that would definitely be useful. but should it strip them or escape them? > 4. Add new method: > > br(Object obj) > > that will replace \n with "
\n" simple enough. want to make a patch for this or any of the others? > 5. Add new "preserveWords" parameter to: > > truncate(Object truncateMe, int maxLength, String suffix, boolean preserveWords) > > that will truncate a string to a last complete word within maxLength > instead of exact character. also a good idea. again, want to help? i might take up a few of these, but i've got a lot of other irons in the fire. also, if you want these ideas to be remembered, opening up a JIRA issue for them would be a good idea. otherwise, they risk becoming buried in inboxes. > > Thanks. > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org > For additional commands, e-mail: dev-help@velocity.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org For additional commands, e-mail: dev-help@velocity.apache.org