Open moll opened 5 years ago
This is certainly an interesting and useful request, and something I’ve been thinking about in the past. I’d go even further and suggest that not only content_for
should handle non-string data, but rather every piece of Nanoc that deals with content could.
Some ideas of non-string data:
Hey,
I was trying to set a class on the
<body>
of a parent layout from an intermediate layout. As variables set in acontent_for :parent do foo = 42 end
don't reach the parent layout, I ended up using thecontent_for
string overload (content_for :class, "page-xyz"
and querying it throughcontent_for(@item, :class)
in the parent layout). As it internally appends to some ERB/Haml buffer, this works for string variables.How about generalizing it so one could pass all Ruby types through this mechanism?
This with Nanoc v4.10.1.