Formating @content_for_layout


#1

Hi all, I sent a message earlier, so forgive me if you have already
read this (I got some cryptic message in German about how my
e-mail was not read?). Anyway, I was just wondering if there was
any way to format the html that is output using

<%= @content_for_layout %>

I want to use something like the PHP Beautify. I guess I could
write my own, but I was hoping that Rails already had something
built in. Thanks to all. Have a great day.


Topher Fangio
removed_email_address@domain.invalid
http://www.fangiotophia.com

Website Specialist
Fangiotophia Designs
(325) 660-7141


#2

The “content_for_layout” declaration simply renders a template within
the
layout… so… you’d probably want to just format the template in the
first
place ?
Otherwise, assuming the @content_for_layout variable actually contains
all
the HTML (which I haven’t bothered to look at), you could run this
variable
through a method of your choice prior to rendering.


#3

Yes, I was hoping that Rails already had a method to make the html
pretty
without me having to write one. Or a library, or something. If not, all
I really
want is tabs and I wrote it in PHP, so I guess I could just copy the
algorithm.
Thanks for the repsonse =)

On 2/14/06, Dylan S. removed_email_address@domain.invalid wrote:

On 2/14/06, Toph removed_email_address@domain.invalid wrote:

built in. Thanks to all. Have a great day.
Rails mailing list


Topher Fangio
removed_email_address@domain.invalid
http://www.fangiotophia.com

Website Specialist
Fangiotophia Designs
(325) 660-7141


#4

There is a ruby interface to the tidy library. Sop you can use that
to tidy up your html before output.

Cheers-
-Ezra

On Feb 14, 2006, at 6:37 PM, Toph wrote:

within the

I want to use something like the PHP Beautify. I guess I could
(325) 660-7141
http://lists.rubyonrails.org/mailman/listinfo/rails

Website Specialist
Fangiotophia Designs
(325) 660-7141


Rails mailing list
removed_email_address@domain.invalid
http://lists.rubyonrails.org/mailman/listinfo/rails

-Ezra Z.
WebMaster
Yakima Herald-Republic Newspaper
removed_email_address@domain.invalid
509-577-7732


#5

Toph wrote:

I sent this earlier, but it sounds like you didn’t see any responses,
so:

There is a ruby interface to tidy:

http://rubyforge.org/projects/tidy/

Not sure what you would need to do to hook it into a rails app.

You could also rewrite your rhtml files as rxml… at least I would
think that building
the page as an xml tree and then writing it out would create a nice neat
source output.

b


#6

If someone is still interested on this topic:

http://www.cosinux.org/blogs/dam/pages/rails-tidy