~earboxer/cgi-bin

cgi-bin/oebindex.awk -rwxr-xr-x 502 bytes
3fd01042Zach DeCook oeb index: fix first and last links 15 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
($1 == "\\h"){
	print "=> oeb.py?" startref"-"chapter"%3A"verse section;
	book = substr($0, 4); print "# " book; gsub(/ /, "%20", book);
	verse = 1; chapter = 1; section = "";
	startref = book"%20"chapter"%3A"verse
}
($1 == "\\c"){chapter = $2; verse = 1}
($1 == "\\v"){verse = $2}
($1 == "\\s"){
	if(section){
		print "=> oeb.py?" startref"-"chapter"%3A"verse section;
	}
	section = substr($0, 3);
	startref = book"%20"chapter"%3A"verse
}
END{print "=> oeb.py?" startref"-"chapter"%3A"verse section;}