Skip to content

Commit

Permalink
Support single quotation mark for CSS images and HTML image tags.
Browse files Browse the repository at this point in the history
  • Loading branch information
goncalossilva committed Mar 5, 2012
1 parent 31eef32 commit 91d4278
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/showoff.rb
Expand Up @@ -262,7 +262,7 @@ def update_image_paths(path, slide, static=false, pdf=false)
replacement_prefix = static ?
( pdf ? %(img src="file://#{settings.pres_dir}/#{path}) : %(img src="./file/#{path}) ) :
%(img src="#{@asset_path}image/#{path})
slide.gsub(/img src=\"([^\/].*?)\"/) do |s|
slide.gsub(/img src=[\"\']([^\/].*?)[\"\']/) do |s|
img_path = File.join(path, $1)
w, h = get_image_size(img_path)
src = %(#{replacement_prefix}/#{$1}")
Expand Down Expand Up @@ -537,7 +537,7 @@ def self.do_static(what)
}

# ... and copy all needed image files
data.scan(/img src=\".\/file\/(.*?)\"/).flatten.each do |path|
data.scan(/img src=[\"\'].\/file\/(.*?)[\"\']/).flatten.each do |path|
dir = File.dirname(path)
FileUtils.makedirs(File.join(file_dir, dir))
FileUtils.copy(File.join(pres_dir, path), File.join(file_dir, path))
Expand All @@ -546,7 +546,7 @@ def self.do_static(what)
Dir.glob("#{pres_dir}/*.css").each do |css_path|
File.open(css_path) do |file|
data = file.read
data.scan(/url\("?(.*?)"?\)/).flatten.each do |path|
data.scan(/url\([\"\']?(.*?)[\"\']?\)/).flatten.each do |path|
path.gsub!(/(\#.*)$/, '') # get rid of the anchor
path.gsub!(/(\?.*)$/, '') # get rid of the query
logger.debug path
Expand Down

0 comments on commit 91d4278

Please sign in to comment.