diff options
author | Stefan Ritter <xeno@thehappy.de> | 2009-04-30 10:26:56 +0200 |
---|---|---|
committer | Stefan Ritter <xeno@thehappy.de> | 2009-04-30 10:26:56 +0200 |
commit | 708334290272a0bd4c1e17a2cee0e0bf35d14947 (patch) | |
tree | 87cb22727d89d2b2d793826b43e43b5d57eee0a8 /blogthon.cgi | |
parent | d62b62874b6735cc5aa93b5e057c489e468610b6 (diff) |
Added a document_header function
Diffstat (limited to 'blogthon.cgi')
-rwxr-xr-x | blogthon.cgi | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/blogthon.cgi b/blogthon.cgi index f5d68d1..8cdfa5a 100755 --- a/blogthon.cgi +++ b/blogthon.cgi @@ -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" />' |