gutenbergtools / autocat3

CherryPy App that serves dynamic content for Project Gutenberg
GNU General Public License v3.0
4 stars 6 forks source link

bibrec tab link to browse (static) pages, not search (autocat3) pages #43

Closed gbnewby closed 4 years ago

gbnewby commented 4 years ago

Would you please update the app to change bibrec pages to link to the /browse tree?

This is for the gutenberg1 branch, currently enacted at dev.gutenberg.org

This should be done for authors (and other creator roles).

For example, see the bibrec here: https://dev.gutenberg.org/ebooks/44125

The author links to: https://dev.gutenberg.org/ebooks/author/42603

And this should instead go to: https://dev.gutenberg.org/browse/authors/p#a42603 (the "p#" is the first letter of the author's last name).

eshellman commented 4 years ago

where's the code that chops up the author lists?

gbnewby commented 4 years ago

~gutenbackend/private/bin/cron-daily (calls make-by-pages.php). Output to ~gutenbackend/dev/html/browse

eshellman commented 4 years ago

there's nothing I can see at ~gutenbackend/dev

So the difficulty is figuring out how to get the "first letter of the author's last name".

I can't find this info in the php file.

It would be SOOO easy if we settled on a single templating/ page generation system instead of the php/jekyl/genshi being used. Why not use autocat3 to generate the browse pages?

gbnewby commented 4 years ago

Here are details. It might be useful to meet, to talk through this.

I meant ~gutenbackend/www/dev, a.k.a. gutenbackend@login2:www/dev/

For the changes: You do not need to look at the PHP, but if you want to it is here: gutenbackend@login2:private/bin/make-by-pages.php. It is called by cron-daily.sh in the same directory (and this is now running daily by cron).

