#!/bin/sh

echo '<html>'
echo '  <head>'
echo '  <meta name="generator" content="html2hhc &lt;gavenkoa@gmail.com&gt;">'
echo '  </head>'
echo '<body>'
echo '<object type="text/site properties">'
echo '  <param name="ImageType" value="Folder">'
echo '</object>'
echo '<ul>'

echo '  <li><object type="text/sitemap">'
echo '    <param name="name" value="index">'
echo '    <param name="local" value="iframe.html">\n'
echo '  </object>'

for file in *.rst *.txt; do
  case $file in
    HEADER.rst) continue;;
  esac
  ext=${file##*.}
  name=${file%.${ext}}
  echo '  <li><object type="text/sitemap">'
  case $ext in
    txt)
      printf '    <param name="name" value="%s">\n' $name
      printf '    <param name="local" value="%s.txt">\n' $name
      ;;
    rst)
      printf '    <param name="name" value="%s">\n' $name
      printf '    <param name="local" value="%s.html">\n' $name
      ;;
  esac
  echo '  </object>'
done

echo '</ul>'
echo '</body>'
echo '</html>'

