Sha256: b2245cf93acf506933c1089d48ea4bde7bc23de3be22e77a827b6cb7b4cab043

Contents?: true

Size: 599 Bytes

Versions: 1

Compression:

Stored size: 599 Bytes

Contents

require 'albino'

class Gollum::Albino < Albino
  def self.bin
    Albino.bin
  end

  def bin
    Albino.bin
  end

  def colorize(options = {})
    html = super.to_s
    html.sub!(%r{</pre></div>\Z}, "</pre>\n</div>")
    html
  end

  # Hotfix for vulnerable versions of Albino
  if !instance_methods.include?('shell_escape')
    def convert_options(options = {})
      @options.merge(options).inject('') do |string, (flag, value)|
        string + " -#{flag} #{shell_escape value}"
      end
    end

    def shell_escape(str)
      str.to_s.gsub("'", "\\\\'").gsub(";", '\\;')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gollum-1.1.1 lib/gollum/albino.rb