Instead of looking at that, look at the HTML of the link I provided as an example (https://dev.gutenberg.org/browse/authors/p#a42603) or elsewhere under https://dev.gutenberg.org/browse/ (you can navigate the directory tree; it corresponds to gutenbackend@login2:www/dev/html/browse on the server).

In the current code in autocat3's bibrec for eBook #44125, the first author link goes here: https://dev.gutenberg.org/ebooks/author/42603

Instead, we want it to go here: https://dev.gutenberg.org/browse/authors/p#a42603

We want to replace the current <a href="/ebooks/author/42603" rel="marcrel:aut" about="/authors/42603" typeof="pgterms:agent" itemprop="creator">

This URL is relative to docroot, so the bibrec HTML will have something like <a href="/browse/authors/p#a42603">Polybius</a>.  (the other stuff in the URL can stay the same).

So, you are going to /browse/authors/X where X== the first letter of the author's last name, a-z only. Lower case. Then "a#NNNNN" where NNNNN== the author ID #. I.e., just put "a#" in front of the author number you already have.

You do not need to change any of the logic about Twain or Clemens: The bibrec already does this. All you need to do is change the URL that goes in the bibrec section of the landing page.

I'm not sure what happens to non-ASCII, actually. It looks like we might have ASCII mapping for non-ASCII authors. See this, for example: https://dev.gutenberg.org/browse/languages/zh .. if autocat3 is doing something different, we'll figure it out.

Concerning: Why not use autocat3 to generate the browse pages: We are linking to online HTML files, instead of using autocat3, because we want all of the landing pages and stuff bibrec links to in files. That way, they are mirrorable.

It is certainly possible to extend autocat3 to make all of those static browse pages, but this does not seem like a priority to me: we already have perfectly good PHP to do it. And the changes to the landing page code in autocat3 to link to the browse pages is certainly a lot easier than changes to use autocat3 to generate all those static browse pages.

Concerning templating: You can see in autocat3/templates/site-layout.html what I did with menu.html. This is the exact same HTML that Jeckyll includes, and CherryPy includes. I'd like to do the same thing with PHP, but there are only a few PHP programs we need to retain and they are not using templates.

The only reason I put menu.html in the gutenbackend repo, instead of the autocat3 repo, is that it does not work to put the menu.html instead the autocat3/templates directory -- because it is not the full needed Python. But it works fine in gutenbackend's _includes directory. Which repo it's in is not important. What's important is that it is exactly the same HTML.

I plan to take this same approach for CherryPy + Jeckyll with the other HTML. It's a little tricky, because Jeckyll and CherryPy both use variables and other programmatic elements with their templates. So, the HTML will be a little fragmented. My goal is to have the HTML be exactly the same (i.e., pulled from the same repo).

I have done this for menu.html only, but it works fine.

I discovered that Jeckyll refuses to go outside of it's own directory tree. CherryPy (or genshi) refuses to use relative paths (like ../../menu.html). It's probably possible in CherryPy to define a particular directory, like autocat3/_includes, for genshi to use. I didn't explore this at all, since Jeckyll already had this for the templating it does.

eshellman commented 4 years ago

Not to be a smart-ass, but it appears there's no author listing made for https://dev.gutenberg.org/ebooks/59112. (by Karel Čapek)

I tried to understand the php, but...

Documentation for Genshi says it supports relative links. CherryPy may well make you declare directories that it makes accessible. Nonetheless, it's easy to run genshi templates outside of CherryPy for static file generation. Not that I like genshi templates.

so if you want to make the php script work, you need to have a unicode aware method in php to group all the authors into a set of files, and have the same method working in python.

gbnewby commented 4 years ago

Thanks for finding that example. It looks like non-ASCII simply goes to "other": https://dev.gutenberg.org/browse/authors/other#a4823

Note that the author ID# is the same as autocat3 already has. It seems all that is needed is to map [A-Z] to [a-z], and for anything not mapping to [a-z] to map to "other."

On Tue, Jan 7, 2020 at 10:40 AM Eric Hellman notifications@github.com wrote:

Not to be a smart-ass, but it appears there's no author listing made for https://dev.gutenberg.org/ebooks/59112. (by Karel Čapek)

I tried to understand the php, but...

Documentation for Genshi says it supports relative links. CherryPy may well make you declare directories that it makes accessible. Nonetheless, it's easy to run genshi templates outside of CherryPy for static file generation. Not that I like genshi templates.

so if you want to make the php script work, you need to have a unicode aware method in php to group all the authors into a set of files, and have the same method working in python.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/gutenbergtools/autocat3/issues/43?email_source=notifications&email_token=AFQRDLWZTBMMSQJZSBCYWDLQ4SO6ZA5CNFSM4KDJYTY2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIJIWOQ#issuecomment-571640634, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFQRDLXRPN4DJ2P2HLIUPD3Q4SO6ZANCNFSM4KDJYTYQ .

eshellman commented 4 years ago

OK I can manage that.

eshellman commented 4 years ago

BTW, I find that ../../menu.html works fine even in cherrypy.

eshellman commented 4 years ago

(I needed to make this change to get autocat3 to run on my mac)

eshellman commented 4 years ago

will there be any format variants for the author lists? Currently, autocat 3 allows a ".mobile" suffix on most uris to select the mobile version.

gbnewby commented 4 years ago

Hopefully not. The theory is that the new responsive HTML5+CSS will work fine for all devices. That will let us deprecate and eventually remove the mobile-only stuff. We will be doing user testing quite soon, to test our theory.

You might note that in https://dev.gutenberg.org there are no mobile-only pages (contrary to www.gutenberg.org, which has a parallel but far less functional mobile site at m.gutenberg.org).

On Tue, Jan 7, 2020 at 1:06 PM Eric Hellman notifications@github.com wrote:

will there be any format variants for the author lists? Currently, autocat 3 allows a ".mobile" suffix on most uris to select the mobile version.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/gutenbergtools/autocat3/issues/43?email_source=notifications&email_token=AFQRDLR5KJILGGRKPZINKXTQ4TADDA5CNFSM4KDJYTY2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEIJX7PY#issuecomment-571703231, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFQRDLU6NV22U7AZKCOPCYTQ4TADDANCNFSM4KDJYTYQ .