index.sh
changeset 1092 639665016a27
parent 1079 ef0805397b5b
child 1336 80c5eff010a1
--- a/index.sh	Fri Oct 14 23:48:24 2011 +0300
+++ b/index.sh	Sun Nov 20 20:14:48 2011 +0200
@@ -18,20 +18,12 @@
 
 for file in *.rst *.txt; do
   ext=${file##*.}
-  name=${file%.${ext}}
-  case $ext in
-    txt)
-      case "$1" in
-        chm) printf '  <li><a href="%s.txt">%s</a>\n' $name $name ;;
-        frame) printf '  <li><a href="%s.txt" target="article">%s</a>\n' $name $name ;;
-      esac
-      ;;
-    rst)
-      case "$1" in
-        chm) printf '  <li><a href="%s.html">%s</a>\n' $name $name ;;
-        frame) printf '  <li><a href="%s.html" target="article">%s</a>\n' $name $name ;;
-      esac
-      ;;
+  [ "$ext" = "rst" ] && ext=html
+  name=${file%.*}
+  case "$1" in
+    html) echo "  <li><a href=\"$name.$ext\">$name</a>" ;;
+    frame) echo "  <li><a href=\"$name.$ext\" target=\"article\">$name</a>" ;;
+    *) exit 1 ;;
   esac
 done