lib/img_props.rb in jekyll_img-0.2.4 vs lib/img_props.rb in jekyll_img-0.2.5
- old
+ new
@@ -65,12 +65,10 @@
@alt ||= @caption || @title
@title ||= @caption || @alt
end
def src_any(filetype)
- raise Jekyll::ImgError, "The 'src' parameter was not specified" if @src.to_s.empty?
-
@src.gsub('.webp', ".#{filetype}")
end
def src_png
raise Jekyll::ImgError, "The 'src' parameter was not specified" if @src.to_s.empty?
@@ -84,11 +82,15 @@
end
private
def setup_src
+ raise Jekyll::ImgError, "The 'src' parameter was not specified" if @src.nil?
+
+ raise Jekyll::ImgError, "The 'src' parameter was empty" if @src.empty?
+
@src = @src.to_s.strip
- raise Jekyll::ImgError, "The 'src' parameter was not specified" if @src.empty?
+ raise Jekyll::ImgError, "The 'src' parameter only contained whitespace" if @src.empty?
filetype = File.extname(URI(@src).path)
@src += '.webp' if filetype.empty?
@src = "/assets/images/#{@src}" unless ImgProperties.local_path?(@src) || url?(@src)