Skip to content

Make documentation work for @multimethod functions #1921

@Joschua-Conrad

Description

@Joschua-Conrad

The Sphinx-generated documentation includes using autodoc on functions/methods, which are overloaded through multimethod. For methods (such as Location.__init__), that works just fine. The feature is enabled through doc/ext/sphinx_autodoc_multimethod.py.

However, for multimethod functions defined at the toplevel of a module, the documentation is broken:

  • edgeOn appears strange (docstring/prototype of overloaded function is just placed as-is) and raises an Inline emphasis start-string without end-string warning in build_docs.sh. The asterix marking a list of arguments in a secondary definition is interpreted wrong.
  • loft has exactly the same issues.
  • wire I guess only works, because the overloaded function has no docstring.
  • face appears strange with docstring/prototype of overloaded function placed as-is, but raises no Sphinx warning.
  • These functions have the same issue like face

I guess doc/ext/sphinx_autodoc_multimethod.py needs fixing. But to be honest, I don't understand in-detail how this Sphinx extension works, and my attempts to fix it failed. The extension was created and edited by @lorenzncode. I browsed through past PRs and issues related to the history of the Sphinx extension, but none refers explicitly to module-level functions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions