Sha256: 9cfb65892913795268889be30d2987b4f6c9567cc02dc453a936bbc9adef429d
Contents?: true
Size: 775 Bytes
Versions: 16
Compression:
Stored size: 775 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) domain = Murlsh::failproof do URI(url.url).extend(Murlsh::URIDomain).domain end if 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
16 entries across 16 versions & 1 rubygems