Skip to content

Commit 738123e

Browse files
committed
allowing load chapters for Pymathics modules
1 parent 8170935 commit 738123e

File tree

1 file changed

+9
-17
lines changed
  • mathics_django/web/controllers

1 file changed

+9
-17
lines changed

mathics_django/web/controllers/doc.py

+9-17
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Controllers related to showing Mathics3 documentation inside Django
33
"""
44

5+
import logging
56
from copy import copy
67
from typing import Union
78

@@ -31,12 +32,13 @@ def check_for_pymathics_load():
3132
print("XXX refresh pymathics doc", pymathics_modules)
3233
new_modules = pymathics_modules - seen_pymathics_modules
3334
for new_module in new_modules:
34-
title, _ = get_module_doc(new_module)
35+
print("loading ", new_module)
3536
mathics3_module_part = documentation.parts_by_slug.get(
3637
"mathics3-modules", None
3738
)
3839
# If this is the first loaded module, we need to create the Part
3940
if mathics3_module_part is None:
41+
logging.warn("Mathics3 Module Part not loaded. Loading it")
4042
mathics3_module_part = self.doc_part(
4143
"Mathics3 Modules",
4244
pymathics_modules,
@@ -46,25 +48,15 @@ def check_for_pymathics_load():
4648
seen_pymathics_modules = copy(pymathics_modules)
4749
return
4850

49-
# The part already exists. Lets add the new chapter.
50-
51-
chapter = mathics3_module_part.doc.gather_chapter_doc_fn(
52-
mathics3_module_part,
53-
title,
54-
mathics3_module_part.doc,
55-
)
56-
from trepan.api import debug
57-
58-
debug()
59-
submodule_names_seen = set()
60-
chapter.doc.doc_chapter(
51+
# The "Mathics3 modules" part already exists. Lets add the new chapter.
52+
print("loading the new chapter")
53+
chapter = documentation.doc_chapter(
6154
new_module,
6255
mathics3_module_part,
63-
pymathics_builtins_by_module,
64-
seen_pymathics_modules,
65-
submodule_names_seen,
56+
pymathics_builtins_by_module
6657
)
67-
chapter.get_tests()
58+
mathics3_module_part.chapters.append(chapter)
59+
6860
seen_pymathics_modules = copy(pymathics_modules)
6961
pass
7062

0 commit comments

Comments
 (0)