Yes, if you change your double quotes to single quotes.
But \#{h @user.name} is more straight forward and already supported in
== mode.
Btw, I'm still +1 on this despite the need to occasionally escape.
Unfortunately, the fact that escaping is necessary means that it is
not a backwards compatible change.
chris
On Sep 30, 5:13 pm, Lawrence Pit <[EMAIL PROTECTED]> wrote:
> An example interpolation is #{h @user.name}
>
> could be escaped as:
>
> An example interpolation is #{ "#{h @user.name}" }
>
> Lawrence
>
> > It should be noted that doing so would create a need for escaping the
> > #{ sequence if it occurs naturally in text.
>
> > Chris
>
> > On Sep 30, 4:45 pm, Lawrence Pit <[EMAIL PROTECTED]> wrote:
>
> >> That's how I do it as well... I rarely use the == syntax. Only in cases
> >> like these:
>
> >> == Hello #{h @user.name},
>
> >> which is nicer compared to:
>
> >> Hello
> >> = succeed ',' do
> >> = h @user.name
>
> >> But of course simply this is even nicer:
>
> >> Hello #{h @user.name},
>
> >> As indeed is already possible when defined within a filter block.
>
> >> I vote +1 on the proposal.
>
> >> Lawrence
>
> >>> While I don't find anything conceptually wrong and would even +1 this
> >>> because there's times it would be convenient, I simply do this:
>
> >>>http://gist.github.com/13840
>
> >>> -chris
>
> >>> On Sep 30, 6:16 am, Jacques Crocker <[EMAIL PROTECTED]> wrote:
>
> >>>> In the process of bombarding the world with open source haml rails
> >>>> apps (see here, here, here), I've definitely noticed a few small
> >>>> things haml could do to increase the readability of haml view code.
>
> >>>> The most important one that I would like to suggest is some kind of
> >>>> universal interpolation of #{} without the requirement of beginning
> >>>> the line with ==. I've been using == so much lately that its starting
> >>>> to look pretty ugly. Seems like it would help a lot if that it was the
> >>>> standard. So my question to haml users is: what would be the speed and
> >>>> functionality implications of allowing #{} to be used anywhere without
> >>>> the requirement of ==?
>
> >>>> Here's a quick code example:http://gist.github.com/13805
>
> >>>> I imagine automatically treating every static content line as if it
> >>>> were a == would make haml an order of magnitude slower. The trick
> >>>> would be to specifically recognize the existence of #{} in content
> >>>> blocks (hopefully via a super fast content eval) and automatically
> >>>> turn the evaluation of that line to ==.
>
> >>>> I spent a little time looking at the the haml codebase to verify my
> >>>> findings but things haven't clicked for me yet. Would love any
> >>>> feedback from someone who has a better handle on the parser on whether
> >>>> this is possible without a huge problem in performance. Aside from the
> >>>> implementation details, is there anyone who would object functionality-
> >>>> wise to being able to use #{} anywhere in normal content blocks? Since
> >>>> #{} is a rarely used html token I don't think it would conflict with
> >>>> peoples existing view code. And since this type of automatic
> >>>> interpolation is already done by default within Filters, it seems a
> >>>> natural extension to use it in normal content blocks.
>
> >>>> Would love feedback on anything regarding the idea or implementation
> >>>> challenges. Maybe I'm way off base here, but if it sounds like
> >>>> something that had a remote chance to be added to haml core, I can do
> >>>> some hacking on a fork and see how it goes.
>
> >>>> Thanks
>
> >>>> -Jacques
> >>>> railsjedi.com
>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---