summaryrefslogtreecommitdiff
path: root/listarticles.sh
diff options
context:
space:
mode:
authorNick White <git@njw.me.uk>2010-09-26 12:51:14 +0100
committerNick White <git@njw.me.uk>2010-09-26 12:51:14 +0100
commit33d710efd825eb493459494821dda22467011973 (patch)
treecb4df409bf1c70941ada3866400a1e0f61b19de0 /listarticles.sh
parent7a0c25eac0f1c2adf031343ff8c761ba73570cb6 (diff)
downloadnjw-website-33d710efd825eb493459494821dda22467011973.tar.bz2
njw-website-33d710efd825eb493459494821dda22467011973.zip
Merge pubs and articles to writing
Diffstat (limited to 'listarticles.sh')
-rwxr-xr-xlistarticles.sh29
1 files changed, 29 insertions, 0 deletions
diff --git a/listarticles.sh b/listarticles.sh
new file mode 100755
index 0000000..5184511
--- /dev/null
+++ b/listarticles.sh
@@ -0,0 +1,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