The way Rails helpers work is that they're defined for the ActionView::Base
class. This class is then instantiated, and it's used as the context in
which the template is evaluated. To specify such a context for Haml, you
need to pass the ActionView::Base object to Haml::Engine#render. Note that
if you're doing this from within a helper, "self" is the current
ActionView::Base instance.

On Jan 18, 2008 4:03 PM, bilson <[EMAIL PROTECTED]> wrote:

>
> I read the Engine docs, but I'm not picking up on how I get the
> helpers like "link_to" and "image_tag" to work.  It is recognizing
> Ruby code and Haml tags and converting to HTML, but not Rails helpers.
>
> Best Regards,
> Bilson
>
> On Jan 13, 6:28pm, "Nathan Weizenbaum" <[EMAIL PROTECTED]> wrote:
> > Check out the docs for Haml::Engine:
> http://haml.hamptoncatlin.com/docs/rdoc/classes/Haml/Engine.html. It
> should
> > answer all your questions, but if it doesn't, feel free to ask again.
> >
> > On Jan 13, 2008 1:00 AM, bilson <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> > > This live preview is awesome. Adding the :ruby filter is better than
> > > using script/console. Live testing. Haml rocks!
> >
> > > Best Regards,
> > > Bilson
> >
> > > On Jan 13, 3:45 am, bilson <[EMAIL PROTECTED]> wrote:
> > > > 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to