I'd like to be able to pass a multiline string to a haml helper.
I have a function format_code, that accepts a string and a set of line numbers to highlight.
The purpose of this function is to convert raw source into formatted HTML with highlighted lines, line numbers, newlines converted to brs, etc.
If I call it like this:
%p Some HAMl =format_code("def something a = b b = c end", :highlight_line => 2) %p Some more HAML
The reason for doing this is to embed a code example into a HAML document.
HAML complains about nesting in plain text. The nesting takes place within a string so I had assumed this would be OK. The same call works fine in irb.
I would use a helper, but I want to be able to pass a parameter hash. Any thoughts?