- unless filter == Haml::Filters::Preserve
- push_text(filtered.rstrip.gsub("\n", "\n#{' ' *
@output_tabs}"))
+ unless filter == Haml::Filters::Preserve
+ push_text(filtered.rstrip.gsub("\n", "\n#{' ' *
@output_tabs}"))
+ else
+ push_silent("_hamlout.buffer << #{filtered.dump} << \"\\n
\"\n")
+ end
else
- push_silent("_hamlout.buffer << #{filtered.dump} << \"\\n
\"\n")
+ push_silent(
+ "haml_temp = #{filter.name}" +
+ ".new(#{@filter_buffer.inspect})" +
+ ".render(self).rstrip" +
+ ".gsub(\"\\n\", \"\\n#{' ' * @output_tabs}\")\n", true)
+ @precompiled <<
+ "haml_temp = _hamlout.push_script(haml_temp, false, nil)
\n"
end
end
I'm guessing that uploading them to http://groups.google.com/group/
haml/files is even better.
I'm guessing that uploading them to http://groups.google.com/group/
haml/files is even better.
sake pastie:patch PASTE=12345
Regards,
Brett
- Nathan
Yeah, my bad. I didn't notice they all got line-wrapped. I'll go
throw them up on Pastie instead.
Regarding the :oneline filter, the intended use is this scenario:
Most likely:
:oneline
%pre
%code
= preserve("some multi-line code here")
But in general:
:oneline
%div
%span
= "Something that might normally cause line-wrapping in a place
where you don't actually want line-wrapping to occur for whatever
reason."
- online do
whatever
- Nathan
Also, I updated the patch to allow the ERB filter to take advantage of
this code.
Because I wanted the stuff within the "oneline" construct to be
specified as Haml. It seemed inelegant to me to have to drop into
Ruby when the content wasn't even dynamic to overcome what I felt was
a minor limitation of the templating system. Seemed to make more
sense to just go ahead and remove the limitation.
For example, what if I had:
:oneline
%pre
%code
:preserve
# This is some static ruby code
# which I want to display for the
# world to see.
puts eval(2 + 2)
Surely you don't disagree that that is a much nicer way of outputting
"<pre><code># This is some static ruby code
# which I want to
display for the
# world to see.
puts eval(2 +
2)
</code></pre>\n" than it would be if I tried to use a helper
method to generate that.
Also, could you work up unit tests for the rest of your patches? Thanks.
- Nathan