bkhpanigha / hh-suttas

HH Suttas (Development)
https://hh-suttas.onrender.com/
9 stars 7 forks source link

Fix Issue #113 #115

Closed Reptilioo closed 5 months ago

Reptilioo commented 5 months ago

Issue #113 was about two issues:

1) For collections of suttas like AN.1.51-60, the sutta's IDs contained in the segments of the html aren't the same as the sutta id we are going to find in the url for the ?q= parameter. So when copying a link, the id extracted wasn't correct: instead of ?q=an1.51-60, we got ?q=an1.51 or ?q=an1.52 etc, depending on the segment copied.

2) Function generateLink() receive as a parameter the range of verses to link to, separated by a dash (e.g., mn11:4.1-mn11:4.5), which was problematic when the first part of the verse contained a dash itself.

Solution: Fetch the sutta's id in the current url when displaying the page and keep it in memory. Fetch this id in generateLink() instead of reading it from the values in the range of verses.

@ishaanv Is this all good for you?

ghost commented 5 months ago

@Reptilioo lgtm!