-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migration of PDF documentation to ReadTheDocs #1
Comments
Here is the resulting PDF file: |
Pretty cool! |
How to continueAt this point, I have an almost fully working Sphinx documentation:
Issues:
because it does not accept LaTeX / graphics as
Questions:
|
I'd like to back up and start from the high-level goal and then work towards the details and a plan. What is happening here is a bad pattern that we've seen many times: work bottom-up, hack some code, or extend existing hacked code and hope that we'll find a high-level design and pattern somehow in this process. We want to use Sphinx in the way Sphinx is normally used because this is standard practice to provide program documentation. As we do with SymPy or Python, these tools improve on their own and we benefit from that work. Sphinx extends ReStructured text to add more book-like features that LaTeX has: table of contents, and book indexing. While this is good, we already have this via LaTeX. And Sphinx provides on-line HTML browsing which is sort of nice but we have something in Django, and how this will interact with the front-end notebook interfaces is yet to be determined. Finally, since Sphinx is written in Python and has a long history of working with Python, it has been integrated well into the Python ecosystem. What we don't want to do is replace one set of hacks with another, more elaborate, set of hacks. It is fine however to use some sort of hacky code as a means to translate from what we have to how we want to do things in the future though. So looking at Sphinx's existing API and way of doing things, I direct your attention to https://www.sphinx-doc.org/en/master/tutorial/describing-code.html and https://www.sphinx-doc.org/en/master/tutorial/describing-code.html#other-languages-c-c-others . We should follow those patterns for defining a Mathics3 domain. So a first step would be to write some sample code in a Mathics3 markup domain. Then discuss this and write the code to handle this domain. And then write a replacement Then after that is done we can start converting the existing docstrings into this new format. As for overall work planning, splitting the documentation building from Mathics Kernel was a step long asked for. One reason this is needed is because In the Mathics3 Kernel right now, we don't list dependencies on:
and if we were honest, we would. So I am glad to see a start here in a new GitHub repository. For now, I'd be happy if we just were able to build the documentation as is and then we can remove it from Mathics3 Kernel. Including additional experimental stuff for producing RsT I guess is fine to have here as well. I looked at the RST produced and it is a bit lacking were one to write in this form initially. I also note that while it is cool we can build some sort of Sphinx doc, the resulting doc is not as good as what we currently have via LaTeX. So now let me close with the matter of timing. At this point, we said we'd working on Boxing. While replacing the documentation system was always a long-term goal, it has always been a lower-priority one. It is not as important as Boxing right now in my opinion. The work involved in extending the existing conversion code hack to produce a better or a more complete Sphinx doc is in my opinion not a good use of resources right now. |
@rocky, let me answer your comments in a slightly different order. First the timing and motivation:
To work in Sphinx Documentation does not interfere too much with the release, and also helps to detect typos and inconsistencies in current documentation. So, if it is low-priority, I was right in timing: now we have documentation in a better shape than it was in the 8.0.0 release. On the other hand, it just took few days to start having a working prototype.
I think that drawing a very detailed plan at this stage would be hard, but what I have in mind is:
The previous plan goes exactly in the opposite direction, by trying to disentangle the problem in several steps achievable along a finite (but not necesarily short) extension of time.
Again, the plan is to remove step-by-step the entanglement between all these blocks of hacky code.
Actually I looked at it, but I saw that to make that graphics doctests works with it would require to me to understand better how Sphinx parses RsT. I tryied to write the code that translates our docstrings to RsT in a way that result clear which functions must be modified to produce a more standard RsT, which uses Sphinx extensions to handle doctests.
This path would be more direct if we had some experts in writing these extensions, who are committed to migrating all the documentation system (including the one in Mathics-Django). My guess is that we are not in that position, and this is why I propose the plan I mentioned at the begining of the post.
With this change, Sphinx handles almost all those dependencies. If we are able to get rid
Indeed, the RsT code that I am generating now is far from being optimal. However, once it is generated, we can modify it before rendering the documentation, to see how to improve the translator. |
At this point, I was able to build both HTML and PDF documentation using Sphinx, except for using the output of the DocTests. Then, there are two possibilities: to use asymptote to produce pdf output, or using svg to produce HTML images. Maybe we need to produce both.
The text was updated successfully, but these errors were encountered: