Open AlexanderLanin opened 2 months ago
Correction: maybe the change is simple after all while preserving current behavior.
Currently when elements have the :hide:
option, they do appear in e.g. needtable
and they can be ref
erenced from needuml.
Abstract
For every element used in needuml/needarch we want to add a link to the need itself to every image it's used in. A generated "used_in_image" option. The current approach is to inject a custom uml-function (like e.g. ref), which will modify the need element when used.
However modifications to the need do not take effect, as they simply happen too late in the workflow.
Approach in Detail:
participant {{element('demo1_A')}}
(I have a workaround for getting all needs into the function via storing the app into a global variable; see also #1207)need["used_in_image"] = current_document
(full code below)Problem in Detail:
process_creator
process_need_nodes
, specificallyformat_need_nodes
See https://github.com/useblocks/sphinx-needs/blob/f3745ffd8ab9d3c3ed079554b746d0d53162fe18/sphinx_needs/needs.py#L291-L292Possible solution:
format_need_nodes
needs to called byprocess_need_nodes
. It could be called later afterprocess_creator
. Looks like it was there to avoid redundantfindall
calls, but it's not redundant (anymore).format_need_nodes
evaluates the "hide" option. Not doing so before needpie etc could change the diagrams.Not addressed here in this issue:
Code just for reference: