Class: EscapeParser

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

Instance Method Summary collapse

Instance Method Details

#parse(text, contentDoc) ⇒ Object



272
273
274
275
276
277
278
279
280
281
282
# File 'lib/ribit/contentparser.rb', line 272

def parse( text, contentDoc )
  
  # we need to escape all <,>,',",& 
  text.gsub!( /&/, '&amp;' )
  text.gsub!( /</, '&lt;' )
  text.gsub!( />/, '&gt;' )
  text.gsub!( /\"/, '&quot;' )
  text.gsub!( /\'/, '&apos;' )
  
  return [ TextContainer.new( text ) ]
end