Sha256: 78867f71529ff6c413158998fdf405a7bf5652f618ec663333b6dd2d9407eeb1

Contents?: true

Size: 453 Bytes

Versions: 2

Compression:

Stored size: 453 Bytes

Contents

class String
  def to_permalink
    str = ActiveSupport::Multibyte::Chars.new(self.dup)
    str = str.normalize(:kd).gsub(/[^\x00-\x7F]/,'').to_s
    str.gsub!(/[^-\w\d]+/xim, "-")
    str.gsub!(/-+/xm, "-")
    str.gsub!(/^-?(.*?)-?$/, '\1')
    str.downcase!
    str
  end
  def to_latex
  	require 'kramdown'
  	Kramdown::Document.new(self.dup).to_latex
  end
  def to_html
  	require 'kramdown'
  	Kramdown::Document.new(self.dup).to_html
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
verku-0.8.1.0 lib/verku/extensions/string.rb
verku-0.8.0.p lib/verku/extensions/string.rb