about summary refs log tree commit diff
path: root/oebindex.awk
diff options
context:
space:
mode:
authorZach DeCook <zachdecook@librem.one>2021-07-08 23:51:23 -0400
committerZach DeCook <zachdecook@librem.one>2021-07-08 23:51:23 -0400
commitc69aedaf44ec1bf4eea7b5d21d636ca241eba297 (patch)
tree0120c97f1cc7c8a61b464d7c4835593407e9fcc0 /oebindex.awk
parent15468f524a6a29401960ff52b6417cc6124330ed (diff)
downloadcgi-bin-c69aedaf44ec1bf4eea7b5d21d636ca241eba297.tar.gz
oeb index: Fix placement of entries
Diffstat (limited to 'oebindex.awk')
-rwxr-xr-xoebindex.awk11
1 files changed, 9 insertions, 2 deletions
diff --git a/oebindex.awk b/oebindex.awk
index ba9c351..06b1c73 100755
--- a/oebindex.awk
+++ b/oebindex.awk
@@ -1,8 +1,15 @@
-($1 == "\\h"){book = substr($0, 4); print "# " book; gsub(/ /, "%20", book); verse = 1; chapter = 1}
+($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"){
-	print "=> oeb.py?" startref"-"chapter"%3A"verse section;
+	if(section){
+		print "=> oeb.py?" startref"-"chapter"%3A"verse section;
+	}
 	section = substr($0, 3);
 	startref = book"%20"chapter"%3A"verse
 }