class Middleman::Extensions::AutomaticAltTags
Automatic Image alt tags from image names extension
Public Instance Methods
Source
# File lib/middleman-core/extensions/automatic_alt_tags.rb, line 7 def image_tag(path, params={}) unless path.include?('://') params[:alt] ||= '' real_path = path.dup real_path = File.join(config[:images_dir], real_path) unless real_path.start_with?('/') file = app.files.find(:source, real_path) if file && file[:full_path].exist? begin alt_text = File.basename(file[:full_path].to_s, '.*') alt_text.capitalize! params[:alt] = alt_text end end end super(path, params) end
Override default image_tag
helper to automatically insert alt tag containing image name.
Calls superclass method