constance

Scripts for generating (an earlier obsolete version of) my personal web site
git clone https://code.djc.id.au/git/constance/
commit 4bc57b5fe8bce2e1ca1a98218a4b17b6cee3d6c7
parent 106057d9f532f6edb726942b3dd2e92970d5248c
Author: Dan Callaghan <djc@djc.id.au>
Date:   Thu,  5 Jun 2008 22:38:49 +1000

working posts

committer: Dan Callaghan <djc@djc.id.au>

--HG--
extra : convert_revision : 48b37f5b9f7789b8fa3ee1e91432770584cd9511

Diffstat:
Mapp.py | 3++-
Mblog.py | 2+-
Astatic/css/common.css | 432+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Astatic/images/bg.gif | 0
Astatic/images/feed-icon-16x16.png | 0
Astatic/images/tag_blue.png | 0
Atemplates/_commonwrapper.xml | 92+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mtemplates/post.xml | 66++++++++++++++++++++++++++++++++++--------------------------------
8 files changed, 561 insertions(+), 34 deletions(-)
diff --git a/app.py b/app.py
@@ -11,6 +11,7 @@ template_loader = TemplateLoader(os.path.join(BASE_DIR, 'templates'), auto_reloa
 class BlogApplication(RegexApplication):
 
 	urls = [(r'^$', 'index'), 
+			(r'^feed$', 'feed'), 
 			(r'^([^/]+)/?$', 'post')]
 	charset = 'utf-8'
 
@@ -22,7 +23,7 @@ class BlogApplication(RegexApplication):
 		return HttpResponse(rendered, [('Content-Type', 'text/html')], 200)
 
 app = BlogApplication
-app = StaticExports(app, {'static': os.path.join(BASE_DIR, 'static')})
+app = StaticExports(app, {'/static': os.path.join(BASE_DIR, 'static')})
 
 if __name__ == '__main__':
 	execute(app)
diff --git a/blog.py b/blog.py
@@ -4,7 +4,7 @@ import markdown
 
 
 BASE_DIR = '.'
-BASE_URL = '/blog'
+BASE_URL = ''
 
 
 def cleanup_metadata(meta):
diff --git a/static/css/common.css b/static/css/common.css
@@ -0,0 +1,432 @@
+*
+{
+	margin: 0;
+	padding: 0;
+}
+body
+{
+	border-top:10px solid #0D0F10;
+	background: #282C2F url(../images/bg.gif) repeat-y left;
+	color: #fff;
+	font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, Helvetica, Verdana, sans-serif;
+	margin: 0;
+	padding: 0;
+}
+p {
+	margin: 1.1em 0;
+}
+div.comment-number {
+	float: right;
+	color: #999;
+	width: 40px;
+	text-align: right;
+}
+.class_comment1 { background: #E9E9EA; border: 1px solid #E0DEDE; }
+.class_comment2 { background: #F4F3F3; border: 1px solid #E0DEDE; }
+#leftwrap
+{
+	background-color: #202326;
+	display: inline;
+	float: left;
+	margin: 0;
+	width: 250px;
+	padding: 20px;
+	overflow: hidden;
+	position: relative;
+	text-align: right;
+	font-size: smaller;
+}
+.navwidth
+{
+	overflow: hidden;
+}
+#adsense
+{
+	padding: 0 0 10px;
+}
+h1#blogname
+{
+	color: #C7FF68;
+	font-size: 2em;
+}
+
+#content
+{
+	background: #282C2F;
+	color: #fff;
+	display: inline;
+	float: left;
+	padding: 1.5em;
+	max-width: 40em;
+	width: auto !important;
+	width: 40em;
+	line-height: 2.7ex;
+}
+.alert
+{
+	background: #FFF6BF;
+	border-bottom: 2px solid #FFD324;
+	border-top: 2px solid #FFD324;
+	margin: 10px auto;
+	padding: 5px 20px 5px 20px;
+}
+#sidebar
+{
+	width: 250px;
+	display: inline;
+	float: left;
+	margin-top: 15px;
+	text-align: right;
+}
+#footer
+{
+	clear: both;
+	margin: 0 auto;
+	background:#0D0F10;
+	padding: 1.75em;
+	text-align: center;
+}
+
+h1, h2, h3, h4 {
+	line-height: 2.3ex;
+}
+h2
+{
+	color: #C7FF68;
+}
+h4
+{
+	color: #C7FF68;
+}
+.themes
+{
+	padding: 25px 0;
+}
+ol#commentlist
+{
+	list-style: none;
+	padding: 0;
+}
+.commenttext
+{
+	background: #303538 url(../images/comm.gif) no-repeat left top;
+	min-height: 90px;
+}
+.commenttext .authorcomment
+{
+	background: #202326;
+	margin-top: 3px;
+	min-height: 90px;
+	padding: 10px;
+}
+* html .commenttext
+{
+	height: 90px;
+	overflow: visible;
+}
+.commentp
+{
+	margin-left: 5px;
+	padding: 21px 12px 10px 10px;
+}
+.commenttext p
+{
+	margin: 0 0 15px;
+	padding: 0;
+}
+#commentblock ol li
+{
+	margin-bottom: 30px;
+}
+.gravatar
+{
+	background:#202326;
+	display: inline;
+	float: left;
+	height: 40px;
+	margin: 24px 0 0 9px;
+	padding: 5px;
+	width: 40px;
+}
+
+#commentsform p
+{
+	margin-bottom: 5px;
+	margin-top: 5px;
+}
+a img
+{
+	border: 0;
+}
+h3.entrytitle,h3
+{
+	color: #fff;
+	display: block;
+	font-size: 1.75em;
+	font-weight: 400;
+	margin: 0;
+	padding-bottom: 3px;
+}
+h3.entrytitle a,h3.entrytitle a:visited,h3 a
+{
+	color: #fff;
+	font-weight: 400;
+	text-decoration: none;
+}
+h3.entrytitle a:hover,h3 a:hover
+{
+	color: #C7FF68;
+	text-decoration: none;
+}
+.entry
+{
+	padding: 1em 0 0 0;
+}
+.readinglog h3.entrytitle {
+	font-size: 1.25em;
+}
+.readinglog h3.entrytitle a {
+	font-style: italic;
+}
+.entrybody img
+{
+
+}
+.entrybody p
+{
+	text-align: left;
+}
+.entrybody
+{
+	border-bottom: 1px solid #202326;
+}
+
+.entrymeta
+{
+	color: #737B81;
+	margin: 0.2em 0;
+}
+.entrymeta-single
+{
+	color: #737B81;
+	margin: 0.5em 0;
+}
+h2.archives
+{
+	color: #737B81;
+	font-style: italic;
+	margin-bottom: 1em;
+	text-align: left;
+}
+#sidebar ul#feed
+{
+	list-style: none;
+	margin: 15px 0;
+	padding: 0;
+}
+#sidebar ul#feed li
+{
+	padding-bottom: 3px;
+	padding-top: 3px;
+}
+#sidebar ul#feed li a
+{
+	background: url(../images/feed-icon-16x16.png) no-repeat left 50%;
+	border-style: none;
+	padding-left: 25px;
+}
+.entrybody ul,.entrybody ol
+{
+	margin-bottom: 10px;
+	margin-left: 30px;
+	margin-top: 10px;
+}
+#commentlink a:link, #commentlink a:visited {
+	color:#C7FF68;
+}
+
+.entrybody li
+{
+	padding-bottom: 2px;
+	padding-top: 2px;
+}
+.entrybody ul li
+{
+	list-style:square;
+}
+#sidebar h2
+{
+	color: #6CF;
+	font-size: 1em;
+	font-weight: normal;
+	margin: 0 0 5px 0;
+	text-transform: uppercase;
+}
+#sidebar h2 a
+{
+	color: #6CF;
+}
+.sidebarbg
+{
+	background-color: #eee;
+}
+#sidebar p
+{
+	margin-bottom: 10px;
+	margin-top: 10px;
+}
+#sidebar ul
+{
+	list-style: none;
+	margin: 0 0 20px 0;
+}
+#sidebar li
+{
+	list-style: none;
+}
+#sidebar li a:link, #sidebar li a:visited
+{
+color:#fff;
+}
+#sidebar li a:hover, #sidebar li a:active
+{
+color:#C7FF68;
+}
+
+
+
+#searchdiv
+{
+font-family:"Lucida Grande","Lucida Sans Unicode",Tahoma, Helvetica, Verdana, sans-serif;
+	padding: 0;
+}
+
+#searchdiv input
+{
+background:#181B1C;
+font-family:"Lucida Grande","Lucida Sans Unicode",Tahoma, Helvetica, Verdana, sans-serif;
+border:1px solid #181B1C;
+}
+
+.navigation
+{
+	padding-top: 1px;
+	text-transform:uppercase;
+	text-align: right;
+}
+.navigation a:link, .navigation a:visited
+{
+	color: #3E4449;
+	font-size: 1.5em;
+	list-style: none;
+	margin: 0;
+}
+.navigation a:hover
+{
+	color: #737B81;
+	list-style: none;
+	margin: 0;
+	padding: 2px 0;
+	text-decoration: none;
+}
+.current_page_item a:link,.current_page_item a:visited
+{
+	color: #C7FF68;
+	list-style: none;
+	margin: 0;
+	padding: 2px 0;
+	text-decoration: none;
+}
+.current_page_item a:hover
+{
+	list-style: none;
+	margin: 0;
+	padding: 2px 0;
+	text-decoration: none;
+}
+.navigation ul
+{
+	list-style: none;
+	margin: 0;
+	padding: 0;
+}
+.navigation li
+{
+	list-style: none;
+	margin: 0;
+	padding: 0;
+padding-bottom:2px;
+}
+blockquote
+{
+	border-left: 2px solid #535B61;
+	color: #535B61;
+	font-style: italic;
+	margin: 0 25px;
+	padding-left: 8px;
+}
+h1,h2,h3,h4,#comments
+{
+	font-weight: 400;
+}
+h3,#commentblock h2
+{
+	padding-bottom: 20px;
+}
+.entrybody a:link,.entrybody a:visited
+{
+	color: #6CF;
+	font-weight: 400;
+	text-decoration: none;
+}
+.entrybody a:active,.entrybody a:hover
+{
+	color: #6CF;
+	font-weight: 400;
+	text-decoration: underline;
+}
+a,a:visited,a:hover
+{
+	color: #6CF;
+	text-decoration: none;
+}
+
+a:hover
+{
+	text-decoration: underline;
+}
+.subscribe img
+{
+	padding-bottom: 3px;
+	padding-right: 3px;
+}
+#rssicon
+{
+	padding-bottom: 10px;
+}
+.technorati {
+display:none;
+}
+
+ul.searchbg {
+background-color:#fff;
+}
+
+code {
+	font-family: monospace;
+}
+pre {
+	margin: 0 2em;
+	padding: 0.5em 1em;
+}
+
+p.UTWPrimaryTags {
+}
+p.UTWPrimaryTags img {
+	margin-right: 0.3em;
+}
+
+.readinglog h3 {
+	padding: 0 0 0 22px;
+	background: url(../images/book_open.png) no-repeat center left;
+}
diff --git a/static/images/bg.gif b/static/images/bg.gif
Binary files differ.
diff --git a/static/images/feed-icon-16x16.png b/static/images/feed-icon-16x16.png
Binary files differ.
diff --git a/static/images/tag_blue.png b/static/images/tag_blue.png
Binary files differ.
diff --git a/templates/_commonwrapper.xml b/templates/_commonwrapper.xml
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<div xmlns="http://www.w3.org/1999/xhtml"
+     xmlns:py="http://genshi.edgewall.org/"
+     xmlns:xi="http://www.w3.org/2001/XInclude"
+     py:strip="True">
+
+<?python
+from blog import BASE_URL
+?>
+
+<py:match path="head">
+	<head profile="http://gmpg.org/xfn/11" py:attrs="select('@*')">
+		${select('./*[local-name() != "title"]')}
+        <title>${select('title[1]/text()')} - djc</title>
+        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+		<meta name="generator" content="Dan’s blogging engine" />
+        <link rel="stylesheet" type="text/css" href="${BASE_URL}/static/css/common.css" />
+		<link rel="alternate" type="application/atom+xml" title="Atom feed" href="${BASE_URL}/feed?format=atom" />
+	</head>
+</py:match>
+
+<py:match path="body">
+	<body py:attrs="select('@*')">
+		<div id="leftwrap">
+			<div class="navwidth">
+				<ul class="navigation">
+					<li><a href="${BASE_URL}/">djc</a></li>
+				</ul>
+			</div>
+			<div id="sidebar"><ul>
+				<li id="feeds">
+					<h2>Feeds</h2>
+					<ul id="feed">
+						<li><a href="${BASE_URL}/feed?format=atom" title="Atom feed for posts">Atom posts</a></li>
+					</ul>
+				</li>
+				<li class="categories">
+					<h2>Categories</h2>
+					XXX TODO
+				</li>
+				<li id="archives">
+					<h2>Archives</h2>
+					XXX TODO
+				</li>
+				<li class="linkcat">
+					<h2>Egomania</h2>
+					<ul>
+						<li><a href="http://www.librarything.com/profile/danc86" rel="me" title="My library">Books</a></li>
+						<li><a href="http://www.imdb.com/mymovies/list?l=1447320&amp;s=reverse_uservote" rel="me" title="My IMDB voting history">Movies</a></li>
+						<li><a href="http://www.last.fm/user/danc86" rel="me" title="My last.fm profile">Music</a></li>
+						<li><a href="http://flickr.com/photos/danc86" rel="me" title="My Flickr account">Photos</a></li>
+					</ul>
+				</li>
+				<li class="linkcat">
+					<h2>Randoms</h2>
+					<ul>
+						<li><a href="http://www.houseofzeus.com/notblog/" rel="friend met">flash</a></li>
+						<li><a href="http://protiotype.net/" rel="friend met">io</a></li>
+						<li><a href="http://www.sjkingston.com/" rel="friend met crush">Kingo</a></li>
+						<li><a href="http://mondodev.net/" rel="friend met">mondo</a></li>
+						<li><a href="http://myspace.com/nath520" rel="friend met" title="Fellow SPLC loser">Nath</a></li>
+						<li><a href="http://myspace.com/reesb" rel="friend met">ReesB</a></li>
+						<li><a href="http://www.train-meditations.com/" rel="friend met">Shaun</a></li>
+						<li><a href="http://koffein.net/" rel="friend met crush">stl</a></li>
+						<li><a href="http://myspace.com/heartfelt4ever" rel="friend met">Zeke</a></li>
+					</ul>
+				</li>
+				<li class="linkcat">
+					<h2>Recommended reading</h2>
+					<ul>
+						<li><a href="http://www.aaronsw.com/weblog/">Aaron Swartz</a></li>
+						<li><a href="http://aussielicious.blogspot.com/">aussielicious</a></li>
+						<li><a href="http://www.boingboing.net/">Boing Boing</a></li>
+						<li><a href="http://www.qwantz.com/">Dinosaur Comics</a></li>
+						<li><a href="http://untoward.livejournal.com/">Joey Comeau</a></li>
+						<li><a href="http://reversecowgirlblog.blogspot.com/">Reverse Cowgirl</a></li>
+						<li><a href="http://xkcd.com/">xkcd</a></li>
+					</ul>
+				</li>
+			</ul></div>
+		</div>
+		<div id="content">
+			${select('./*')}
+		</div>
+		<div id="footer">
+			<p>Design derived from <a href="http://www.wpzone.net/">Elite by Stephen Reinhardt</a></p>
+		</div>
+	</body>
+</py:match>
+
+</div>
+
diff --git a/templates/post.xml b/templates/post.xml
@@ -1,47 +1,49 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml"
-      xmlns:py="http://genshi.edgewall.org/">
+      xmlns:py="http://genshi.edgewall.org/"
+	  xmlns:xi="http://www.w3.org/2001/XInclude"
+	  lang="en-AU">
+<xi:include href="_commonwrapper.xml" />
+
 <head>
   <title>${entry.title}</title>
 </head>
 <body>
 
-<div id="content">
-  <div class="entry">
+<div class="entry">
 
-    <h3 class="entrytitle" id="post-${entry.id}"><a href="${entry.permalink()}" rel="bookmark">${entry.title}</a></h3>
+	<h3 class="entrytitle" id="post-${entry.id}"><a href="${entry.permalink()}" rel="bookmark">${entry.title}</a></h3>
 
-    <div class="entrymeta">
-      Posted ${entry.publication_date.strftime(str('%-1d %B %Y'))}
-	  <py:if test="entry.categories">
-	    in ${', '.join(entry.categories)}
-	  </py:if>
-    </div>
-	  
-    <div class="entrybody">
-      ${Markup(entry.body)}
-	  <p py:if="entry.tags">
-	    <img src="${BASE_URL}/templates/images/tag_blue.png" alt="Tags:" /> ${', '.join(entry.tags)}
-	  </p>
-    </div>
+	<div class="entrymeta">
+		Posted ${entry.publication_date.strftime(str('%-1d %B %Y'))}
+		<py:if test="entry.categories">
+			in ${', '.join(entry.categories)}
+		</py:if>
+	</div>
+  
+	<div class="entrybody">
+		${Markup(entry.body)}
+		<p py:if="entry.tags">
+			<img src="${BASE_URL}/static/images/tag_blue.png" alt="Tags:" /> ${', '.join(entry.tags)}
+		</p>
+	</div>
 
-  </div>
+</div>
 
-  <div id="commentblock" py:if="entry.has_comments()">
+<div id="commentblock" py:if="entry.has_comments()">
     <ol class="commentlist" id="commentlist">
-      <li py:for="comment in entry.comments()"
-          class="(comment.id % 2) and 'alt' or 'standard'"
-          id="comment-${comment.id}">
-        <div class="commentmeta">
-          ${comment.author_link()}
-          on ${comment.date.strftime(str('F j, Y'))}
-        </div>
-        <div class="commentbody">
-          ${comment.body}
-        </div>
-      </li>
-    </ol>
-  </div>
+		<li py:for="comment in entry.comments()"
+			class="(comment.id % 2) and 'alt' or 'standard'"
+			id="comment-${comment.id}">
+			<div class="commentmeta">
+				${comment.author_link()}
+				on ${comment.date.strftime(str('F j, Y'))}
+			</div>
+			<div class="commentbody">
+				${comment.body}
+			</div>
+		</li>
+	</ol>
 </div>
 
 </body>