Class: ESS::Postprocessing::StripSpecificHTMLTags

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

Instance Method Summary collapse

Instance Method Details

#process(text) ⇒ Object



56
57
58
59
60
61
62
63
64
65
# File 'lib/ess/postprocessing.rb', line 56

def process text
  # skip any empty space between two tags
  text = text.gsub(/>\s+</, '><')
  text = text.gsub(/<noscript[^>]*?>.*?<\/noscript>/mi, '')
  text = text.gsub(/<iframe[^>]*?>.*?<\/iframe>/mi, '')
  text = text.gsub(/<script[^>]*?>.*?<\/script>/mi, '')
  test = text.gsub(/<style[^>]*?>.*?<\/style>/mi, '')
  test = text.gsub(/<![\s\S]*?--[ \t\n\r]*>/, '')
  return text
end