Closed AndrewVSutherland closed 4 years ago
Just a link to point to a time when we had these yaml files, as I will delete them in a PR to not confuse people. https://github.com/LMFDB/lmfdb/tree/ef9532ffa78f13c84cf8c1c7c9fb9c50fbec9dcb/lmfdb/lfunctions/templates
We should still use Jinja to generate those tables
Why? I'm not convinced that the effort to auto-generate them (and the time wasted every time someone goes to make an update and has to figure out what to do) is less than the effort to maintain the html files, which is minimal. Other than the formatting changes Jen just made and I think David Farmer and I are the only ones who have touched these files in the past four yeas, and most of the changes we made (like Jen's) involved formatting changes or hiding links that would have been more work to implement if we had not just directly edited the html, and I doubt that collectively we have spent more than an hour or two maintaining these pages during that time.
I don't think it makes sense to spend time and effort designing and implementing a solution that is almost certainly going to involve more effort than the problem it is trying to solve. But maybe I'm missing something?
I seem to remember that @davidfarmer used to manage these with a perl (?) script to convert the yaml to html. Unless there are factors I don't know about I would agree with @AndrewVSutherland on this: just edit the html.
Other places where we try to autogenerate are:
@JohnCremona I definitely think that we should be auto-generating the sidebar html (I shudder at the thought of trying to maintain the sidebar html by hand) and the citation list -- in both cases it's clear that the cost of implementing and maintaining the code that generates the output is less effort than it would be to maintain the output directly (and even when the auto-generating solution isn't perfect, it's better than hand-editing would be). I just don't think that is true here.
I also think that the L-function browse pages are likely to change a lot when we implement L-function search pages (#3117). I think we should just close this issue, but I'll give @edgarcosta a chance to respond first.
Fair enough (re the sidebar) -- but it would be better if the autogeneration could be done just once and not when every page is created. (I may be wrong that that is what is happening, it would depend on how flask works.) Since programming in python is rather easier than programming in jinja (!) we could have the sidebar initialization (which already happens) create sidebar.html from scratch -- at the moment that is a template. To be fair, when we rewrote the sidebar a few years ago that is how @davidfarmer originally did it and I thought I knew better.
I don't know who made the Perl scripts to generate the html files, but this was most likely before us using flask+jinja. I believe that the right way to maintain those tables is with Jinja, as Jinja reads the yaml, and then generates a line by line in a for loop. Thus style changes like #3461 are done editing the inner loop in the template, and data changes are done by changing the yaml.
I don't have the time right now to give you a sketch, but here is what I do in beantheory.org : https://github.com/edgarcosta/beantheory/blob/master/_includes/talks_block.html (this is in Jekyll, but is almost the same thing as Jinja)
The files degree?browsetable.yaml in lmfdb/lfunctions/templates which at one time were used to generate the HTML pages for the browse pages are out of date. They should be recreated using the content of the Degree?.html pages and we should then switch to having jinja render the yaml dynamically and get rid of the Degree?.html files.
Until this issue is addressed, the Degree?.html files should be considered the correct source of information for the L-function browse pages, not the yaml files.