Repository navigation
Closed
Labels
bugSomething isn't working
Description
Describe the problem
When creating a clickable card with :link: on the card directive (https://sphinx-design.readthedocs.io/en/furo-theme/cards.html#clickable-cards) using an internal sphinx reference, if that reference doesn't exist, you get a confusing error message:
So for example in the below snippet (from the docs) with a "missing" link reference:
.. card:: Clickable Card (internal)
:link: missing
:link-type: doc
The entire card can be clicked to navigate to the ``cards`` reference target.
This gives "AssertionError: Losing "classes" attribute: ['sd-stretched-link']" error.
You can still see that sphinx also warns about an "unknown document", but it's easy to miss that in the output.
The full traceback is included below:
Details
Running Sphinx v5.0.0+/d194e0f49
...
reading sources... [100%] index
pickling environment... done
checking consistency... done
preparing documents... done
/home/joris/scipy/pandas/doc/source/index.rst:27: WARNING: unknown document: missing
Traceback (most recent call last):
File "/home/joris/scipy/repos/sphinx/sphinx/cmd/build.py", line 280, in build_main
app.build(args.force_all, filenames)
File "/home/joris/scipy/repos/sphinx/sphinx/application.py", line 343, in build
self.builder.build_update()
File "/home/joris/scipy/repos/sphinx/sphinx/builders/__init__.py", line 293, in build_update
self.build(to_build,
File "/home/joris/scipy/repos/sphinx/sphinx/builders/__init__.py", line 357, in build
self.write(docnames, list(updated_docnames), method)
File "/home/joris/scipy/repos/sphinx/sphinx/builders/__init__.py", line 528, in write
self._write_parallel(sorted(docnames),
File "/home/joris/scipy/repos/sphinx/sphinx/builders/__init__.py", line 552, in _write_parallel
doctree = self.env.get_and_resolve_doctree(firstname, self)
File "/home/joris/scipy/repos/sphinx/sphinx/environment/__init__.py", line 532, in get_and_resolve_doctree
self.apply_post_transforms(doctree, docname)
File "/home/joris/scipy/repos/sphinx/sphinx/environment/__init__.py", line 578, in apply_post_transforms
transformer.apply_transforms()
File "/home/joris/scipy/repos/sphinx/sphinx/transforms/__init__.py", line 86, in apply_transforms
super().apply_transforms()
File "/home/joris/miniconda3/envs/pandas-dev/lib/python3.8/site-packages/docutils/transforms/__init__.py", line 171, in apply_transforms
transform.apply(**kwargs)
File "/home/joris/scipy/repos/sphinx/sphinx/transforms/post_transforms/__init__.py", line 43, in apply
self.run(**kwargs)
File "/home/joris/scipy/repos/sphinx/sphinx/transforms/post_transforms/__init__.py", line 120, in run
node.replace_self(newnodes)
File "/home/joris/miniconda3/envs/pandas-dev/lib/python3.8/site-packages/docutils/nodes.py", line 1015, in replace_self
assert not self[att], \
AssertionError: Losing "classes" attribute: ['sd-stretched-link']
Exception occurred:
File "/home/joris/miniconda3/envs/pandas-dev/lib/python3.8/site-packages/docutils/nodes.py", line 1015, in replace_self
assert not self[att], \
AssertionError: Losing "classes" attribute: ['sd-stretched-link']
Reacted by Sebastian Ehlert and alexis
Metadata
Metadata
Assignees
Labels
bugSomething isn't working
Activity
jorisvandenbossche commentedon Aug 24, 2021
One additional note: this doesn't happen when using a
.. button-ref::with that link (and I was then specifically using :click-parent:` on that button inside a card, to achieve a similar goal). It kind of "ignores" the missing reference, and then sphinx also doesn't include a link target.(for context: with the pandas docs, we have the option to build a single page (to get a quick (basic) view of that page, since building the full docs takes a long time). That of course doesn't work for internal references to other pages that are then not included in the sphinx build, but for most formatting this actually works OK)
AgentDS commentedon Aug 31, 2021
I have this problem too
chrisjsewell commentedon Sep 8, 2021
ype thanks for the report, I will eventually get round to looking at this 😅