esvapi: style fixes

This commit is contained in:
Jeremy Baxter 2024-06-26 13:10:57 +12:00
parent df6abbf50c
commit 91dc7cd07e

View file

@ -41,11 +41,8 @@ enum ESVIndent
TAB TAB
} }
/++ Default URL to use when sending API requests. +/
enum ESVAPI_URL = "https://api.esv.org/v3/passage";
/++ Constant array of all books in the Bible. +/ /++ Constant array of all books in the Bible. +/
immutable string[] BIBLE_BOOKS = [ immutable string[] bibleBooks = [
/* Old Testament */ /* Old Testament */
"Genesis", "Genesis",
"Exodus", "Exodus",
@ -66,7 +63,6 @@ immutable string[] BIBLE_BOOKS = [
"Esther", "Esther",
"Job", "Job",
"Psalm", "Psalm",
"Psalms", /* both are valid */
"Proverbs", "Proverbs",
"Ecclesiastes", "Ecclesiastes",
"Song of Solomon", "Song of Solomon",
@ -147,7 +143,7 @@ immutable string[] ESVAPI_PARAMETERS = [
bool bool
bookValid(in char[] book) nothrow bookValid(in char[] book) nothrow
{ {
foreach (string b; BIBLE_BOOKS) { foreach (string b; bibleBooks) {
if (book.capitalize() == b.capitalize()) if (book.capitalize() == b.capitalize())
return true; return true;
} }
@ -202,7 +198,7 @@ class ESVApi
{ {
_key = key; _key = key;
_tmp = tempDir() ~ tmpName; _tmp = tempDir() ~ tmpName;
_url = ESVAPI_URL; _url = "https://api.esv.org/v3/passage";
opts = ESVApiOptions(true); opts = ESVApiOptions(true);
extraParameters = ""; extraParameters = "";
onProgress = delegate int (size_t dlTotal, size_t dlNow, onProgress = delegate int (size_t dlTotal, size_t dlNow,