print """ This is a simple program that takes a python file and replaces the 
plain text punctuation with the easily postable html code. 

   written by :	Daniel Folkes 
		danfolkes @t gm@il d0t c0m
		http://danfolkes.com 
"""
import sys
input = "NonValidInput"
if sys.argv[1]: 
	input = sys.argv[1]
else:
	input = raw_input("What is your input file?:")
ifile = file(input)

output = input + ".html"
if sys.argv[2]: 
	output = sys.argv[2]
ofile = file(output, 'w')
outstring = ""
#-----------consts-------------
tab = "&nbsp;&nbsp;&nbsp;&nbsp;"
space = "&nbsp;"
el = "<br />"
start = "<li>"
end = "</li>"
Pstart = "<ol>"
Pend = "</ol>"
convertTup = (("<","&lt;"),(">","&gt;"))
#-------consts[end]------------


outstring += Pstart
while 1:
	line = ifile.readline()
	if len(line) == 0: 
		break
#	line = line.replace("<","&lt;")
#	line = line.replace(">","&gt;")
#	line = line.replace("&","&amp;")
	for tup in convertTup:
		line = line.replace(tup[0],tup[1])
	line = line.replace("\t",tab)
	line = start + line + end
	outstring += line
outstring += Pend

ofile.write(outstring)


ofile.close()
ifile.close()


