Added a document_header function

This commit is contained in:
Stefan Ritter 2009-04-30 10:26:56 +02:00
parent d62b62874b
commit 7083342902

View File

@ -36,6 +36,22 @@ def errorpage(string):
print '</html>'
sys.exit()
def document_header(string):
if string == "xhtml-transitional":
print 'Content-type: text/html\n'
print '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"'
print ' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'
print '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">'
if string == "xhtml-strict":
print 'Content-type: text/html\n'
print '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"'
print ' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'
print '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">'
if string == "atom":
print 'Content-type: application/atom+xml\n'
print '<?xml version="1.0" encoding="utf-8"?>'
print '<feed xmlns="http://www.w3.org/2005/Atom">'
configuration = ConfigParser.ConfigParser()
configuration.read('configuration')
@ -142,9 +158,7 @@ if feed_display == "atom":
blog_title_md5sum = generate_uuid(blog_title)
title_md5sum = generate_uuid(title)
print 'Content-type: application/atom+xml\n'
print '<?xml version="1.0" encoding="utf-8"?>'
print '<feed xmlns="http://www.w3.org/2005/Atom">'
document_header("atom")
print '<link href="' + blog_url + '/?feed=atom" rel="self" type="application/atom+xml"/>'
print ' <author>'
print ' <name>' + blog_title + '</name>'
@ -163,11 +177,7 @@ if feed_display == "atom":
# Generate regular page
else:
print 'Content-type: text/html\n'
print '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"'
print ' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'
print '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">'
document_header("xhtml-transitional")
print ' <head>'
print ' <title>' + blog_title + '</title>'
print ' <meta http-equiv="content-type" content="text/html; charset=utf-8" />'