bagder: curl-www/docs txt2plain.pl,NONE,1.1

[email protected]
Newsgroups gmane.comp.web.curl.www.cvs
Message-ID <[email protected]>
Update of /cvsroot/curl/curl-www/docs
In directory labb:/tmp/cvs-serv28696

Added Files:
	txt2plain.pl 
Log Message:
add script here and make all of the site use this


--- NEW FILE: txt2plain.pl ---
#!/usr/bin/perl

while(<STDIN>) {
    # convert <> to html-codes
    $_ =~ s/\</&lt;/g;
    $_ =~ s/\>/&gt;/g;

    # empty lines become &nbsp;
    $_ =~ s/^[ \t]*$/\&nbsp;/g;

    # trailing backslashes become \&nbsp;
    $_ =~ s/\\$/\\&nbsp;/;

    # convert the begining of a "C comment" to a html code to prevent the
    # cpp to barf
    $_ =~ s/\/\*/&\#47;*/g;

    # convert URLs to <a href>
    $_ =~ s/((http|ftp):\/\/([a-zA-Z0-9.=\/_%?-]*[0-9A-Za-z\/]))/<a href=\"$2:\/\/$3\">$1<\/a>/g;

    print $_;
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.