📚 Sutta Anthology Builder App

I’ve created an automated anthology builder as a companion to the Book Builder:

You can give it a set of instructions like this:

h1 My great Anthology
h2 Section One
p These are my favorites
kp9
dhp1-20

And it will fetch the most recent translations by Bhante Sujato from SuttaCentral. You can either copy the rendered text (manually, unfortunately) and paste into a word processor, or automatically copy the html to the clipboard or a file. This html would be perfect to import into something like Calibre to create your own ebook.

You need to use exact sutta IDs as found in the url for a sutta.

I’d love to get any feedback and/or feature requests.

Current limitations:

  • The ID must be for the complete sutta as it appears on SuttaCentral. Fore example, you can’t use an1.1. You have to use an1.1-10
  • Sutta titles are always in the format of <citation> <Pali name>: <English name> and they always appear at the start of the sutta.
  • Since Bhante Sujato’s translations are the only complete ones, that’s all that is offered at this time.

Special thanks to @Khemarato.bhikkhu for his coding help and encouragement.

If anyone is curious, I used ChatGPT to come up with most of the code that fetches the suttas. This code is actually better than what is used in the Book Builder app, so I might update it someday.

This is the GitHub repository for the app.

9 Likes

Here is a set of instructions for building the first chapter of Bhante Bodhi’s In the Buddha’s Words.

I’ve now added the ability to specify ranges. For example:

an2.32-41>an2.37:1.0-10.4
DN 21:2.1.1-2.2.23
DN 15:9.1-9.2

I’m also starting to add settings. For example to include an html table of contents.

Here is the complete chapter:

{
"includeTableOfContents":true,
"suttaTitlesMarkup": "h3"
}
h1 I. The Human Condition
h2 1. Old Age, Illness, and Death
SN 3.3
SN 3.25
AN 3.36:1.1-12.5
h2 2. The Tribulations of Unreflective Living
SN 36.6
AN 8.6
SN 22.7
h2 3. A World in Turmoil
an2.32-41>an2.37:1.0-10.4
DN 21:2.1.1-2.2.23
DN 15:9.1-9.2
AN 3.69:2.1-5.2
h2 4. Without Discoverable Beginning
SN 15.1
SN 15.2
SN 15.5
SN 15.8
SN 22.99
3 Likes

Awesome stuff, Venerable!

2 Likes

It’s all possible because of your translations and all of the work that has been done to make the suttas available programmatically. When the big switch to the new format came out I was really frustrated that there wasn’t a simple html version of the site available. But it just took about six months of learning Javascript to be able to do more with the translation data than I could have ever imagined with just html.

Huge merit!!

3 Likes