blob: ad518472561e0e3b37c1e58ebce7e7489e65b9ce (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
#!/bin/sh
# See COPYING file for copyright, license and warranty details.
[[ "$1" ]] && siteurl="$1" || siteurl=""
[[ "$2" ]] && creator="$2" || creator=""
# TODO: rewrite items to exclude things in writing/index.ttl, and later just append the content of that
items=`find . -name '*.txt' ! -name 'robots.txt' ! -path '*/pubs/2*' | sed -e 's/^\.//g' -e 's/\.txt$//g'`
pubs=`find ./writing -name '2*.txt' | sed -e 's/^\.//g' -e 's/\.txt$//g'`
title=`head -n 1 index.txt`
cat << EOF
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix rss: <http://purl.org/rss/1.0/>.
@prefix bibo: <http://purl.org/ontology/bibo/>.
@prefix dc: <http://purl.org/dc/elements/1.1/>.
<> a rss:channel;
rss:title "${title}";
rss:link <${siteurl}>;
dc:creator <${creator}>;
dc:license <http://www.gnu.org/licenses/gpl.html>;
rss:items [ a rdf:Seq;
EOF
for item in $items $pubs; do
echo " rdf:li <${siteurl}${item}>;"
done
echo " ]."
for item in $items; do
title=`head -n 1 ./${item}.txt`
moddate=`stat -c %y ./${item}.txt|awk '{print $1}'`
link="${siteurl}${item}"
cat << EOF
<${link}> a rss:item;
rss:title "${title}";
rss:link <${link}>;
dc:date "${moddate}";
dc:creator <${creator}>;
dc:license <http://www.gnu.org/licenses/gpl.html>.
EOF
done;
sed -e '/^@/d' -e "s|http://njw.me.uk|${siteurl}|g" < writing/index.ttl
|