#!/usr/local/bin/sbl

dupS openi ".sbd" ".html" subS openo


forever [
	inS dupS EOF SEQ if [ end ]
	"test" sto

	:test "^&HEAD" m 
	if [
		"" "test" sto
		inS chompS "<H1>" outS outS "</H1>\n" outS
	] 
	:test "^&SEE" m
	if [
		"" "test" sto
		"<H3>See also: </H3>\n" outS
		inS chompS "<B>%s</B>\n" format outS
	] 
	:test "^&SYN" m
	if [
		"" "test" sto
		"<H3>Synopsis: </H3>\n" outS
		inS chompS "<B>%s</B>\n" format outS
	] 
	:test "^&D" m
	if [
		"</UL>\n" "test" sto
		"<BR>Arguments: \n" outS
		"<UL>\n" outS
		"" "strd" sto
		while [
			:strd outS inS dupS "&\n" SEQ "<LI> " swapS catS "strd" sto NOT
		] 
	] 
	:test "^&CODE" m
	if [
		"</PRE>\n" "test" sto
		"<PRE>\n" outS
		"" "strd" sto
		while [
			:strd outS inS dupS "&\n" SEQ "strd" sto NOT
		] 
	] 
	:test outS
		
] 
