Giter VIP home page Giter VIP logo

Comments (3)

chrisjsewell avatar chrisjsewell commented on August 17, 2024

Thanks for the feedback.

Specifically in -summary you can prepend items by ~ to only show the last part (see https://sphinx-autodoc2.readthedocs.io/en/latest/summary.html)

I'm surprised about the hello.rst#Foo.Bar.Foo.Bar.Baz, I don't think this should be directly related to do what is displayed.
Perhaps you could show the result of

.. autodoc2-object:: xxx
    :literal:

from sphinx-autodoc2.

DatGuy1 avatar DatGuy1 commented on August 17, 2024

Here is a screenshot. Not really the best medium but it captured everything I wanted in one. The WindowsToaster class is output from auto_mode, the center is :literal:, and the bottom is autodoc2-object.

from sphinx-autodoc2.

PMeira avatar PMeira commented on August 17, 2024

I did some testing, and it seems the issue with duplicated names in the node_id only happens when using autodoc2-object with e.g. classes, while it seems to work OK with modules. In auto_mode, things work fine since it uses whole modules/packages.

I compared the literal output with the code from the auto_mode version, and the only notable difference is the absence of :py-module: (regardless if this is the issue or not, would emitting :py-currentmodule: be useful?). If I paste the literal code, prepending it with :py-module:, the node_ids are generated OK. But if I prepend the autodoc2-object with :py-module:, it doesn't seem to change anything.

I would have no idea how to fix this, but it seems that some context is being lost when using autodoc2-object with classes vs. modules/packages (for the time being, I'm monkey-patching sphinx.domains.python.PyObject.add_target_and_index to my package, that seems to be enough to generate better node_ids).

To reproduce:

  • Create amod.py in an empty folder:
class AClass:
    """AClass is a class"""

    AAttr = 123
    """Something 123"""
  • Run sphinx-quickstart
  • Append to conf.py:
extensions = [
    "autodoc2",
]
autodoc2_packages = [
    {
        "path": "./amod.py",
        "auto_mode": False
    },
]
  • Add .. autodoc2-object:: amod.AClass to index.rst.
  • Build it.

from sphinx-autodoc2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.