I have this sort of working, though I doubt this is a very good way.
I added a parse_haml method that I found posted for a different use.
I threw the method into application.rb and made it a helper...
application.rb
-----------------
def parse_haml(string)
engine = Haml::Engine.new(string)
engine.render
end
helper_method :parse_haml
Now I can pull a string formatted as Haml out of the database and
display it appropriately. Even cooler is that I added a form observer
and have a live preview of the textarea going as I type. I also made
a background image for the textarea that shows 2 space columns to make
the textarea into a usable text editor.
The one thing that doesn't work is that none of the ActionView helper
methods are available. Is it possible to reinsert ActionView into the
chain?
Best Regards,
Bilson
On Jan 12, 9:22 pm, bilson <[EMAIL PROTECTED]> wrote:
> Is there a simple way to use HAML markup for a content management
> system? Basically I just want to...
> - Enter haml markup into a textarea and save to a database
> - Retrieve the text string from the database and display as HTML
>
> I don't see a helper that takes a string of HAML markup and returns
> HTML, but I'm probably overlooking it. I guess the HAML lab is
> essentially doing this, so there must be a way. I would also like to
> suppress evaluation of Ruby code for this facility. Is there anyway
> to suppress_eval only for specific controllers or views or does it
> have to be application-wide?
>
> BTW - HAML is the greatest plugin ever.
>
> Best Regards,
> Bilson
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---