git » wikiri » commit 7269a70

Add an about page.

author Alberto Bertogli
2007-12-30 05:54:21 UTC
committer Alberto Bertogli
2007-12-30 05:54:21 UTC
parent 9470b21f9a2a80161c9c4227e06ed071a1dc091b

Add an about page.

Signed-off-by: Alberto Bertogli <albertito@gmail.com>

wikiri.cgi +35 -0

diff --git a/wikiri.cgi b/wikiri.cgi
index 3cfd0e7..1507e62 100755
--- a/wikiri.cgi
+++ b/wikiri.cgi
@@ -149,6 +149,7 @@ default_article_footer = """
 </div>
 <hr/><p/>
 <div class="footer">
+  <a href="%(url)s/about">about</a> |
   <a href="%(url)s/help">help</a> |
   <a href="%(url)s/%(artqname)s/edit">edit this page</a><br/>
 </div>
@@ -229,6 +230,25 @@ quick reference</a>.<p/>
 </div>
 """
 
+default_about_page = """
+<div class="article">
+<h2>About</h2>
+<div class="artbody">
+<p/>
+
+This wiki is powered by
+<a href="http://auriga.wearlab.de/~alb/misc.html">wikiri</a>, a single-file
+blog engine written in <a href="http://python.org">Python</a>, and uses
+<a href="http://docutils.sf.net/rst.html">reStructuredText</a>
+for markup.<p/>
+
+If you have any questions or comments, please send an email to
+<a href="mailto:albertito@gmail.com">Alberto Bertogli</a>.<p/>
+
+</div>
+</div>
+"""
+
 # Default CSS
 default_css = """
 body {
@@ -406,6 +426,12 @@ class Templates (object):
 			return open(p).read() % self.vars
 		return default_help_page % self.vars
 
+	def get_about_page(self):
+		p = self.tpath + '/about_page.html'
+		if os.path.isfile(p):
+			return open(p).read() % self.vars
+		return default_about_page % self.vars
+
 
 
 #
@@ -514,6 +540,13 @@ def render_help():
 	print template.get_help_page()
 	print template.get_main_footer()
 
+def render_about():
+	template = Templates()
+	print 'Content-type: text/html; charset=utf-8\n'
+	print template.get_main_header()
+	print template.get_about_page()
+	print template.get_main_footer()
+
 def render_style():
 	print 'Content-type: text/plain\n'
 	print default_css
@@ -552,6 +585,8 @@ def handle_cgi():
 		render_style()
 	elif artname == 'help':
 		render_help()
+	elif artname == 'about':
+		render_about()
 	elif edit:
 		render_edit(Article(artname))
 	elif save: