Sha256: 2d990da7b2629ca02cc6c19ba180e69f46cde737e63486593a6b515991f3f26b

Contents?: true

Size: 330 Bytes

Versions: 4

Compression:

Stored size: 330 Bytes

Contents

# Extend link with ->https ...

module Mdoc
  class Processor
    class ExpandLink < Processor
      def process!(doc)
        new_body = ''
        doc.body.split(/\n/).each do |line|
          new_body << line.gsub(%r!\-\>(https?\://\S+)!, '[\1](\1)') << "\n"
        end
        doc.body = new_body
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mdoc-0.0.11 lib/mdoc/processor/expand_link.rb
mdoc-0.0.10 lib/mdoc/processor/expand_link.rb
mdoc-0.0.9 lib/mdoc/processor/expand_link.rb
mdoc-0.0.8 lib/mdoc/processor/expand_link.rb