rtomayko / tilt

Generic interface to multiple Ruby template engines

Home Page:http://github.com/rtomayko/tilt

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Haml::TempleEngine: Option :line is invalid

mishina2228 opened this issue · comments

I upgraded Haml to v6.0.0 and got the following warning:

Haml::TempleEngine: Option :line is invalid

The following codes may be relevant.

tilt/lib/tilt/haml.rb

Lines 12 to 20 in 56e78da

def prepare
options = {}.update(@options).update(filename: eval_file, line: line)
if options.include?(:outvar)
options[:buffer] = options.delete(:outvar)
options[:save_buffer] = true
end
@engine = ::Haml::TempleEngine.new(options)
@engine.compile(data)
end

Thanks for the report. Looks like haml ships with it's own tilt handler now (Haml::Template). Not sure why the handler that ships with Tilt is being used, unless you are referencing Tilt::HamlTemplate directly.

I'll submit a pull request to fix the warning and one spec failure.

Thank you for quick reply!
I dig into this problem a little, and I found something.

My source code was like this:

require 'tilt'

Tilt.new('sample.haml')

Running the above code will display Haml::TempleEngine: Option :line is invalid warning.
Then I replaced require 'tilt' with require 'haml', the warning disappeared.

require 'haml'

Tilt.new('sample.haml')

It seems to be due to the different classes of instances returned by Tilt.new.

$ touch sample.haml
$ ruby -r tilt -e 'p Tilt.new("sample.haml").class'
Haml::TempleEngine: Option :line is invalid
Tilt::HamlTemplate
$ ruby -r haml -e 'p Tilt.new("sample.haml").class'
Haml::Template