|
The Guava Toolshtml2pre
|
Home  Computer Software  Guava Main Page  Example Makefile 
This is a very simple filter, written in Perl, which converts
ampersands and angle brackets into the appropriate HTML codes. This
is useful when including program source code or HTML source in an HTML
page.
The filter reads input from standard input, and writes its output
to standard output. For example:
$ html2pre < infile > outfile
|
#!/usr/bin/perl -w
# html2txt
#
# Steve Morphet - November 1999.
#
# Simple filter to convert ampersands and angle brackets into HTML
# codes.
while( <> ) {
s/&/&/g; # Do ampersands first
s/</</g;
s/>/>/g;
print $_;
}
|
Email: