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
Only create a target for object descriptions #10478
Only create a target for object descriptions #10478
Commits on Jun 4, 2022
-
ObjectDescription: Add option :hidden:
Add option :hidden: to ObjectDescription. Currently, this option has no effect except being stored as attribute in the resulting node.
-
ObjectDescription: Hide contents if :hidden: is given
Do not produce any output only a target node if option :hidden: is given. In this case all nodes representing this ObjectDescription are replaced by a single target where the target gets assigned all ids of the replaced nodes.
-
ObjectDescription: Record source location for targets
Record the source information (class attributes source and line) when replacing an object description node with a target node.
-
ObjectDescription: Replace collect_ids() with pure function
The collect_ids() function uses the its second parameter ``ids: List[str]`` as in- and output parameter and always returns None. Rewrite the function to become pure and side effect free: return the list of ids as the return value not as an output parameter.
-
ObjectDescription: Make replace_node_with_target() a static method
replace_node_with_target() does not access the self-instance. Thus, declare it as a static method.
-
ObjectDescription: Factor out collect_ids() method
Move the collect_ids() method from inside the replace_node_with_target() into the class scope (as static method) since it does not need the closure of the surrounding replace_node_with_target() method. This also gives a potential speed boost.
-
-
ObjectDescription: Inline replace_node_with_target()
Inline the one-line method replace_node_with_target() into its only call site. Since there are no call sites left, remove the method afterwards.
-
-
-
Domain CPP: Update
option_spec
of superclass instead replacing itInstead of overriding the `option_spec` variable copy the `option_spec` of the superclass and update it. This way changes in the superclass propagate to its children. This is in line how other classes use "`option_spec`-inheritance".
-
Domain C and CPP: Drop
:notypesetting:
from alias objectThe alias objects override the run() method and thus do not support ``:notypesetting:`` option.
-
Domain JavaScript: Fix order of index and target nodes
Correct node order generated by the .. js:module:: directive: When generating an index entry, the index node must come before the target node.
-
Domain Python: Fix order of index and target nodes
Correct node order generated by the .. py:module:: directive: When generating an index entry, the index node must come before the target node.
-
ObjectDescription: Do not create a target node without ids
It might be that a object description has no ids associated with it, e.g. if the option :noindex: is passed. In this case we would replace the object description node with a target node, which has no ids. This breaks docutils assumption about a target node and leads not errors. Therefore, do only create a target node if we have ids to work with.
-
-
Reorder consecutive index and target nodes
An index directive creates a index node followed by a target node. Two consecutive index directives:: .. index:: first .. index:: second create index, target, index, target, i.e. a mixture. The interspersed index nodes prevent other transformations, e.g. PropagateTargets to properly work on the target nodes. Apply a transformation which reorders mixed and consecutive index and target nodes such that first all index nodes are before all target nodes: Given the following document as input: <document> <target ids="id1" ...> <index entries="...1..."> <target ids="id2" ...> <target ids="id3" ...> <index entries="...2..."> <target ids="id4" ...> The transformed result will be: <document> <index entries="...1..."> <index entries="...2..."> <target ids="id1" ...> <target ids="id2" ...> <target ids="id3" ...> <target ids="id4" ...>
-
Domain Python: Fix tests due to new index/target node order
The post transform ReorderConsecutiveTargetAndIndexNodes reorders index and target nodes. A snipped like:: .. py:module:: mymodule .. py:data:: myvar generates the nodes:: <index mymodule> <target mymodule> <index myvar> <descr myvar> which get reordered to:: <index mymodule> <index myvar> <target mymodule> <descr myvar>
-
-
Commits on Jul 28, 2023
-
Merge branch 'master' into object_description_run_5.x
# Conflicts: # doc/usage/restructuredtext/domains.rst # sphinx/directives/__init__.py # sphinx/domains/c.py # sphinx/domains/cpp.py # sphinx/domains/javascript.py # sphinx/domains/python.py # sphinx/transforms/__init__.py
-
-
-
-
-
-