You can use #{} to embed Ruby code within filters. See
http://haml-lang.com/docs/yardoc/file.HAML_REFERENCE.html#filtersOn Fri, Aug 20, 2010 at 11:50 AM, Josh <[email protected]> wrote: > Trying to conver this to haml: > > > <% javascript_onload = yield(:javascript_onload) %> > <% unless javascript_onload.blank? %> > <% javascript_tag do %> > $(function(){ > <%= javascript_onload %> > }); > <% end %> > <% end %> > > > First attempt: > > -javascript_onload = yield(:javascript_onload) > - unless javascript_onload.blank? > :javascript > $(function(){ > = javascript_onload > }) > > Results in: > > <script type='text/javascript'> > //<![CDATA[ > $(function(){ > = javascript_onload > }) > //]]> > </script> > > Second attempt looks like crap but works: > > -javascript_onload = yield(:javascript_onload) > - unless javascript_onload.blank? > :plain > <script type='text/javascript'> > //<![CDATA[ > = javascript_onload > :plain > //]]> > </script> > > Anyone have a better idea? > > -- > 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] <haml%[email protected]>. > For more options, visit this group at > http://groups.google.com/group/haml?hl=en. > > -- 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.
