diff --git a/.gitignore b/.gitignore index 59dd9583..f1b5f531 100644 --- a/.gitignore +++ b/.gitignore @@ -34,5 +34,5 @@ sites/ permanent doc/bushido *.swp - +/spec/dummy diff --git a/lib/locomotive/import/base.rb b/lib/locomotive/import/base.rb index 69131b96..1ecdea21 100644 --- a/lib/locomotive/import/base.rb +++ b/lib/locomotive/import/base.rb @@ -45,7 +45,7 @@ module Locomotive def replace_images!(template) return if template.blank? - template.gsub!(/\/samples\/(.*\.[a-zA-Z0-9]{3})/) do |match| + template.gsub!(/\/samples\/([^'"]+?\.[a-zA-Z0-9]{3})/) do |match| name = File.basename($1) if asset = site.assets.where(:source_filename => name).first diff --git a/lib/locomotive/import/pages.rb b/lib/locomotive/import/pages.rb index 4363669f..b32ee9a6 100644 --- a/lib/locomotive/import/pages.rb +++ b/lib/locomotive/import/pages.rb @@ -113,6 +113,7 @@ module Locomotive end end else + self.replace_images!(attributes['content']) element.content = attributes['content'] end end diff --git a/spec/fixtures/themes/default.zip b/spec/fixtures/themes/default.zip index 3d6e196a..3d69eb8e 100644 Binary files a/spec/fixtures/themes/default.zip and b/spec/fixtures/themes/default.zip differ diff --git a/spec/lib/locomotive/import_spec.rb b/spec/lib/locomotive/import_spec.rb index 829ef09b..a0227f33 100644 --- a/spec/lib/locomotive/import_spec.rb +++ b/spec/lib/locomotive/import_spec.rb @@ -73,7 +73,7 @@ describe Locomotive::Import::Job do it 'sets the editable text for a page from the site config file' do page = @site.pages.where(:title => 'Contact').first - page.find_editable_element('content', 'address').content.should == '

Our office address: 215 Vine Street, Scranton, PA 18503

' + page.find_editable_element('content', 'address').content.should match('

Our office address: 215 Vine Street, Scranton, PA 18503
office.jpg

') end it 'sets the editable file for a page from the site config file' do