Sha256: e22a39016bf06dfb17039edb37228a28ee8552ab078f7071ef02e5ba059e9b3b

Contents?: true

Size: 489 Bytes

Versions: 4

Compression:

Stored size: 489 Bytes

Contents

require 'uri'

require 'murlsh'

module Murlsh

  # Github project page titles are not very descriptive so add meta description
  # to title.
  class AddPre60GithubTitle < Plugin

    @hook = 'add_pre'

    GithubRe = %r{^https?://github\.com/\w+/[\w.-]+$}i

    def self.run(url, config)
      if not url.user_supplied_title? and url.url.to_s[GithubRe]
        unless url.ask.description.empty?
          url.title << " - #{url.ask.description}"
        end
      end
    end

  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
murlsh-1.4.1 plugins/add_pre_60_github_title.rb
murlsh-1.4.0 plugins/add_pre_60_github_title.rb
murlsh-1.3.1 plugins/add_pre_60_github_title.rb
murlsh-1.3.0 plugins/add_pre_60_github_title.rb