can ref introductions now

This commit is contained in:
Alexander Bocken 2020-08-19 13:15:14 +02:00
parent 31bfcf1d70
commit 62da5cb074

View File

@ -51,7 +51,7 @@ function parseref(ref, arr) {
return "unknown" return "unknown"
} }
if (match(ref, "^:?[1-9]+[0-9]*")) { if (match(ref, "^:?[0-9]+[0-9]*")) {
# 2, 3, 3a, 4, 5, 6, 9 # 2, 3, 3a, 4, 5, 6, 9
if (sub("^:", "", ref)) { if (sub("^:", "", ref)) {
arr["chapter"] = int(substr(ref, 1, RLENGTH - 1)) arr["chapter"] = int(substr(ref, 1, RLENGTH - 1))
@ -71,11 +71,11 @@ function parseref(ref, arr) {
return "unknown" return "unknown"
} }
if (match(ref, "^:[1-9]+[0-9]*")) { if (match(ref, "^:[0-9]+[0-9]*")) {
# 3, 3a, 5, 6 # 3, 3a, 5, 6
arr["verse"] = int(substr(ref, 2, RLENGTH - 1)) arr["verse"] = int(substr(ref, 2, RLENGTH - 1))
ref = substr(ref, RLENGTH + 1) ref = substr(ref, RLENGTH + 1)
} else if (match(ref, "^-[1-9]+[0-9]*$")) { } else if (match(ref, "^-[0-9]+[0-9]*$")) {
# 4 # 4
arr["chapter_end"] = int(substr(ref, 2)) arr["chapter_end"] = int(substr(ref, 2))
return "range" return "range"
@ -90,25 +90,25 @@ function parseref(ref, arr) {
return "unknown" return "unknown"
} }
if (match(ref, "^-[1-9]+[0-9]*$")) { if (match(ref, "^-[0-9]+[0-9]*$")) {
# 5 # 5
arr["verse_end"] = int(substr(ref, 2)) arr["verse_end"] = int(substr(ref, 2))
return "range" return "range"
} else if (match(ref, "-[1-9]+[0-9]*")) { } else if (match(ref, "-[0-9]+[0-9]*")) {
# 6 # 6
arr["chapter_end"] = int(substr(ref, 2, RLENGTH - 1)) arr["chapter_end"] = int(substr(ref, 2, RLENGTH - 1))
ref = substr(ref, RLENGTH + 1) ref = substr(ref, RLENGTH + 1)
} else if (ref == "") { } else if (ref == "") {
# 3 # 3
return "exact" return "exact"
} else if (match(ref, "^,[1-9]+[0-9]*")) { } else if (match(ref, "^,[0-9]+[0-9]*")) {
# 3a # 3a
arr["verse", arr["verse"]] = 1 arr["verse", arr["verse"]] = 1
delete arr["verse"] delete arr["verse"]
do { do {
arr["verse", substr(ref, 2, RLENGTH - 1)] = 1 arr["verse", substr(ref, 2, RLENGTH - 1)] = 1
ref = substr(ref, RLENGTH + 1) ref = substr(ref, RLENGTH + 1)
} while (match(ref, "^,[1-9]+[0-9]*")) } while (match(ref, "^,[0-9]+[0-9]*"))
if (ref != "") { if (ref != "") {
return "unknown" return "unknown"
@ -119,7 +119,7 @@ function parseref(ref, arr) {
return "unknown" return "unknown"
} }
if (match(ref, "^:[1-9]+[0-9]*$")) { if (match(ref, "^:[0-9]+[0-9]*$")) {
# 6 # 6
arr["verse_end"] = int(substr(ref, 2)) arr["verse_end"] = int(substr(ref, 2))
return "range_ext" return "range_ext"