diff --git a/lib/locomotive/liquid/filters/html.rb b/lib/locomotive/liquid/filters/html.rb index 19f426b6..acfca793 100644 --- a/lib/locomotive/liquid/filters/html.rb +++ b/lib/locomotive/liquid/filters/html.rb @@ -38,6 +38,16 @@ module Locomotive asset_url(input) end + + # Write a theme image tag + # input: name of file including folder + # example: 'about/myphoto.jpg' | theme_image # + def theme_image_tag(input, *args) + return '' if input.nil? + input = "images/#{input}" unless input.starts_with?('/') + image_options = inline_options(args_to_options(args)) + "" + end # Write an image tag # input: url of the image OR asset drop diff --git a/spec/lib/locomotive/liquid/filters/html_spec.rb b/spec/lib/locomotive/liquid/filters/html_spec.rb index f1de062c..d6da61f1 100644 --- a/spec/lib/locomotive/liquid/filters/html_spec.rb +++ b/spec/lib/locomotive/liquid/filters/html_spec.rb @@ -44,6 +44,14 @@ describe Locomotive::Liquid::Filters::Html do javascript_tag('/trash/main.js').should == result javascript_tag('/trash/main').should == result end + + it 'should return an image tag for a given theme file without parameters' do + theme_image_tag('foo.jpg').should == "" + end + + it 'should return an image tag for a given theme file with size' do + theme_image_tag('foo.jpg', 'width:100', 'height:100').should == "" + end it 'should return an image tag without parameters' do image_tag('foo.jpg').should == ""