Sha256: 0a8ec36a799a9bb3337fbae4ef677aaf93efccea92129ff0ce1ca0b42b33f42b

Contents?: true

Size: 759 Bytes

Versions: 1

Compression:

Stored size: 759 Bytes

Contents

%w{
uri

murlsh
}.each { |m| require m }

module Murlsh

  # show the domain of the url
  class UrlDisplayAdd50HostRec < Plugin

    @hook = 'url_display_add'

    # show the domain of the url
    def self.run(markup, url, config)
      if domain = Murlsh::failproof { URI(url.url).domain }
        # show domain if not already contained in title and not on skip list
        unless (url.title and url.title.downcase.index(domain)) or
          skips.include?(domain)
          markup.span(" [#{domain}]", :class => 'host')
        end
      end
    end

    @skips = %w{
      wikipedia.org
      flickr.com
      github.com
      twitpic.com
      twitter.com
      vimeo.com
      youtube.com
      }
    class << self; attr_reader :skips; end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
murlsh-1.0.0 plugins/url_display_add_50_hostrec.rb