Sha256: b77dd5ac617dbb89aa9fea8d17c7124b9563a6c5cb9c95fb71fab7bd69b95201

Contents?: true

Size: 555 Bytes

Versions: 44

Compression:

Stored size: 555 Bytes

Contents

module RedCloth::Formatters::HTML
  def after_transform(text)
    # Asset Links
    text.gsub! /\[asset\(([^\)]+)\)\]/ do |s|
      asset_id, size = $1.split('|')
      asset = Asset.find_by_id(asset_id)
      return if asset.nil?
      html = "<a href=\"#{asset.public_filename}\" class=\"fancybox\" rel=\"group\">"
      if asset.is_image?
        html << "<img src=\"#{asset.public_filename(size)}\" alt=\"#{asset.description}\" />"
      else
        html << asset.description.titleize
      end
      html << '</a>'
    end
    text.chomp! 
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
beef-has_assets-0.1.1 lib/custom_redcloth_tags.rb
beef-has_assets-0.2.0 lib/custom_redcloth_tags.rb
beef-has_assets-0.2.1 lib/custom_redcloth_tags.rb
beef-has_assets-0.2.10 lib/has_assets/custom_redcloth_tags.rb
beef-has_assets-0.2.2 lib/custom_redcloth_tags.rb
beef-has_assets-0.2.3 lib/custom_redcloth_tags.rb
beef-has_assets-0.2.5 lib/custom_redcloth_tags.rb
beef-has_assets-0.2.6 lib/custom_redcloth_tags.rb
beef-has_assets-0.2.7 lib/custom_redcloth_tags.rb
beef-has_assets-0.2.8 lib/custom_redcloth_tags.rb
beef-has_assets-0.2.9 lib/has_assets/custom_redcloth_tags.rb
beef-has_assets-0.3.1 lib/has_assets/custom_redcloth_tags.rb
beef-has_assets-0.3.2 lib/has_assets/custom_redcloth_tags.rb
beef-has_assets-0.3.3 lib/has_assets/custom_redcloth_tags.rb
beef-has_assets-0.3.4 lib/has_assets/custom_redcloth_tags.rb
beef-has_assets-0.3.5 lib/has_assets/custom_redcloth_tags.rb
beef-has_assets-0.3.6 lib/has_assets/custom_redcloth_tags.rb
beef-has_assets-0.3.7 lib/has_assets/custom_redcloth_tags.rb
beef-has_assets-0.3.8 lib/has_assets/custom_redcloth_tags.rb
beef-has_assets-0.3.9 lib/has_assets/custom_redcloth_tags.rb