A 4kb mini interface for SuttaCentral.net suttas and Vinaya

Would I store that in local storage?

Could. Or store as a hidden field in the form and pass along as a second query parameter. Up to you :blush:

1 Like

Hi @Snowbird … great little tool. Could the Pali headings be toggled off when Pali text is toggled off please?

2 Likes

Great. Thank you

Yes. Absolutely

Nooooooooo! :wink:

2 Likes

Just a little thing:

https://suttacentral.net/an1.328/
gives a single sutta

https://mini-sc.netlify.app/?an1.328
gives: Sorry, “an1.328” is not a valid sutta citation.

https://sutta.readingfaithfully.org/ with an1.328
gives https://suttacentral.net/an1.316-332/en/sujato

1 Like

OK, That’s done. Could you take a look at how I did it and tell me if it makes sense/is the right way to do it? Previously, I was just using .toggle() but that won’t work anymore, eh?

Ah…

Khantī paramaṁ tapo titikkhā,

:wink:

So, for the sutta titles, I really want to keep the Pali there. I have removed it for the little list at the very top that shows the book, vagga, etc. And also for the subheadings within the suttas. If you had a suggestion on how to style the titles better, I’m very much open to that. Did you have a specific use case where you needed even the Pali in the titles hidden?

Right. That is expected at this point. That’s what the instruction Suttas that are part of a series require that you enter the exact series. means.

This is because the json files for the suttas that are part of a series contain the whole series. And I’m just pulling from the raw json files in the github repo.

Right. This I believe is a brand new feature. (Yay!) It is done somehow programmatically.

Yes! That’s because that app contains a table of all the suttas that are part of a series.

So if we wanted the same behaviour in mini-sc it would have to include all those tables as well as code to find a single sutta within a series. And so very quickly it wouldn’t be so mini.

I’ve been trying to figure out the API. This will probably be a better way to get all of the sutta data. However the ability to call on a single sutta within a series doesn’t seem to be part of the API yet. For example:
https://suttacentral.net/api/bilarasuttas/an1.328/sujato?lang=en
gives “Not Found”.

OK. That all makes perfect sense. So cool to have these tools. Thanks you very much Bhante!!

1 Like

TIL the .classname selector has less support than the lang selector (94.13% v 94.48%). Probably just an artefact of the data but still.

1 Like

looks about right! Except I’d just add/remove a “pali-hidden” class on the parent element for the whole shebang and do the rest in CSS:

div.pali-hidden span.pali-lang { display: none; }
…etc

1 Like

Doh! :man_facepalming:t2: So obvious now. Thanks!

Well, it’s really all just because Bhante Sujato is making all the data public.

If you have any ideas for other things, I’m always looking for practice projects.

1 Like

WAIT You know what I actually need? An interface this simple and clean which just searches the SuttaCentral edition of the PED. That would rule!

2 Likes

(whispers : the css is more expensive if you define element + class than if you just use the class. The browser has to match the class, then figure out if it matches the element. The general rule is, make selectors as complex as needed and no more.)

We should make a SuttaCentral Awesome page on Github that collects all the tools and stuff built on our data. Another one came up yesterday, a group in Malaysia is printing books.

Why don’t I do that, please remind me what I’ve forgotten:

1 Like

Would you be willing to download the whole dictionary at once? Bhante @sujato, is there a search or dictionary API?

1 Like

The search is all going to be changing so I wouldn’t build on it.

3 Likes

Sure! If I’m looking up one word, I’m probably looking up several.

Also, netlify allows you to specify the cache length on a per-file basis I believe. So you can set the wholedictionary.js file to have a really long cache and then it’ll only need to be downloaded once (per month or whatever)

1 Like

I just updated this to allow for Kp, Dhp, Ud, Iti, Snp, Thag, Thig. Dhp has to be in the form of verse ranges exactly for the whole chapter.

2 Likes

Cool! Also I added this to our Awesome page.

Thanks, Bhante. It’s really more of a test project, but maybe people will find it useful.

Right now it is getting it’s data directly from the github files. To me that seems like a really hacky way of doing things and that the “true” way would be to use the official API. Would you agree? Is it somehow wrong to be using the Github files?

No problem using the Github files. The API is really just “get the data from the Github files and assemble it in a way that is convenient for SC’s needs”. So it’s up to what you want to achieve.

Ah, that’s great. I had assumed that there was a “build” of the website on different servers and that the API was somehow pulling from that.

For sure getting the data from the API will be an improvement once it is working. Only need to call one file and it includes previous/next info.

1 Like