summaryrefslogtreecommitdiff
path: root/listarticles.sh
blob: 51845111d8621dc78562b38927c34e6334a60c85 (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
#!/bin/sh

pubttl=$2

for a in `sed -e '/^[^<]/d' -e '/^$/d' -e '/bibo:Article/!d' -e 's/^<//' -e 's/>.*$//' -e 's/.*\///' < $pubttl`; do
	test -n "$expubs" && expubs="$expubs "
	expubs="$expubs! -name '$a.*'"
done

echo ""
echo "Other Articles"
echo "-----------------------------------------------------------------------"
echo ""

# list of files sorted by modtime - eval used so quotes don't get lost
eval "find $1 -type f -name '*.txt' ! -name 'index.*' $expubs -printf '%T@ %p\n'" \
| sort -r -n | awk '{print $2}' | while read f; do
	reluri=`echo $f | sed 's/.*\/\([^\/]*\)\.txt/\1/'`
	title=`sed -e 's/# //' -e 1q < $f`

	echo -n "- [$title]($reluri)"
	if test `grep -c '^### ' < $f` -ne 0; then
		subtitle=`sed -e 's/### //' -e 4q < $f | tail -n 1`
		echo -n ": $subtitle"
	fi
	echo ""
done

exit 0