package KinoSearch::Highlight::SimpleHTMLEncoder; use strict; use warnings; use KinoSearch::Util::ToolSet; use base qw( KinoSearch::Util::Class ); BEGIN { __PACKAGE__->init_instance_vars(); } sub encode { my $text = $_[1]; for ($text) { s/&/&/g; s/"/"/g; s//>/g; } return $text; } 1; __END__ =head1 NAME KinoSearch::Highlight::SimpleHTMLEncoder - encode a few HTML entities =head1 SYNOPSIS # returns '"Hey, you!"' my $encoded = $encoder->encode('"Hey, you!"'); =head1 DESCRIPTION Implemetation of L which encodes HTML entities. Currently, this module takes a minimal approach, encoding only '<', '>', '&', and '"'. That is likely to change in the future. =head1 COPYRIGHT Copyright 2006-2009 Marvin Humphrey =head1 LICENSE, DISCLAIMER, BUGS, etc. See L version 0.165. =cut