Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Bricolage: users

indenting html

 

 

Bricolage users RSS feed   Index | Next | Previous | View Threaded


zdravko.balorda at siix

Aug 26, 2011, 4:35 AM

Post #1 of 3 (600 views)
Permalink
indenting html

Hi,
this is silly question: can Mason help indenting output html so
that page source at the end looks nicer? :)

Please, apologize, regards, Zdravko


greg at node79

Aug 26, 2011, 6:50 AM

Post #2 of 3 (559 views)
Permalink
Re: indenting html [In reply to]

Hi Zdravko,

You could use a Mason <%filter> block. Inside that block, $_ will be the current output so you can just edit it in-place. You could put this right on the autohandler or inside a template depending on your setup (I do this on element templates to convert them from Markdown myself).

I'm sure there's a CPAN module to do the indenting. If it works on fragments of HTML as well as on entire HTML documents, so much the better.

HTH,
--Greg

Example template:

<html>
... lots of html ...
</html>
<%filter>
$_ = CPAN::Module::to_indent_html($_);
</%filter>

On 2011-08-26, at 7:35 AM, Zdravko Balorda wrote:

> Hi,
> this is silly question: can Mason help indenting output html so
> that page source at the end looks nicer? :)
>
> Please, apologize, regards, Zdravko


david at kineticode

Aug 26, 2011, 3:38 PM

Post #3 of 3 (563 views)
Permalink
Re: indenting html [In reply to]

On Aug 26, 2011, at 6:50 AM, Greg Heo wrote:

> You could use a Mason <%filter> block. Inside that block, $_ will be the current output so you can just edit it in-place. You could put this right on the autohandler or inside a template depending on your setup (I do this on element templates to convert them from Markdown myself).
>
> I'm sure there's a CPAN module to do the indenting. If it works on fragments of HTML as well as on entire HTML documents, so much the better.

I tend to just format my Mason templates *just so* to get indenting right. But it's silly.

Thinking about a Template::Declare burner, though…

David

Bricolage users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.