Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/verku/extensions/string.rb

Instance Method Summary collapse

Instance Method Details

#fix_scenebreaksObject


11
12
13
14
15
# File 'lib/verku/extensions/string.rb', line 11

def fix_scenebreaks
  str = ActiveSupport::Multibyte::Chars.new(self.dup)
  str.gsub(/\\begin{center}.*?\\rule{3in}{0.4pt}.*?\\end{center}/m,'\pfbreak')
  # str.gsub('\begin{center}\rule{0.5\linewidth}{\linethickness}\end{center}','\pfbreak')
end

#sectionizeObject

str.gsub('begincenterruleString.00.5linewidthlinethicknessendcenter','pfbreak')


16
17
18
19
# File 'lib/verku/extensions/string.rb', line 16

def sectionize
  str = ActiveSupport::Multibyte::Chars.new(self.dup)
  "<div class='section'>#{str}</div>"
end

2
3
4
5
6
7
8
9
10
# File 'lib/verku/extensions/string.rb', line 2

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