#
# awk -f makefaq.awk <faq.txt >faq.html
#
BEGIN{
	printf("<!DOCTYPE HTML PUBLIC \"-\/\/W3C\/\/DTD HTML 4.0 Transitional\/\/EN\"><html lang=\"ja\"><head><title>faq<\/title><meta http-equiv=\"Content-Type\" content=\"text\/html; charset=EUC-JP\"><\/head><body>\n")
	flag=0
}

{
	if($1 ~/^[1-9]\.[1-9]/){
		if( flag == 0){
			printf("<a href=\"#_%2d\">%s<\/a><br>\n",$1*10,$0)
		}else
		{
			printf("<a name=\"_%2d\"><font color=\"#1010F0\">%s<\/font><\/a><br>\n",$1*10,$0)
		}
	}else
	if($1 ~/------/){
		flag=1
		printf("<hr>\n")
	}else if($1 ~/^>/){
		$1 = substr ($1,2)
		printf("><a href=\"%s\">%s</a><br>",$1,$1)
	}else{
		printf("%s\n<br>",$0)
	}
}

END{
	printf("<div align=right><a href=\"http:\/\/www.kurims.kyoto-u.ac.jp\/~shigeo\/soft.html\">[back]<\/a><\/div><p><center><address>御意見は<a href=\"mailto:shigeo@kurims.kyoto-u.ac.jp\">光成滋生<\/a>までお願いします<\/address><\/center><\/body><\/html>")
}
