Added a document_header function
This commit is contained in:
parent
d62b62874b
commit
7083342902
26
blogthon.cgi
26
blogthon.cgi
@ -36,6 +36,22 @@ def errorpage(string):
|
|||||||
print '</html>'
|
print '</html>'
|
||||||
sys.exit()
|
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 = ConfigParser.ConfigParser()
|
||||||
configuration.read('configuration')
|
configuration.read('configuration')
|
||||||
|
|
||||||
@ -142,9 +158,7 @@ if feed_display == "atom":
|
|||||||
blog_title_md5sum = generate_uuid(blog_title)
|
blog_title_md5sum = generate_uuid(blog_title)
|
||||||
title_md5sum = generate_uuid(title)
|
title_md5sum = generate_uuid(title)
|
||||||
|
|
||||||
print 'Content-type: application/atom+xml\n'
|
document_header("atom")
|
||||||
print '<?xml version="1.0" encoding="utf-8"?>'
|
|
||||||
print '<feed xmlns="http://www.w3.org/2005/Atom">'
|
|
||||||
print '<link href="' + blog_url + '/?feed=atom" rel="self" type="application/atom+xml"/>'
|
print '<link href="' + blog_url + '/?feed=atom" rel="self" type="application/atom+xml"/>'
|
||||||
print ' <author>'
|
print ' <author>'
|
||||||
print ' <name>' + blog_title + '</name>'
|
print ' <name>' + blog_title + '</name>'
|
||||||
@ -163,11 +177,7 @@ if feed_display == "atom":
|
|||||||
|
|
||||||
# Generate regular page
|
# Generate regular page
|
||||||
else:
|
else:
|
||||||
|
document_header("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">'
|
|
||||||
print ' <head>'
|
print ' <head>'
|
||||||
print ' <title>' + blog_title + '</title>'
|
print ' <title>' + blog_title + '</title>'
|
||||||
print ' <meta http-equiv="content-type" content="text/html; charset=utf-8" />'
|
print ' <meta http-equiv="content-type" content="text/html; charset=utf-8" />'
|
||||||
|
Loading…
Reference in New Issue
Block a user