Rails Output with parameter in mustache

I use Mustache in Rails 3 with this stone , and I hit a roadblock when I try to use Mustache in an instance where I would normally use it yield :parameter.

<html>
  <head>
    <title><%= yield :page_title %></title>
  </head>
</html>

Show message:

<% content_for :page_title do %>
  <%= SettingsList.site_title + " " + @post.title %>
<% end %>

Is there a way to reproduce this behavior with a Mustache? There seems to be a way to handle this when compiling the template:

mustache = MustacheClass.new
mustache[:yield_page_title] = content_for(:page_title)

But it seems that it would be inconvenient to work with my current setup using the mustache_rails3 gem.

I am also open to any answers that indicate a good way to avoid this approach yield. You could add enough logic to the tag {{page_title}}to handle all of my different instances of setting the header, but that seems far from ideal.

+5
1

Mustache . , show.html.mustache Ruby show.rb, .

{{page_title}}

<html>
  <head>
    <title>{{page_title}}</title>
  </head>
</html>

page_title

# inside show.rb
def page_title
  SettingsList.site_title + " " + @post.title
end
0

All Articles