Sha256: 69906fcade980414f36fcbc832c81f8a2205a6714432219f20e9c7646a2daedc

Contents?: true

Size: 576 Bytes

Versions: 1

Compression:

Stored size: 576 Bytes

Contents

%w{
murlsh
}.each { |m| require m }

module Murlsh

  # warn of content types that launch external apps
  class UrlDisplayAdd55ContentType < Plugin

    @hook = 'url_display_add'

    # warn of content types that launch external apps
    def self.run(markup, url, config)
      content_type_display = case url.content_type
        when 'application/pdf' then 'pdf'
        when 'audio/mpeg' then 'mp3'
        else ''
      end

      unless content_type_display.empty?
        markup.span(" (#{content_type_display})", :class => 'content-type')
      end
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
murlsh-1.0.0 plugins/url_display_add_55_content_type.rb