Skip to content

Commit

Permalink
Doc code revision order1 (Mathics3#986)
Browse files Browse the repository at this point in the history
Another round of incremental changes. This branch requires small tweaks
in mathics-django to keep compatibility (just about the names of certain
properties in the documentation classes)
* Start adding pytests for LaTeX documentation.
* Fix `mathics.doc.Documentation` class, which seems to be mixed and
smashed with the `DocChapter` class in an old merge.
* Split the part of the code associated with `mathics.doc.Documentation`
which does not depend on the `mathics.builtin` code, which was moved to
`mathics.doc.MathicsMainDocumentation`.
* Small tweaks and reorganization to make the code closer to the
@rocky's branch `doc-code-revision`.
* Classes that are not used like `LaTeXDocumentation` were removed.
* Tweaks to make the LaTeX documentation to compile
  • Loading branch information
mmatera authored Feb 2, 2024
1 parent f26b7a5 commit 9fd4f37
Show file tree
Hide file tree
Showing 10 changed files with 694 additions and 482 deletions.
5 changes: 3 additions & 2 deletions mathics/builtin/trace.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,8 +446,9 @@ class PythonCProfileEvaluation(Builtin):
<dd>profile $expr$ with the Python's cProfiler.
</dl>
>> PythonCProfileEvaluation[a + b + 1]
= ...
## This produces an error in the LaTeX documentation.
## >> PythonCProfileEvaluation[a + b + 1]
## = ...
"""

attributes = A_HOLD_ALL_COMPLETE | A_PROTECTED
Expand Down
7 changes: 7 additions & 0 deletions mathics/core/load_builtin.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import importlib
import inspect
import logging
import os
import os.path as osp
import pkgutil
Expand Down Expand Up @@ -144,6 +145,12 @@ def import_and_load_builtins():
"""
Imports Builtin modules in mathics.builtin and add rules, and definitions from that.
"""
# TODO: Check if this is the expected behavior, or it the structures
# must be cleaned.
if len(mathics3_builtins_modules) > 0:
logging.warning("``import_and_load_builtins`` should be called just once...")
return

builtin_path = osp.join(
osp.dirname(
__file__,
Expand Down
1 change: 0 additions & 1 deletion mathics/data/ExampleData/EinsteinSzilLetter.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,3 @@ is now being repeated.
Yours very truly,
A. Einstein
(Albert Einstein)

2 changes: 1 addition & 1 deletion mathics/data/ExampleData/Middlemarch.txt
Original file line number Diff line number Diff line change
Expand Up @@ -293,4 +293,4 @@ going about what work he had in a mood of despair, and Rosamond
feeling, with some justification, that he was behaving cruelly. It was
of no use to say anything to Tertius; but when Will Ladislaw came, she
was determined to tell him everything. In spite of her general
reticence, she needed some one who would recognize her wrongs.
reticence, she needed some one who would recognize her wrongs.
2 changes: 1 addition & 1 deletion mathics/data/ExampleData/Testosterone.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 9fd4f37

Please sign in to comment.