Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMike Gerwitz <mike@mikegerwitz.com>2013-06-04 22:26:23 -0400
committerMike Gerwitz <mike@mikegerwitz.com>2013-06-04 22:26:23 -0400
commit2843ce20c58ed7a1989c24f67bea50fe78442ee6 (patch)
treedb55a43b66236b5ee52ee3d09e76b3c52d11e04c /tools
parentecfa48289842f99230dfe16df2b021a743eb1ddf (diff)
downloadthoughts-2843ce20c58ed7a1989c24f67bea50fe78442ee6.tar.gz
thoughts-2843ce20c58ed7a1989c24f67bea50fe78442ee6.tar.bz2
thoughts-2843ce20c58ed7a1989c24f67bea50fe78442ee6.zip
doclist will now strip html suffix and properly handle TeX
Diffstat (limited to 'tools')
-rwxr-xr-xtools/doclist9
1 files changed, 7 insertions, 2 deletions
diff --git a/tools/doclist b/tools/doclist
index 08bad5f..78dbf77 100755
--- a/tools/doclist
+++ b/tools/doclist
@@ -27,13 +27,18 @@ echo '<ol class="docs">'
while read f; do
[ -f "$f" ] || continue
+ fn="${f%.*}"
+ base="$( basename "$fn" )"
+ src=$fn.@(txt|pg|tex)
+ [ -f $src ] || src="$fn/$base".@(txt|pg|tex)
+
# the docs/papers prefix will be stripped from the link and the link title
# will be taken from the first line of the source file; the source file is
# guessed by simply stripping the html suffix off of the filename and
# globbing for any non-html suffix
printf '<li><a href="%s">%s</a></li>\n' \
- "${f#docs/papers/}" \
- "$( head -n1 "${f%.html}".!(html) )"
+ "${fn#docs/papers/}" \
+ "$( head -n1 $src | sed 's/^% //' )"
done
echo '</ol>'