suttacentral / legacy-suttacentral

Source code and related files (CSS, images, etc.) for SuttaCentral
http://suttacentral.net/
Other
14 stars 4 forks source link

Text images #90

Closed sujato closed 6 years ago

sujato commented 9 years ago

Improve widget for displaying text images for Pali (and possibly other) texts. This is already active for the PTS texts. We should improve the image display by adding the unicode "book" glyph to our sans font.

We have two more sets of images ready to go: BJT, and Rama 5. The data for these is not in the Pali text, but is contained in our data files (pali_concord.csv). So this needs to be associated with the Pali text.

The Chatthasangiti images are ready, but they are a different edition to what we have in our data, so not easy to deploy. We need a Burmese speaker to make the proper identifications.

As a further enhancement, we should ensure IIIF compliance:

https://en.wikipedia.org/wiki/International_Image_Interoperability_Framework

sujato commented 7 years ago

This is still on the 2-do list as a major enhancement. The stumbling block is making use of the vol/page data for the various editions. Since we are now generally moving towards keeping such things as JSON files, we should not have to insert the numbers in the text. We should at least get the BJT and Rama5 working.

As noted above, the data is in pali_concord.csv. the names of the editions are in manuscripts.csv.

BJT= bj = Buddhajayantītripiṭakagranthamālā 2501–2531 Rama 5 = s1 = Chulachomklao Tipiṭaka 2436

the images have been uploaded and live on a server somewhere, blake knows where.

sujato commented 7 years ago

Note too the site http://lannamanuscripts.net/en/about

It has a range of manuscript images from northern Thailand. These are interesting as being semi-independent from the main Thai lineage. Only a small percentage are canonical texts, but it might be possible to offer SC integration. However we don't have v/p data. The images are available under CC.

ghost commented 7 years ago

This is stored on the server (not github) in a directory called text_images. For instance the first one in DN1 is stored as text_images/pts/pi/su/dn/1/pts-dn-vol.1-pg.001.png and referenced in the text as <a class="pts" id="pts1.1"></a> s1 is also there, but not bj. I will look into it.

sujato commented 7 years ago

In case it's of any use, the naming conventions for the original image files are:

And so on. Blake renamed them for web use. I have them all locally, so if there is some problem on the server we can replace them.

ghost commented 7 years ago

I had a look but have the problem that my local development (pyenv) does not seem to be able to show the text-images or execute this py/js file. In any case, it does not add the data-src and data-file attributes to the <a> tag. I have discovered another problem here. Things work fine for f.i. the DN, where the coding is in the form of <a class="pts" id="pts1.1"></a> i.e. meaning paragraph 1.1. But last February, we discovered a bug with the display of the paragraph numbers for the PTS 1st and 2nd editions so I changed that from f.i. <a class="pts1" id="pts11.1"></a> (which showed as paragraph 11.1 instead of 1.1) to <a class="pts1ed" id="pts1ed1.1"></a> (and changed the js/css for the display of paragraph numbers accordingly). But now the text-images don't show for these.

Now I think I can fix this in text_image.js but because I cannot test it on local development, I don't want to try. When I get the new computer in, I might be able to install nginx for local development and try it then, but in the mean time, maybe @blake-sc can fix this problem.

blake-sc commented 7 years ago

I've fixed the issue for the "pts1ed"

ghost commented 7 years ago

Thanks. Got it: you changed it in text_image_index.py. Good to know.

blake-sc commented 7 years ago

It could actually be changed either on the python or javascript side. The whole thing is really quite messy and it's further complicated by the symlinking step.

Btw, it should work without nginx, as the cherrypy server does everything required. When the server starts up it should notice the images in text_image and create symlinks in static/text_images, then they should be available in the texts.

ghost commented 7 years ago

Haven't been able to get it to work locally yet.

In the mean time, I noticed that there are quite a few where it does not work after the change, like AN book 1-3 (but 4 and 5 work), UD (pages 1-3), KP (because the tags are not in place - I can fix that), JA book 1-3, all of DN and MN and probably more. I guess all of them that do not have an edition added to it.

I guess that a few more if/elif/else statements in the get function to make the difference between the various editions would help.

ghost commented 7 years ago

I still have a problem with my local development not recognizing this function (also on the new computer) so I cannot work on it. So for now I will leave this.

sujato commented 7 years ago

bump! It was working online until recently, now it's gone.

blake-sc commented 7 years ago

This is ultimately related to the ambiguity of "pts1.1", which means "pts 1st edition, book 1, page 1" - the problem is that either edition or book can be omitted if there is only the single edition, or the single book for a division. The way this is resolved is the class is the edition, class="pts" means that edition# is omitted from the id, and class="pts1" means that the edition# is explicit is in the id. It ultimately works but is a little bit breaky-prone.

I fixed it so it works, but I didn't figure out why it broke.

sujato commented 7 years ago

Okay, cool. But we should fix the data ambiguity …

sujato commented 7 years ago

And now it's broken again …

blake-sc commented 7 years ago

It doesn't seem broken to me. Is there some particular context where it's broken?

sujato commented 7 years ago

Umm, everywhere? I got no text images at all

https://suttacentral.net/pi/mn1#pts1.1

blake-sc commented 7 years ago

Okay, looks like if you toggle the Textual Info off then back on they appear. Might be a problem with how Vimala implemented the remembering.

sujato commented 7 years ago

Yep, that's it, it works now. Progress …

ghost commented 7 years ago

I'll have a look. I have an idea of how that might have happened. At startup it only toggles the Textual Info (which is mainly css) and does not look at the other functions attached to it.

ghost commented 7 years ago

I've made some changes to my code for this. Before it was only loading the css and not the rest at startup. However, I have put this on staging and although the console says it is loading the text_images object, it is nowhere to be seen. As I cannot see them at all on my local development as I said before, I am very hesitant to move this to master. @blake-sc can you have a look?

aminah-sc commented 6 years ago

Not relevant to new site.