Skip to content
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

Exerciselist doesn't work in the singlehtml build (nor pdf) #107

Open
rkdarst opened this issue Oct 23, 2024 · 1 comment
Open

Exerciselist doesn't work in the singlehtml build (nor pdf) #107

rkdarst opened this issue Oct 23, 2024 · 1 comment

Comments

@rkdarst
Copy link
Member

rkdarst commented Oct 23, 2024

It's also now causing an exception in python-for-scicomp, which needs immediate fixing. My current hypothesis is that in the singlehtml build it's initializing things in a different order, before the exerciselist node gets init and sets the expected instance attributes. I don't know why it gets ordered this way yet.

Exception occurred:
  File "/home/rkdarst/git/python-for-scicomp/venv/lib/python3.11/site-packages/sphinx_lesson/exerciselist.py", line 128, in process_exerciselist_nodes
    if not is_exercise_node(exercise_node, include_classes=exerciselist_node.include_classes, exclude_classes=exerciselist_node.exclude_classes):
                                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'exerciselist' object has no attribute 'include_classes'
  File "/home/rkdarst/git/python-for-scicomp/venv/lib/python3.11/site-packages/sphinx/cmd/build.py", line 337, in build_ma>
    app.build(args.force_all, args.filenames)
  File "/home/rkdarst/git/python-for-scicomp/venv/lib/python3.11/site-packages/sphinx/application.py", line 378, in build
    self.builder.build_update()
  File "/home/rkdarst/git/python-for-scicomp/venv/lib/python3.11/site-packages/sphinx/builders/__init__.py", line 294, in >
    self.build(['__all__'], to_build)
  File "/home/rkdarst/git/python-for-scicomp/venv/lib/python3.11/site-packages/sphinx/builders/__init__.py", line 367, in >
    self.write(docnames, list(updated_docnames), method)
  File "/home/rkdarst/git/python-for-scicomp/venv/lib/python3.11/site-packages/sphinx/builders/singlehtml.py", line 161, i>
    doctree = self.assemble_doctree()
              ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rkdarst/git/python-for-scicomp/venv/lib/python3.11/site-packages/sphinx/builders/singlehtml.py", line 85, in>
    self.env.resolve_references(tree, master, self)
  File "/home/rkdarst/git/python-for-scicomp/venv/lib/python3.11/site-packages/sphinx/environment/__init__.py", line 699, >
    self.apply_post_transforms(doctree, fromdocname)
  File "/home/rkdarst/git/python-for-scicomp/venv/lib/python3.11/site-packages/sphinx/environment/__init__.py", line 711, >
    transformer.apply_transforms()
  File "/home/rkdarst/git/python-for-scicomp/venv/lib/python3.11/site-packages/sphinx/transforms/__init__.py", line 93, in>
    super().apply_transforms()  # type: ignore[misc]
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/rkdarst/git/python-for-scicomp/venv/lib/python3.11/site-packages/docutils/transforms/__init__.py", line 182,>
    transform.apply(**kwargs)
  File "/home/rkdarst/git/python-for-scicomp/venv/lib/python3.11/site-packages/sphinx_lesson/exerciselist.py", line 182, i>
    process_exerciselist_nodes(self.app, doctree, self.env.docname)
  File "/home/rkdarst/git/python-for-scicomp/venv/lib/python3.11/site-packages/sphinx_lesson/exerciselist.py", line 128, i>
    if not is_exercise_node(exercise_node, include_classes=exerciselist_node.include_classes, exclude_classes=exerciselist>
                                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'exerciselist' object has no attribute 'include_classes'

@rkdarst
Copy link
Member Author

rkdarst commented Oct 23, 2024

My plan is to set class attributes so at least the build works, and then work on solving it later.

The fix isn't much of a regression because even looking at existing lessons like git-intro, the exercise list is missing from the singlehtml and pdf builds.

rkdarst added a commit that referenced this issue Oct 23, 2024
- Ref: #107
- There was a problem where the includenodes and excludenodes
  attributes aren't set in singlehtml and pdf builds.  I guess it's
  something about the order of initialzation being wrong.  Anyway, in
  existing builds these aren't correct and the exercise list appears
  empty.  This fixes builds and then we can fix things more later.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant