\n")
element_type=""
next_source_line = source_file.readline()
while not next_source_line=="":
if next_source_line == "\n":
#TODO: use appropriate end action based on element type
#TODO: deal with closing nested elements
destination_file.write(""+element_type+">\n")
element_type=""
next_source_line = source_file.readline()
continue
if element_type=="":
#TODO: determine appropriate element type
element_type="p"
destination_file.write("<"+element_type+">\n")
#TODO: deal with multiple spaces appropriately
destination_file.write(" " + htmlencode(next_source_line))
next_source_line = source_file.readline()
if next_source_line=="" and not element_type=="":
#TODO: deal with closing nested elements
destination_file.write(""+element_type+">\n")
destination_file.write(template_lines[1])
source_file.close()
destination_file.close()