Sunday, April 27, 2008

Perl To Blogger


#!/usr/bin/perl
#
# perltoblogger
# written by Sam Levine (hn darkscyon dn gmail tld com).
# this may blow up your computer. use it at your own risk.
# this code is licensed under the GPL.
#
# This script is designed to convert perl scripts into code that can
# be posted into
# blogger with a minimum of fuss
# it does not create full html (if it did I would call it
# perltohtml), rather it creates code within
# <pre></pre> tags that may be posted as code snippets
# on blogger (or a forum, or a mediawiki wiki, etc.)
#
# Useage: perltoblogger [InputFile] > OutputFile.html
# Example: perltoblogger myperlfile > myhtmlfile.html
#
# thanks to http://www.w3schools.com/tags/ref_entities.asp for the
# list of ASCII entities
# thanks to http://bguide.blogpost.com/2008/03/html-entities.html
# for showing me how to be less of a noob.
# thanks to everyone involed in making perl.
#
print "<pre>\n";
while (<>) {
s:&:&amp;:g;
s:<:&lt;:g;
s:>:&gt;:g;
s:':&apos;:g;
s:":&quot;:g;

#s:<:&lt;:;
print;
}
print "</pre>\n";

No comments: