sphinx-needs
sphinx-needs copied to clipboard
Create needextract or needextend as target link
We have a usecase where we import information from an external tool and automatically create need objects for the imported elements. Just like with needimport
, the imported elements are then linked from other existing needs or extended using needextend
or by adding textual contents around a needextract
in different rST pages.
For example,
import-page.rst:
.. needimport::
:filter: type == 'tool-element'
another-page.rst:
.. needextend:: TOOL_ELEMENT_01
:+implements: REQ_SW_01
.. needextract::
:filter: "TOOL_ELEMENT_01" in id
By default, when the imported elements are linked in this way, the HTML navigation always points to the page where the needs are imported (which is a page with a large number of imported elements). It would be nice to have a feature where a needextract
or needextend
can be declared as the link target for a need and not the original (imported) need.
This helps to navigate to the need which has more details than the "raw" imported ones.
Points to consider
-
needextract
orneedextend
could filter multiple elements. How to make sure target links are created for single elements -
needextract
could extract the same need in multiple pages. How to mark only a singleneedextract
as target link
Nice idea. For needextract
this is possbile, but not for needextend
, becauseito does not write any output to the HTML. So it can't be a link target.
For needextract
I suggest a new option: is_target
.
Which is just a flag, no values are allowed.
If is_target
is set, the target-element (node) of the original need gets deactivated/removed.
And the created need (the one by needextract
) gets a target-node with the same ID as the original one.
is_target
is used for all needs, which are created/filtered by needextract
.
If multiple needextract
are using is_target
for the same need, the first one wins (maybe a warning can be written).
"First one", because the algorithm checks if the original need still has a target-node. If not, another needextract
must have "stolen" it already.
ah, you are right on needextend
that it does not have an HTML representation and cannot be used.
I like your proposol of is_target
. Let's explore that futher.
Any updates regarding this issue? Was blocked by it...
Not really. Some tests were made to reset the link-target in Sphinx. But somehow Sphinx does not really accept these changes and is still using the original links/references.
Hi, the solution with an is_target
flag for needextract
would be sufficient and very useful from my point of view. Can we expect that any time soon?
Sorry to say, but not from my side, as the available time is quite low. But I would happily support everybody, who jumps in and tries to make this possible.