normalize( input, entities=nil, entity_filter=nil )
public
Escapes all possible entities
Show source
def normalize( input, entities=nil, entity_filter=nil )
copy = input.clone
copy.gsub!( EREFERENCE, '&' )
entities.each do |key, value|
copy.gsub!( value, "&#{key};" ) unless entity_filter and
entity_filter.include?(entity)
end if entities
copy.gsub!( EREFERENCE, '&' )
DEFAULT_ENTITIES.each do |key, value|
copy.gsub!( value[3], value[1] )
end
copy
end