diff options
author | Nick White <git@njw.me.uk> | 2010-04-09 16:27:54 +0100 |
---|---|---|
committer | Nick White <git@njw.me.uk> | 2010-04-09 16:27:54 +0100 |
commit | a888e49311cb1a14799b9534cc183c5af2d25bc2 (patch) | |
tree | db39f87c074d98bd24be43eb1f3db5433aa57036 | |
parent | 573cb4fa5b8c1bff7cb379dc7d76982b9333d10c (diff) | |
download | njw-website-a888e49311cb1a14799b9534cc183c5af2d25bc2.tar.bz2 njw-website-a888e49311cb1a14799b9534cc183c5af2d25bc2.zip |
Switch to n3 for rss format
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | Makefile | 11 | ||||
-rw-r--r-- | includes/header-index.xml | 2 | ||||
-rwxr-xr-x | makerss.sh | 58 |
4 files changed, 34 insertions, 39 deletions
@@ -1,5 +1,5 @@ *.xml *.gz -rss.rdf +rss.n3 !includes/*.xml @@ -1,9 +1,10 @@ # See COPYING file for copyright, license and warranty details. -SITENAME=njw.me.uk +SITENAME=http://njw.me.uk +FOAF=http://njw.me.uk/foaf\#i MARKDOWN=smu -RSS=rss.rdf +RSS=rss.n3 PAGES=$(shell find . -name '*.txt' ! -name 'robots.txt' ! -name $(RSS)) EXTRAS=$(shell find . -name '*.css') foaf.n3 TARGETS=$(PAGES:.txt=.xml) $(RSS) @@ -13,9 +14,9 @@ all: $(TARGETS) $(GZIP) $(TARGETS): includes/header.xml includes/footer.xml -$(RSS): $(PAGES) +$(RSS): $(PAGES) makerss.sh @echo making $@ - @sh makerss.sh $(SITENAME) $* > $@ + @sh makerss.sh $(SITENAME) $(FOAF) $* > $@ index.xml: index.txt includes/header-index.xml includes/footer.xml @echo making $@ @@ -30,7 +31,7 @@ index.xml: index.txt includes/header-index.xml includes/footer.xml @sed "s/MODDATE/`ls -lc $<|awk '{print $$6}'`/" < includes/footer.xml >> $@ # bug: if any target changes, all are recompressed -$(GZIP): $(TARGETS) +$(GZIP): $(TARGETS) $(EXTRAS) @echo compressing $* @gzip < $* >> $@ diff --git a/includes/header-index.xml b/includes/header-index.xml index d692a16..bdb218b 100644 --- a/includes/header-index.xml +++ b/includes/header-index.xml @@ -7,7 +7,7 @@ <title>TITLE</title> <link rel="stylesheet" type="text/css" href="/includes/style" /> <link rel="icon" href="/graphics/candles.ico" /> - <link rel="alternate" type="application/rdf+xml" href="/rss" /> + <link rel="alternate" title="rss" type="application/rdf+n3" href="/rss" /> <link rel="meta" title="foaf" type="application/rdf+n3" href="/foaf#i" /> <link rel="openid.server" href="http://certifi.ca/_serve" /> <link rel="openid.delegate" href="http://certifi.ca/njw" /> @@ -1,48 +1,42 @@ #!/bin/sh -[[ "$1" ]] && siteurl="http://${1}" || siteurl="" -[[ "$2" ]] && rssuri="${siteurl}/$2" || rssuri="" +[[ "$1" ]] && siteurl="$1" || siteurl="" +[[ "$2" ]] && creator="$2" || creator="" items=`find . -name '*.txt' ! -name 'robots.txt' | sed 's/^\.//g' | sed 's/\.txt$//g'` title=`head -n 1 index.txt` cat << EOF -<?xml version="1.0" encoding="UTF-8"?> -<rdf:RDF - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:content="http://purl.org/rss/1.0/modules/content/" - xmlns="http://purl.org/rss/1.0/"> - <channel rdf:about="${rssuri}"> - <title>${title}</title> - <link>${siteurl}</link> - <items> - <rdf:Seq> +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>. +@prefix rss: <http://purl.org/rss/1.0/">. +@prefix dc: <http://purl.org/dc/elements/1.1/>. +@prefix cc: <http://creativecommons.org/ns#>. + +<> a rss:channel; + rss:title "${title}"; + rss:link <${siteurl}>; + dc:creator <${creator}>; + cc:license <http://creativecommons.org/licenses/by-sa/3.0/>; + + :items [ EOF for item in $items; do - echo " <rdf:li rdf:resource=\"${siteurl}${item}\" />" + echo " rdf:resource <${siteurl}${item}>;" done -cat << EOF - </rdf:Seq> - </items> - </channel> -EOF +echo " ]." for item in $items; do - itemtxt=`echo ${item}.txt` - title=`head -n 1 ./${itemtxt}` - moddate=`ls -lc ./${item}.txt|awk '{print $6}'` - content=`smu < ./${item}.txt` - cat << EOF - <item rdf:about="${siteurl}${item}"> - <title>${title}</title> - <link>${siteurl}${item}</link> - <dc:date>${moddate}</dc:date> - <content:encoded><![CDATA[${content}]]></content:encoded> - </item> + title=`head -n 1 ./${item}.txt` + moddate=`ls -lc ./${item}.txt|awk '{print $6}'` + link="${siteurl}${item}" + cat << EOF +<${link}> a rss:item; + rss:title "${title}"; + rss:link <${link}>; + dc:date "${moddate}"; + dc:creator <${creator}>; + cc:license <http://creativecommons.org/licenses/by-sa/3.0/>. EOF done; - -echo "</rdf:RDF>" |