diff options
author | Nick White <git@njw.me.uk> | 2010-09-26 12:51:14 +0100 |
---|---|---|
committer | Nick White <git@njw.me.uk> | 2010-09-26 12:51:14 +0100 |
commit | 33d710efd825eb493459494821dda22467011973 (patch) | |
tree | cb4df409bf1c70941ada3866400a1e0f61b19de0 /listarticles.sh | |
parent | 7a0c25eac0f1c2adf031343ff8c761ba73570cb6 (diff) | |
download | njw-website-33d710efd825eb493459494821dda22467011973.tar.bz2 njw-website-33d710efd825eb493459494821dda22467011973.zip |
Merge pubs and articles to writing
Diffstat (limited to 'listarticles.sh')
-rwxr-xr-x | listarticles.sh | 29 |
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 |