#!/bin/bash
# @desc The generator for scripts' html previews.
mkdir -p html
cat > html/index.html << EOF
<ul>
EOF
for script in $(basename -a src/*)
do
cat > html/$script.html <<HEADER
<h1> $script </h1>
$(grep -Eo '[@]desc .*' src/$script|cut -d' ' -f2-|lowdown)
<div><a href="../src/$script"> [raw] </a></div>
<hr/>
HEADER
cat >> html/index.html << EOF
<li> <a href="$script.html">$script</a> &mdash; $(grep -Eo '[@]desc .*' src/$script|cut -d' ' -f2-|lowdown) </li>
EOF

	source-highlight -t 4 --line-number-ref -f xhtml -i src/$script >> html/$script.html 
done

cat >> html/index.html << EOF
</ul>
EOF
