Class: MarkupMask

Inherits:
Object
  • Object
show all
Defined in:
lib/markup_mask.rb

Class Method Summary collapse

Class Method Details

.markup_mask(text) ⇒ Object



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

def self.markup_mask(text)
  tagsRegExp = /(<\/?\w+(?:(?:\s+\w+(?:\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)\/?>)/
  nbspsRegExp = /(&nbsp;)/
  jsRegExp = /(function.*?})/
  @regex = Regexp.union(nbspsRegExp, tagsRegExp, jsRegExp)
  unless text.nil?
    @text_arr = text.split(@regex)
  end
end