constance

Scripts for generating (an earlier obsolete version of) my personal web site
git clone https://code.djc.id.au/git/constance/
commit 55c42fb911d21aa3b913d450a6a37a61b4f33233
parent 817cd2b348d60c4b5ff3c5bba65864620f1bc627
Author: Dan Callaghan <djc@djc.id.au>
Date:   Sun,  8 Jun 2008 15:32:27 +1000

less ridiculous names

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

--HG--
extra : convert_revision : d41177a80e451724b24d87365c521c59091f8479

Diffstat:
Mblog.py | 4++--
Mconfig.py | 4++--
Mtemplates/_commonwrapper.xml | 8++++----
Mtemplates/_entry.xml | 12++++++------
Mtemplates/multiple_atom.xml | 16++++++++--------
Mviewutils.py | 4++--
6 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/blog.py b/blog.py
@@ -136,7 +136,7 @@ class Entry(object):
 				os.access(self.comments_dir, os.R_OK)
 
 	def guid(self):
-		return self._guid or u'%s/%s' % (config.ABSOLUTE_BASE_URL, self.id)
+		return self._guid or u'%s/%s' % (config.ABS_BASE, self.id)
 
 
 class ReadingLogEntry(object):
@@ -156,7 +156,7 @@ class ReadingLogEntry(object):
 		return False
 
 	def guid(self):
-		return self._guid or u'%s/#post-%s' % (config.ABSOLUTE_BASE_URL, self.id)
+		return self._guid or u'%s/#post-%s' % (config.ABS_BASE, self.id)
 
 
 class Comments(object):
diff --git a/config.py b/config.py
@@ -5,8 +5,8 @@ import os
 
 ENTRIES_DIR = os.path.join(os.path.dirname(__file__), u'entries')
 READINGLOG_FILE = os.path.join(os.path.dirname(__file__), u'reading_log')
-RELATIVE_BASE_URL = ''
-ABSOLUTE_BASE_URL = 'http://www.djc.id.au%s' % RELATIVE_BASE_URL
+REL_BASE = ''
+ABS_BASE = 'http://www.djc.id.au%s' % REL_BASE
 BLOG_NAME = u'djc'
 BLOG_AUTHOR = u'djc'
 BLOG_EMAIL = None
diff --git a/templates/_commonwrapper.xml b/templates/_commonwrapper.xml
@@ -15,7 +15,7 @@ import config
 		<title py:if="not title">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="${config.RELATIVE_BASE_URL}/static/css/common.css" />
+        <link rel="stylesheet" type="text/css" href="${config.REL_BASE}/static/css/common.css" />
 		<link rel="alternate" type="application/atom+xml" title="Atom feed" href="?format=atom" />
 	</head>
 </py:match>
@@ -25,20 +25,20 @@ import config
 		<div id="leftwrap">
 			<div class="navwidth">
 				<ul class="navigation">
-					<li class="current_page_item"><a href="${config.RELATIVE_BASE_URL}/">djc</a></li>
+					<li class="current_page_item"><a href="${config.REL_BASE}/">djc</a></li>
 				</ul>
 			</div>
 			<div id="sidebar"><ul>
 				<li id="feeds">
 					<h2>Feeds</h2>
 					<ul id="feed">
-						<li><a rel="alternate" type="application/atom+xml" href="${config.RELATIVE_BASE_URL}/?format=atom" title="Atom feed for posts">Atom posts</a></li>
+						<li><a rel="alternate" type="application/atom+xml" href="${config.REL_BASE}/?format=atom" title="Atom feed for posts">Atom posts</a></li>
 					</ul>
 				</li>
 				<li class="categories">
 					<h2>Categories</h2>
 					<ul>
-						<li py:for="category in all_categories" class="cat-item"><a href="${config.RELATIVE_BASE_URL}/+categories/${category}">${category}</a></li>
+						<li py:for="category in all_categories" class="cat-item"><a href="${config.REL_BASE}/+categories/${category}">${category}</a></li>
 					</ul>
 				</li>
 				<li id="archives">
diff --git a/templates/_entry.xml b/templates/_entry.xml
@@ -10,7 +10,7 @@ from viewutils import mini_markdown, tag_list, category_list
 
 <div class="entry" py:if="'Reading' not in entry.categories">
 
-	<h3 class="entrytitle" id="post-${entry.id}"><a href="${config.RELATIVE_BASE_URL}/${entry.id}" rel="bookmark">${mini_markdown(entry.title)}</a></h3>
+	<h3 class="entrytitle" id="post-${entry.id}"><a href="${config.REL_BASE}/${entry.id}" rel="bookmark">${mini_markdown(entry.title)}</a></h3>
 
 	<div class="entrymeta">
 		Posted ${entry.publication_date.strftime(str('%-1d %B %Y'))}
@@ -19,7 +19,7 @@ from viewutils import mini_markdown, tag_list, category_list
 		</py:if>
 		<py:if test="not show_comments and entry.has_comments()">
 			·
-			<a href="${config.RELATIVE_BASE_URL}/${entry.id}#comments">
+			<a href="${config.REL_BASE}/${entry.id}#comments">
 				Comments
 				<py:if test="len(entry.comments()) > 0">(${len(entry.comments())})</py:if>
 			</a>
@@ -29,7 +29,7 @@ from viewutils import mini_markdown, tag_list, category_list
 	<div class="entrybody">
 		${entry.body}
 		<p py:if="entry.tags">
