Sha256: a00e21078e27e5fca506fcd38d1b579872107969be10bfdfd8adb4cc5abb66d6

Contents?: true

Size: 719 Bytes

Versions: 1

Compression:

Stored size: 719 Bytes

Contents

require 'uri'

require 'murlsh'

module Murlsh

  # Show the domain of the url.
  class UrlDisplayAdd50HostRec < Plugin

    @hook = 'url_display_add'

    SkipDomains = %w{
      wikipedia.org
      flickr.com
      github.com
      twitpic.com
      twitter.com
      vimeo.com
      youtube.com
      }

    # 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
          SkipDomains.include?(domain)
          markup.span " [#{domain}]", :class => 'host'
        end
      end
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
murlsh-1.1.0 plugins/url_display_add_50_hostrec.rb