#!perl

# Parse additional *.html files useing parse.pl

require 'parse.pl';

&readCmdList;

die "Cannot open TOC: $!\n"
	unless open(TOC, "TOC");
while(<TOC>) {
	if(/FEATURE_/) {
#		s/#feature/cmd.html$1/;
#	Decorate string as it gets HTML'ed when included later
		s:<.*?>::g;
		$features .= '<LI>' . $_;
	}
}
close TOC;

sub htmlAppendixRef {
	my($cmd) = @_;

	return '<A HREF="cmd.html#_appendix' . $cmd . "\">";
}
sub htmlCommandRef {
	my($cmd) = @_;

	return '<A HREF="cmd.html#' . lc($cmd) . "\">$cmd</A>";
}
sub htmlFreeCOMRef {
	my($cmd) = @_;
	$cmd = $' if $cmd =~ /^[-_]+/;

	return '<A HREF="#-' . $cmd . "\">";
}


foreach $file ('FreeCOM.html') {
	die "Cannot open '$file': $!\n"
		unless open(IN, $file);
	die "Cannot create '../$file': $!\n"
		unless open(HTML, ">../$file");
	&parseEBNF;
	close HTML;
	close IN;
}

