Skip to content

Proof of Concept: Only create a target for object descriptions#9675

Closed
ghost wants to merge 5 commits into5.xfrom
unknown repository
Closed

Proof of Concept: Only create a target for object descriptions#9675
ghost wants to merge 5 commits into5.xfrom
unknown repository

Conversation

@ghost
Copy link
Copy Markdown

@ghost ghost commented Sep 25, 2021

Subject: Only create a target for object descriptions

Feature or Bugfix

  • Feature

Purpose

Adding feature for #9662 (ability to only create a target for a domain description).

Thanks to @jakobandersen for the inspiration.

Detail

  • This is a proof of concept for implementing the replacing in the run() method.

  • [WIP] 'hidden' option for domain directives #9671 is an alternative implementation using PostTransform

  • The difference between the two is that targets in the PostTransform are not merged with the following element/node, while with the run() method they are.

  • As a consequence the targets for headings are in the section of the heading and not in the previous section.

  • Does only cover domain directives deriving from ObjectDescription other directives are (not yet) covered, e.g. .. py:module::. (However .. py:module does produce only a target and no content anyway, so is not a good example here.)

  • This is still work in progress and needs proper documentation and testing.

Relates

Latosha Maltba added 2 commits September 25, 2021 16:04
Add option :hidden: to ObjectDescription.  Currently, this option has no
effect except being stored as attribute in the resulting node.
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.
Latosha Maltba added 3 commits September 26, 2021 09:09
Record the source information (class attributes source and line) when
replacing an object description node with a target node.
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.
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" ...>
@tk0miya tk0miya changed the base branch from 4.x to 5.x May 22, 2022 12:57
@AA-Turner
Copy link
Copy Markdown
Member

Closing explicit PoC PR as there's been no discussion in six months.

A

@AA-Turner AA-Turner closed this May 23, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant