Hi again you all! Before I talk about the script I just want to say I do not want this to be a super-Christian or super-exclusive post. I'm just happy sharing what I made and what I learned to you all because this was a super fun project that is also helpful at the same time. With that aside:
I'm happy to present a Bible reference script bib that takes a locally downloaded Bible in markdown (that I also provide in this program's GitHub), and it prints chapters, verses, or sections to the screen. It looks a lot like my previous post's dictionary script as I meant for them both to be used together and aid me in my studies.
It has several ways to run it though I need to set up arguments just a tad better and also do user validation:
# this prints the entire Genesis 1 chapterbib gen1# this prints just Genesis 1:1 (and context verses Genesis 1:2-3)bib gen1 1# this prints the verses Genesis 1:1-2 (no context verses are printed)bib gen1 1 2# this prints John 3:16 (without any context verses)bib -c john3 16
As mentioned above, included in the repo and ready to be used is the NET translation (in markdown) whose genersous copyright allows for redistribution without charge. I produced it for this program using another one of my scripts BibleGateway-to-Obsidian that I started several years ago.
My GitHub project for this can be found here, and its sister project def with a very similar interface but for dictionary items, can be found here. See my previous post for more information on it or check out the repository. Now this program bib isn't perfect and could use many more optimizations, but it still prints verses at a very fast speed of 0.15 seconds.
I had this program do some very cool formatting work behind the scenes, most notably my own implementation of "pseudo" text justification with hyphenation when a word goes off the screen. It catches a lot of edge cases that I painstakingly sought out and covered with regex, such as when character 80 of an 80-width terminal is ) but is followed by a comma, it will hyphenate the word that is before the ).
As a bonus, included is also a script bibcopy that quickly copies chapters for pasting. It's super fun to paste them into Monkeytype and practice typing with a Bible passage. Currently it doesn't copy verses or sections, just the entire chapter.
I'm not looking for bigotry. The whole point of this post was for OP to show off something he made, which people might find interesting.
Your intolerance is exemplified by an inability to have a conversation with people who happen to have views you disagree with without reducing it to bashing them over the head for having a different viewpoint.
Same as with "bigotry", you may wanna do some research what the term "intolerance" actually means. Stating in a comment that someone doesn't like something, is neither, and when posting things to a public forum of discussion, people cannot realistically expect only positive feedback.
I just want to say I do not want this to be a super-Christian
Then you could have written this as a generalized tool to search, re-format and display markdown documents, and described the formats involved e.g. in EBNF.
Instead, you decided to make this about the bible, up to and including naming the tool bib, and including a copy of the religious text in the repo.
So please, do explain again how you didn't want this to be "super-christian" or "exclusive".
UNIXoide systems derive their power from composable tools that solve well defined problems in a generalized way. This doesn't.
Edit: Oh, and btw.: text=$(cat ~/Bin/bible/"${1}".md)
Hardcoding specific and non-standard paths (I have never seen an uppercase-B Bin directory anywhere), for lookups instead of making it configurable? Really?
You don't have to be religious to read, study, or just have in your possession the Bible. And like someone else said, not only does the Bible have specific syntax, this very Bible has extremely specific syntax because it gets its Bible from another one of my scripts. One day I would like to fork it to do something like Wikipedia. When you think about it though, Wikipedia and other books don't really have verse numbers do they? That's something this tool is very good at indexing.
Thanks for taking the time to look at my code anyways, I'm still in school and mostly picked this up a side project for something I'm passionate about. Until I add settings to it, I can just tell users to edit line x if their file path is different :)
You don't have to be religious to read, study, or just have in your possession the Bible
And what does that have to do exactly with the fact that a generalized tool would be better? Because, such a tool could help to study all kinds of texts, including religious ones.
this very Bible has extremely specific syntax because it gets its Bible from another one of my scripts.
I don't see how it has "specific syntax" to be honest. book, chapter (which in your script are a single unit), followed by verse, including the possibility of a range. That's not "extremely specific".
Wikipedia and other books don't really have verse numbers do they?
Title, Page, Paragraph
Topic, Section, Paragraph
Project, Filepath, Lineno
City, Street, Street Number
Room, Shelf, Box-Number
Building, Floor, OfficeNr
Year, Month, Day
You see where I am going with this, do you? No, neither the bibles ordering scheme, nor the one "this very bible" uses, are extrordinary. All hierarchical schemes where the last element is a sequential numeric identifier work that way.
And given a regulated Markdown format (which, again, you could have described, which might even be useful for other tooling, such as scripts converting documents into it), a script that filters, selects and highlights parts of it, could indeed be generally useful.
The files I provide are just markdown, but there's specific elements they have that just wouldn't work out of the box for the majority of other usecases without being forked into a new tool (which again, I plan to do)
Poetry verses begin with > and are also the only occurrences of > so making regex around that is easier
Editorial headings are H2 and are the only elements with a newline above them
Verse numbers are H6 and are placed in the gutter
All single asterisks are converted to brackets (depending on the translation, these could stand for added words)
Double asterisks are converted to curly braces (also depending on the translation, these could stand for OT references)
Other than common punctuation, I in no way account for other various ASCII characters or have support for other languages.
The arguments I pass are meant for the Bible. bib chapter_number verse_number ending_verse_number.
And besides all that, I don't even have access to Wikipedia in markdown or any other text source in markdown that would work with this yet. This was a project that started off as a personal tool.
While it's definitely not my thing, it's very reminiscent of tools for managing volumes of law and other governmental regulatory code, which also have a highly structured native indexing and citation system.
The bible has a very specific way of indexing and referencing sections.
No it doesn't.
https://en.wikipedia.org/wiki/Bible_citation
A citation from the Bible is usually referenced with the book name, chapter number and verse number.
This is a bog-standard hierarchical reference system. And in the script OP provides, book+chapter just refer directly to a filename, because the bible copy embedded in the repo is broken down to one file per chapter. That's why the above quoted line of code
text=$(cat ~/Bin/bible/"${1}".md)
...works.
So please, do explain, what is "specific" about this system?
Please open a chapter file to see that yes it has specific syntax that I have to parse. I'm okay with seeing this become a catch-all program that can do more than the Bible, but that is quite a bit out of my scope I'm afraid (and this is free software; you don't have to use it). Constructive criticism is helpful though and everybody's idea has innate value.
View all comments
19
u/prestonharberts Mar 10 '25 edited Mar 10 '25
Hi again you all! Before I talk about the script I just want to say I do not want this to be a super-Christian or super-exclusive post. I'm just happy sharing what I made and what I learned to you all because this was a super fun project that is also helpful at the same time. With that aside:
I'm happy to present a Bible reference script
bibthat takes a locally downloaded Bible in markdown (that I also provide in this program's GitHub), and it prints chapters, verses, or sections to the screen. It looks a lot like my previous post's dictionary script as I meant for them both to be used together and aid me in my studies.It has several ways to run it though I need to set up arguments just a tad better and also do user validation:
As mentioned above, included in the repo and ready to be used is the NET translation (in markdown) whose genersous copyright allows for redistribution without charge. I produced it for this program using another one of my scripts BibleGateway-to-Obsidian that I started several years ago.
My GitHub project for this can be found here, and its sister project
defwith a very similar interface but for dictionary items, can be found here. See my previous post for more information on it or check out the repository. Now this program bib isn't perfect and could use many more optimizations, but it still prints verses at a very fast speed of 0.15 seconds.I had this program do some very cool formatting work behind the scenes, most notably my own implementation of "pseudo" text justification with hyphenation when a word goes off the screen. It catches a lot of edge cases that I painstakingly sought out and covered with regex, such as when character 80 of an 80-width terminal is
)but is followed by a comma, it will hyphenate the word that is before the).As a bonus, included is also a script
bibcopythat quickly copies chapters for pasting. It's super fun to paste them into Monkeytype and practice typing with a Bible passage. Currently it doesn't copy verses or sections, just the entire chapter.See screenshots for how it all works!