changeset 0:e6b1128bc065

import
author Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
date Fri, 30 Jan 2009 01:06:19 -0500
parents
children 90ac20f6813e
files cat.cgi common-foot.sh common-head.sh index.cgi story.cgi templates/footer.html templates/header.html templates/sidebar-archive-item.html templates/sidebar-bottom.html templates/sidebar-cat-item.html templates/sidebar-middle.html templates/sidebar-top.html templates/story-bottom.html templates/story-cat-item.html templates/story-middle.html templates/story-top.html
diffstat 16 files changed, 288 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cat.cgi	Fri Jan 30 01:06:19 2009 -0500
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+. common-head.sh
+
+##########################
+
+catid=`echo "$PATH_INFO" | sed -e 's,^/,,'`
+
+cat templates/header.html | sed -e 's|@@TITLE@@|$catid|'
+
+for postid in `ls data/by-category/$catid/ | sort -r` ; do
+	[ -d "data/by-category/$catid/$postid" ] && continue
+
+	fn="data/posts/$postid/post.txt"
+
+	cat templates/story-top.html | sed -e "
+s|@@POSTID@@|`basename $postid`|g
+s|@@POSTDATE@@|`get_date "$fn"`|g
+s|@@TITLE@@|`get_xattr post_title "$fn"`|g
+"
+
+	for catname in `get_xattr post_cats "$fn" | sed -e 's|,| |g'` ; do
+		cat templates/story-cat-item.html | sed -e "
+s|@@CATNAME@@|$catname|g
+	"
+	done
+
+	cat templates/story-middle.html | sed -e "
+s|@@POSTTIME@@|`get_time "$fn"`|g
+	"
+
+	cat_post "$fn"
+
+	cat templates/story-bottom.html
+done
+
+##########################
+
+. common-foot.sh
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common-foot.sh	Fri Jan 30 01:06:19 2009 -0500
@@ -0,0 +1,25 @@
+cat templates/footer.html
+
+cat templates/sidebar-top.html
+for catname in `find data/by-category/ -mindepth 1 -type d | sort` ; do
+	shortcatname=`echo $catname | sed -e 's,data/by-category/,,'`
+
+	catdesc=`get_xattr category_desc "$catname"`
+	[ -z "$catdesc" ] && catdesc="View all posts filed under $shortcatname"
+
+	cat templates/sidebar-cat-item.html | sed -e "
+s|@@CATNAME@@|$shortcatname|g
+s|@@CATDESC@@|$catdesc|g
+"
+done
+cat templates/sidebar-middle.html
+for archname in data/by-month/* ; do
+	archname=`basename $archname`
+
+	cat templates/sidebar-archive-item.html | sed -e "
+s|@@ARCHNAME@@|$archname|g
+s|@@ARCHDESC@@|`arch_date $archname`|g
+"
+done
+
+cat templates/sidebar-bottom.html
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common-head.sh	Fri Jan 30 01:06:19 2009 -0500
@@ -0,0 +1,57 @@
+# usage: get_xattr <attrname> <filename>
+get_xattr()
+{
+	cat "$2_xattrs/$1" 2> /dev/null
+}
+
+# usage: get_date <filename>
+get_date()
+{
+	date "+%B %e, %Y" -d "`get_xattr post_time "$1"`"
+}
+
+# usage: get_time <filename>
+get_time()
+{
+	date "+%H:%M" -d "`get_xattr post_time "$1"`"
+}
+
+# usage: arch_date <YYYYMM>
+arch_date()
+{
+	y=`expr substr "$1" 1 4`
+
+	case `expr substr "$1" 5 2` in
+		01) m="january" ;;
+		02) m="february" ;;
+		03) m="march" ;;
+		04) m="april" ;;
+		05) m="may" ;;
+		06) m="june" ;;
+		07) m="july" ;;
+		08) m="august" ;;
+		09) m="september" ;;
+		10) m="october" ;;
+		11) m="november" ;;
+		12) m="december" ;;
+		*) m="unknown" ;;
+	esac
+
+	echo "$m $y"
+}
+
+# usage: cat_post <filename>
+cat_post()
+{
+#/^<!--more-->$/ { exit; }
+	cat "$1" | awk '
+BEGIN { par=1 }
+(par) { print "<p>"; par=0 }
+{ print $0 }
+/^$/ { print "</p>"; par=1 }
+END { if (!par) print "</p>" }
+'
+}
+
+echo "Content-type: text/html"
+echo ""
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/index.cgi	Fri Jan 30 01:06:19 2009 -0500
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+. common-head.sh
+
+##########################
+
+cat templates/header.html | sed -e 's|@@TITLE@@|Blahg|'
+
+cnt=0
+
+for postid in `ls data/posts/ | sort -rn` ; do
+	cnt=$(($cnt + 1))
+	[ $cnt -gt 5 ] && break
+
+	fn="data/posts/$postid/post.txt"
+
+	cat templates/story-top.html | sed -e "
+s|@@POSTID@@|`basename $postid`|g
+s|@@POSTDATE@@|`get_date "$fn"`|g
+s|@@TITLE@@|`get_xattr post_title "$fn"`|g
+"
+
+	for catname in `get_xattr post_cats "$fn" | sed -e 's|,| |g'` ; do
+		cat templates/story-cat-item.html | sed -e "
+s|@@CATNAME@@|$catname|g
+	"
+	done
+
+	cat templates/story-middle.html | sed -e "
+s|@@POSTTIME@@|`get_time "$fn"`|g
+	"
+
+	cat_post "$fn"
+
+	cat templates/story-bottom.html
+done
+
+##########################
+
+. common-foot.sh
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/story.cgi	Fri Jan 30 01:06:19 2009 -0500
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+. common-head.sh
+
+##########################
+
+postid=`echo "$PATH_INFO" | sed -e 's,^/,,'`
+
+fn="data/posts/$postid/post.txt"
+
+title=`get_xattr post_title "$fn"`
+postdate=`get_date "$fn"`
+posttime=`get_time "$fn"`
+
+(
+cat templates/header.html
+cat templates/story-top.html
+) | sed -e "
+s|@@POSTID@@|$postid|g
+s|@@POSTDATE@@|$postdate|g
+s|@@TITLE@@|$title|g
+"
+
+for catname in `get_xattr post_cats "$fn" | sed -e 's|,| |g'` ; do
+	cat templates/story-cat-item.html | sed -e "
+s|@@CATNAME@@|$catname|g
+"
+done
+
+cat templates/story-middle.html | sed -e "
+s|@@POSTTIME@@|$posttime|g
+"
+
+cat_post "$fn"
+
+cat templates/story-bottom.html
+
+##########################
+
+. common-foot.sh
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/footer.html	Fri Jan 30 01:06:19 2009 -0500
@@ -0,0 +1,10 @@
+
+<!-- begin footer -->
+</div>
+
+<p class="credit"> <cite>Powered by <a href='http://www.josefsipek.net/' title='Powered by a pile of shell'><strong>a pile of shell scripts</strong></a></cite></p>
+
+</div>
+
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/header.html	Fri Jan 30 01:06:19 2009 -0500
@@ -0,0 +1,24 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+	<title>Josef &#8220;Jeff&#8221; Sipek &raquo; @@TITLE@@</title>
+	<meta name="generator" content="WordPress 2.7-bleeding" /> <!-- leave this for stats please -->
+	<style type="text/css" media="screen">
+		@import url( http://josefsipek.net/blahg/wp-content/themes/jsn/style.css );
+	</style>
+	<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="http://josefsipek.net/blahg/?feed=rss2" />
+	<link rel="alternate" type="text/xml" title="RSS .92" href="http://josefsipek.net/blahg/?feed=rss" />
+
+	<link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="http://josefsipek.net/blahg/?feed=atom" />
+<meta name="generator" content="WordPress 2.7-bleeding" />
+
+</head>
+<body>
+
+<div id="rap">
+<h1 id="header"><a href="http://josefsipek.net/cgi-bin/blahg-test/index.cgi">Josef &#8220;Jeff&#8221; Sipek</a></h1>
+
+<div id="content">
+<!-- end header -->
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/sidebar-archive-item.html	Fri Jan 30 01:06:19 2009 -0500
@@ -0,0 +1,1 @@
+	<li><a href='http://josefsipek.net/cgi-bin/blahg-test/arch.cgi/@@ARCHNAME@@' title='@@ARCHDESC@@'>@@ARCHDESC@@</a></li>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/sidebar-bottom.html	Fri Jan 30 01:06:19 2009 -0500
@@ -0,0 +1,9 @@
+	</ul>
+
+ </li>
+
+</ul>
+
+</div>
+<!-- end sidebar -->
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/sidebar-cat-item.html	Fri Jan 30 01:06:19 2009 -0500
@@ -0,0 +1,1 @@
+	<li class="cat-item cat-item-25"><a href="http://josefsipek.net/cgi-bin/blahg-test/cat.cgi/@@CATNAME@@" title="@@CATDESC@@">@@CATNAME@@</a></li>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/sidebar-middle.html	Fri Jan 30 01:06:19 2009 -0500
@@ -0,0 +1,2 @@
+</ul></li>
+ <li id="archives">Archives:	<ul>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/sidebar-top.html	Fri Jan 30 01:06:19 2009 -0500
@@ -0,0 +1,25 @@
+<!-- begin sidebar -->
+<div id="menu">
+
+<ul>
+		<li id="linkcat-32" class="linkcat">
+
+	<ul class='xoxo blogroll'>
+<li><a href="http://www.martianrock.com/">John Palmieri</a></li>
+<li><a href="http://www.markdrago.com/blog/">Mark Drago</a></li>
+<li><a href="http://kernelpanic.blogspot.com">Nur Hussein</a></li>
+<li><a href="http://www.supertom.com/">Tom Melendez</a></li>
+<li><a href="http://www.zwane.com/blog/">Zwane Mwaikambo</a></li>
+
+	</ul>
+</li>
+<li id="linkcat-33" class="linkcat">
+
+	<ul class='xoxo blogroll'>
+<li><a href="http://planet.lilug.org">Planet LILUG</a></li>
+<li><a href="http://www.offtopic2.net">Planet Offtopic2</a></li>
+
+	</ul>
+</li>
+
+<li class="categories">Categories:<ul>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/story-bottom.html	Fri Jan 30 01:06:19 2009 -0500
@@ -0,0 +1,7 @@
+	</div>
+
+	<div class="feedback">
+					</div>
+
+</div>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/story-cat-item.html	Fri Jan 30 01:06:19 2009 -0500
@@ -0,0 +1,1 @@
+<a href="http://josefsipek.net/cgi-bin/blahg-test/cat.cgi/@@CATNAME@@" title="View all posts in @@CATNAME@@" rel="category">@@CATNAME@@</a>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/story-middle.html	Fri Jan 30 01:06:19 2009 -0500
@@ -0,0 +1,3 @@
+&#8212;  JeffPC @ @@POSTTIME@@</div>
+
+	<div class="storycontent">
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/story-top.html	Fri Jan 30 01:06:19 2009 -0500
@@ -0,0 +1,4 @@
+<h2>@@POSTDATE@@</h2>
+<div class="post" id="post-@@POSTID@@">
+	 <h3 class="storytitle"><a href="http://josefsipek.net/cgi-bin/blahg-test/story.cgi/@@POSTID@@" rel="bookmark">@@TITLE@@</a></h3>
+	<div class="meta">Filed under: