module Octopress::Tags::ImageCaptionTag::ImageCaptionFunctions
Public Instance Methods
absolute_sized_figure()
click to toggle source
# File lib/octopress-image-caption-tag.rb, line 36 def absolute_sized_figure <<-EOS.gsub(/^ {10}/, '') # gsubm is to pretty up source by indenting <figure class='image-caption image-caption-absolute #{@class.rstrip}'> <a class='image-popup' href='#{@img}'> <img class='caption' src='#{@img}' width='#{@width}' height='#{@height}' title='#{@title}' alt='#{@alt}'> </a> <figcaption class='caption-text'> #{@caption} </figcaption> </figure> EOS end
em_sized_figure()
click to toggle source
# File lib/octopress-image-caption-tag.rb, line 49 def em_sized_figure <<-EOS.gsub(/^ {10}/, '') # gsubm is to pretty up source by indenting <figure class='image-caption image-caption-absolute #{@class.rstrip}'> <a class='image-popup' href='#{@img}'> <img class='caption' src='#{@img}' style='width:#{@width};height:#{@height};' title='#{@title}' alt='#{@alt}'> </a> <figcaption class='caption-text'> #{@caption} </figcaption> </figure> EOS end
parse_sizes(raw_size)
click to toggle source
# File lib/octopress-image-caption-tag.rb, line 14 def parse_sizes(raw_size) if /\s*(?<w>\d+(\.\d+)?%?(em)?)\s+(?<h>\d+(\.\d+)?%?(em)?)/ =~ raw_size @width = w @height = h elsif @class.rstrip == 'right' || @class.rstrip == 'left' @width = '33%' else @width = '100%' end end
parse_title(raw_title)
click to toggle source
# File lib/octopress-image-caption-tag.rb, line 25 def parse_title(raw_title) if /(?:"|')(?<title>[^"']+)?(?:"|')\s+(?:"|')(?<alt>[^"']+)?(?:"|')/ =~ raw_title @title = title @alt = alt else /(?:"|')(?<titlealt>[^"']+)?(?:"|')/ =~ raw_title @title = titlealt @alt = titlealt end end
relative_sized_figure()
click to toggle source
# File lib/octopress-image-caption-tag.rb, line 62 def relative_sized_figure <<-EOS.gsub(/^ {10}/, '') # gsubm is to pretty up source by indenting <figure class='image-caption #{@class.rstrip}'> <a class='image-popup' href='#{@img}'> <img class='caption' src='#{@img}' width='100%' height='100%' title='#{@title}' alt='#{@alt}'> </a> <figcaption class='caption-text'> #{@caption} </figcaption> </figure> EOS end