CGI-MxScreen
view release on metacpan or search on metacpan
MxScreen/HTML.pm view on Meta::CPAN
$t =~ s/>/>/g;
$t =~ s/</</g;
return $t;
}
#
# unescape_HTML
#
# Un-escape all HTML escaped sequences.
#
sub unescape_HTML {
my ($s) = @_;
$s =~ s/"/\"/ig;
$s =~ s/>/>/ig;
$s =~ s/</</ig;
$s =~ s/&/&/ig; # Must come last
}
1;
=head1 NAME
CGI::MxScreen::HTML - various HTML utility routines
=head1 SYNOPSIS
use CGI::MxScreen::HTML;
# Colours
print p("Those are ".red("red words"));
# Extra HTML tags
print center(
p(
flash("flashing") . " and " . blink("blinking") . " centered words"
)
);
# HTML escapes
my $escaped = escape_HTML("This & that <will> show");
print "<p>$escaped</p>";
my $str = unescape_HTML($escaped);
=head1 DESCRIPTION
This package holds various utility routines taken out of Tom Christiansen's
C<MxScreen> program (a "graphical" front-end to his I<Magic: The Gathering>
database) which greatly inspired this framework.
=head2 Colours
Those routines simply emit text within enclosing HTML tags. The following
color routines are defined:
red yellow orange green blue purple violet magenta cyan
For instance:
print p(big(strong(red("WARNING:"))));
would print a big boldface (usually) WARNING: in red.
=head2 Non-portable HTML tags
The following routine add non-portable HTML tags that were introduced by
Netscape. I don't recommend their use, but if you can't avoid it, they are:
flash blink center
For instance:
print center(h1("Title"));
would print a level-1 header centered.
=head2 HTML escaping
Two routines, C<escape_HTML()> and C<unescape_HTML()> perform basic HTML
quoting and un-quoting. By I<basic>, I mean they only take care of
escaping (and repectively unescaping) the "&", "<" and ">" characters. The
quote character (") is also escaped as """.
=head1 AUTHORS
Tom Christiansen F<E<lt>tchrist@perl.comE<gt>> within his MxScreen program.
Raphael Manfredi F<E<lt>Raphael_Manfredi@pobox.comE<gt>> for the repackaging
within the C<CGI::MxScreen> framework.
Send bug reports, suggestions, problems or questions to
Jason Purdy F<E<lt>Jason@Purdy.INFOE<gt>>
=head1 SEE ALSO
CGI::MxScreen(3).
=cut
( run in 0.775 second using v1.01-cache-2.11-cpan-d7f47b0818f )