Sha256: b4b9cf166cea6f021e75006c4150d3953e8b5a9e55907f1b5789426211b85661

Contents?: true

Size: 451 Bytes

Versions: 2

Compression:

Stored size: 451 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 url.url[GithubRe]
        unless url.ask.description.empty?
          url.title << " - #{url.ask.description}"
        end
      end
    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
murlsh-1.2.1 plugins/add_pre_60_github_title.rb
murlsh-1.2.0 plugins/add_pre_60_github_title.rb