enridaga / gapvis

A visual interface for reading ancient texts for the Google Ancient Places project
http://googleancientplaces.wordpress.com
Other
5 stars 2 forks source link

Link to Perseus should consider Chapters instead of pointing to Ch 1 by default #20

Closed enridaga closed 10 years ago

enridaga commented 10 years ago

As the summary says. Discussed in https://github.com/ekansa/gap2/issues/23

enridaga commented 10 years ago

This can now be done by adding a function in the settings. The following shows how to implement it for Hestia/Perseus:

VIEW_ON = "Perseus"
VIEW_ON_LINK = function(uri, page){
// uri is the link to the book page on the origin repository
// page is the page number (eg, 1, 3, -13) or reference (eg. 1.1, 4.5)
// Implement here how to build a more detailed link
// XXX This is an example for Perseus repository
// uri is something like http://www.perseus.tufts.edu/hopper/text?doc=Perseus%3Atext%3A1999.01.0126
   if(page.indexOf('.')!=-1){
    page = page.split('.');
    return uri + '%3Abook%3D' + page[0] + '%3Achapter%3D' + page[1] + '%3A';        
   }else{
    return uri;
   }
}