#!/bin/sh

makehistory() {
	printf "      Date\tVersion\t\tFile\n"
	cvs -d /home/alpt/appunti/.cvsroot/  history -l -x M -D "2 month ago" | \
		egrep -v 'meccanica|fisica|representation' | \
		tac | \
		awk '{print $2, "\t",  $6, "\t", "<a href= \"PDF/"$8"\">"$8"/</a>"$7"" }'
}

makesource() {
find ./ -maxdepth 1 | \
egrep -v 'fisica|^old$|teoria_dei_numeri|meccanica|pacca|index.html|.*~$|cvsroot|./$|./\.|./PDF|old$|makelog.sh' | \
  sed -e 's#^./##' | awk '{print $0"__DIVISOR__" $0}' |	\
  sed -e 's/^/<a href="/' -e 's/__DIVISOR__/">/' -e 's#$#</a><br>#'
}

cat <<FOE  > index.html
<html>
        <head> <title>Alpt math notes</title> </head>
        <body>
	<a href="http://freaknet.org/alpt"> Home </a></br>
        <p><B>Appunti di Matematica</B><br/><br/>
	Attenzione: potrebbero esserci vari errori, soprattuto nelle versioni piu' recenti.
	Fortunatamente, poiche' quasi tutte le proposizioni sono dimostrate, gli errori dovrebbero risultare evidenti.
	Ti ringrazio gia' in anticipo per ogni segnalazione.<br/>
	Buona lettura ^_^<br/>
	<br/>
        </p>

<BIG>
$(find ./PDF -maxdepth 1  | sed -e 's#^./##' | awk '{print $0"__DIVISOR__" $0}' | sed -e 's/^/<a href="/' -e 's/__DIVISOR__/">/' -e 's#$#</a><br>#')
</BIG>

<p>I sorgenti sono qui: </p>
$(makesource)

<br/>
<pre>
--
<p><B>History</B></p>
$(makehistory)
</pre>
        </body>
</html>
FOE
