blob: 23456510010ec71fe5e831844a11ca5bfcd55b31 (
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
|
#!/bin/sh
[[ "$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
@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/>;
rss:items [ a rdf:Seq;
EOF
for item in $items; do
echo " rdf:li <${siteurl}${item}>;"
done
echo " ]."
for item in $items; do
title=`head -n 1 ./${item}.txt`
moddate=`ls -lc --time-style=+%Y-%m-%d ./${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;
|