You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Peter Lynch <pe...@yahoo.com> on 2001/07/04 00:41:57 UTC

More gobbling whitespace

Greetings,To save response size of content delivered
over the web, I am looking for a way to return
templates written like this :

-----8<----------
<html>
<head>



</head>

<body>
    This is tabbed text
  

    <br>
        Here is the next line that starts with
spaces.</body>


    </html>
----8<-----------------

To output to the browser like:

----8<----------------
<html>
<head>
</head>
<body>
This is tabbed text
<br>
Here is the next line that starts with spaces.
</body>
</html>
----8<-------------------The output would be much
cleaner and less readable
using view source and smaller in size to download.
We had an inhouse template parser that had this
functionality.
Is there a way that output generated by velocity can
gobble:
1) leading whitespace, and tabs
2) trim all whitespace and tabs at the end of lines
3) maintain new line characters
4) remove empty lines

all without the various hacks I have seen like using
comment directives at the beginning of lines.
It would be nice to have this be turned on and off via
a property so that developers could always get the
formatted source to help debugging. I realize this may
useful for only
web based templates, but hey it would be very cool
tohave.

Maybe velocity can do this already?

-Peter

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: More gobbling whitespace

Posted by Jon Stevens <jo...@latchkey.com>.
on 7/3/01 5:19 PM, "Warner Onstine" <wa...@warneronstine.com> wrote:

> This interests me, what would I post-process with?
> 
> -warner

Search the net...in the past, I have seen java based tools which will
properly compress whitespace in HTML data...(note, you have to be careful
about what you compress because things like <pre></pre> tags need the
whitespace to be preserved)...

So, you get the output stream from Velocity and then pass that into another
tool which parses/munges it.

-jon


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: More gobbling whitespace

Posted by Warner Onstine <wa...@warneronstine.com>.
----- Original Message ----- 
From: "Jon Stevens" <jo...@latchkey.com>
To: "Turbine-user" <tu...@jakarta.apache.org>
Sent: Tuesday, July 03, 2001 4:07 PM
Subject: Re: More gobbling whitespace


> on 7/3/01 3:41 PM, "Peter Lynch" <pe...@yahoo.com> wrote:
> 
> > Maybe velocity can do this already?
> > 
> > -Peter
> 
> Velocity doesn't need to do this...all you need to do is postprocess the
> output from Velocity.

This interests me, what would I post-process with?

-warner

> -jon
> 
> -- 
> If you come from a Perl or PHP background, JSP is a way to take
> your pain to new levels. --Anonymous
> <http://jakarta.apache.org/velocity/ymtd/ymtd.html>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: More gobbling whitespace

Posted by Jon Stevens <jo...@latchkey.com>.
on 7/3/01 3:41 PM, "Peter Lynch" <pe...@yahoo.com> wrote:

> Maybe velocity can do this already?
> 
> -Peter

Velocity doesn't need to do this...all you need to do is postprocess the
output from Velocity.

-jon

-- 
If you come from a Perl or PHP background, JSP is a way to take
your pain to new levels. --Anonymous
<http://jakarta.apache.org/velocity/ymtd/ymtd.html>


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org