stonean/slim — Issue #193: string interpolation in sub-template processor input
Author: sunaku
Created: 2011-10-11 19:12:21+00:00
State: open

Hello,

Slim's string interpolation isn't working as expected in the following markdown sub-template:

```irb
## without indentation on the interpolated content
>> Slim::Template.new("bogus_file.slim"){ "markdown:\n\#{links}\n there are [g] and [y]" }.render(Object.new, :links => "[g]: http://google.com\n[y]: http://yahoo.com\n")
"

[g]: http://google.com\n[y]: http://yahoo.com\n\n there are [g] and [y]

"

## with proper indentation on the interpolated content
>> Slim::Template.new("bogus_file.slim"){ "markdown:\n\#{links.gsub(/^/, ' ')}\n there are [g] and [y]" }.render(Object.new, :links => "[g]: http://google.com\n[y]: http://yahoo.com\n")
=> "

[g]: http://google.com\n [y]: http://yahoo.com\n\n there are [g] and [y]

"
```

I want the `#{links}` interpolation to be performed on the sub-template processor's input *before* it is given to the sub-template processor (markdown, in this case) for processing. That should produce the expected output:

```irb

>> links = "[g]: http://google.com\n[y]: http://yahoo.com\n"
=> "[g]: http://google.com\n[y]: http://yahoo.com\n"
>> Slim::Template.new("bogus_file.slim"){ "markdown:\n#{links.gsub(/^/, ' ')}\n there are [g] and [y]" }.render(Object.new)
=> "

there are g and y

\n"
```

Thanks for your consideration.