scripts for my gemini capsule
oeb index: Fix placement of entries
Zach DeCook 2021-07-08
parent 15468f5 · commit c69aeda
-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
}