That seems to me like way more trouble than it's worth.

On Fri, Oct 16, 2009 at 2:00 AM, Lars Olsson <[email protected]> wrote:

>
> Perhaps something like this? It's ugly, but it works.
>
> require 'rubygems'
> require 'haml'
> require 'haml/html'
> require 'redcloth'
>
> # Method that converts HAML to HTML
> def haml2html(haml_data, haml_options = {})
>  Haml::Engine.new(haml_data, haml_options).render
> end
>
> # Method that imports textile inte a HAML template, fixing indentation
> def import_textile(textile_data, textile2html_options = {},
> html2haml_options = {}, haml2html_options = {})
>  data = textile_data
>  data = textile2html(data, textile2html_options)
>  data = html2haml(data, html2haml_options)
>  data = haml2html(data, haml2html_options)
>  data
> end
>
> # Method that converts HTML to HAML
> def html2haml(html_data, haml_options = {})
>  Haml::HTML.new(html_data, haml_options).render
> end
>
> # Method that converts Textile to HTML
> def textile2html(textile_data, textile_options = {})
>  RedCloth.new(textile_data, textile_options).to_html
> end
>
> # Example usage
> haml_data = <<EOF
> %html
>  %head
>    %title Big bang
>  %body
>    %p Haml content
>    = import_textile("<p>*Textile content*</p>", {}, {:xhtml => true})
>    %p some more haml content
> EOF
>
> puts Haml::Engine.new(haml_data).render
>
> /lasso
>
>
>
> On 13 Okt, 17:46, Nathan Weizenbaum <[email protected]> wrote:
> > Not without passing it through some sort of tidy helper that Haml doesn't
> > provide, I'm afraid. Haml only takes responsibility for prettifying the
> > content it generates.
> >
> >
> >
> > On Tue, Oct 13, 2009 at 3:25 AM, Lars Olsson <[email protected]> wrote:
> >
> > > Hi list,
> >
> > > I have some textile content that I'm inserting into one of my Haml
> > > templates by using the :textile filter. The resulting XHTML works ok,
> > > but the contents generated from textile lacks the nice indentation
> > > that the rest of the template has. Is there a way to properly indent
> > > filtered content (in the resulting XHTML) as well?
> >
> > > /lasso- Dölj citerad text -
> >
> > - Visa citerad text -
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Haml" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/haml?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to