-			<img src="${config.RELATIVE_BASE_URL}/static/images/tag_blue.png" alt="Tags:" />
+			<img src="${config.REL_BASE}/static/images/tag_blue.png" alt="Tags:" />
 			${tag_list(entry.tags)}
 		</p>
 	</div>
@@ -37,8 +37,8 @@ from viewutils import mini_markdown, tag_list, category_list
 </div>
 
 <span py:def="stars(rating)" py:strip="True">
-	<img src="${config.RELATIVE_BASE_URL}/static/images/star.png" alt="[star]" py:for="_ in range(int(rating))" />
-	<img src="${config.RELATIVE_BASE_URL}/static/images/halfstar.png" alt="[half-star]" py:if="rating > int(rating)" />
+	<img src="${config.REL_BASE}/static/images/star.png" alt="[star]" py:for="_ in range(int(rating))" />
+	<img src="${config.REL_BASE}/static/images/halfstar.png" alt="[half-star]" py:if="rating > int(rating)" />
 </span>
 
 <div class="entry readinglog" py:if="'Reading' in entry.categories">
@@ -51,7 +51,7 @@ from viewutils import mini_markdown, tag_list, category_list
 	<div class="entrymeta">
 		Posted ${entry.publication_date.strftime(str('%-1d %B %Y'))}
 		<py:if test="entry.categories">
-			in <a py:for="category in entry.categories" href="${config.RELATIVE_BASE_URL}/+categories/${category}">${category}</a>
+			in <a py:for="category in entry.categories" href="${config.REL_BASE}/+categories/${category}">${category}</a>
 		</py:if>
 		<py:if test="entry.rating">
 			· ${stars(entry.rating)}
diff --git a/templates/multiple_atom.xml b/templates/multiple_atom.xml
@@ -9,10 +9,10 @@ from viewutils import tag_list
 ATOM_TIME_FORMAT = str('%Y-%m-%dT%H:%M:%S+10:00')
 ?>
 
-<id>${config.ABSOLUTE_BASE_URL}/?format=atom</id>
+<id>${config.ABS_BASE}/?format=atom</id>
 <title type="text">${config.BLOG_NAME}</title>
-<link rel="self" type="application/atom+xml" href="${config.ABSOLUTE_BASE_URL}/?format=atom" />
-<link rel="alternate" href="${config.ABSOLUTE_BASE_URL}/" />
+<link rel="self" type="application/atom+xml" href="${config.ABS_BASE}/?format=atom" />
+<link rel="alternate" href="${config.ABS_BASE}/" />
 <generator>Dan’s blogging engine</generator>
 <updated>${feed_updated.strftime(ATOM_TIME_FORMAT)}</updated>
 
@@ -24,15 +24,15 @@ ATOM_TIME_FORMAT = str('%Y-%m-%dT%H:%M:%S+10:00')
 		<name>${config.BLOG_AUTHOR}</name>
 		<email py:if="config.BLOG_EMAIL">${config.BLOG_EMAIL}</email>
 	</author>
-	<category py:for="category in entry.categories" scheme="${config.ABSOLUTE_BASE_URL}/+categories/" term="${category}" />
-	<category py:for="tag in entry.tags" scheme="${config.ABSOLUTE_BASE_URL}/+tags/" term="${tag}" />
+	<category py:for="category in entry.categories" scheme="${config.ABS_BASE}/+categories/" term="${category}" />
+	<category py:for="tag in entry.tags" scheme="${config.ABS_BASE}/+tags/" term="${tag}" />
 	<py:if test="'Reading' not in entry.categories">
-		<link rel="alternate" href="${config.ABSOLUTE_BASE_URL}/${entry.id}" />
+		<link rel="alternate" href="${config.ABS_BASE}/${entry.id}" />
 		<title type="text">${entry.title}</title>
-		<content type="xhtml" xml:base="${config.ABSOLUTE_BASE_URL}/${entry.id}"><xhtml:div>
+		<content type="xhtml" xml:base="${config.ABS_BASE}/${entry.id}"><xhtml:div>
 			${entry.body}
 			<p py:if="entry.tags">
-				<img src="${config.ABSOLUTE_BASE_URL}/static/images/tag_blue.png" alt="Tags:" />
+				<img src="${config.ABS_BASE}/static/images/tag_blue.png" alt="Tags:" />
 				${tag_list(entry.tags)}
 			</p>
 		</xhtml:div></content>
diff --git a/viewutils.py b/viewutils.py
@@ -12,10 +12,10 @@ def mini_markdown(s):
 
 def category_list(categories):
 	return genshi.Markup(u', ').join(
-			genshi.Markup(u'<a href="%s/+categories/%s">%s</a>' % (config.RELATIVE_BASE_URL, category, category)) 
+			genshi.Markup(u'<a href="%s/+categories/%s">%s</a>' % (config.REL_BASE, category, category)) 
 			for category in categories)
 
 def tag_list(tags):
 	return genshi.Markup(u', ').join(
-			genshi.Markup(u'<a rel="tag" href="%s/+tags/%s">%s</a>' % (config.RELATIVE_BASE_URL, tag, tag)) 
+			genshi.Markup(u'<a rel="tag" href="%s/+tags/%s">%s</a>' % (config.REL_BASE, tag, tag)) 
 			for tag in tags)