haskellyesodhamlet

Is there a way to pass a Hamlet block as an argument to a function?


Let's say that I have a generic content :: Widget -> Widget helper, which takes a Widget and wraps it in some HTML.

Is is possible to call this function giving it the argument inline in the Hamlet file, similarly to what one would do in Ruby on Rails? For example let's say we have a helper link_to, which takes an URL and its content, we could call it something like

= link_to "/some_url" do
  <span class="icon">
  Click me

yielding <a href="/some_url"><span class="icon"/>Click me</a>.

Is there a similar pattern in Hamlet, where I could pass arbitrary Hamlet snippet as an argument to a function, direclty in the template?


Solution

  • No, such syntax does not exist.