sphinx-needs icon indicating copy to clipboard operation
sphinx-needs copied to clipboard

Bug: needextract does not support "layout" anymore

Open danwos opened this issue 1 year ago • 1 comments

Setting layout in needextract does not have any effect. Instead, the original layout is taken.

You can see this also in our documentation: https://sphinx-needs.readthedocs.io/en/latest/directives/needextract.html#layout

The results do not use the set layout focus_r from above.

image

danwos avatar Feb 13 '24 18:02 danwos

@danwos to note, I'm not sure if this ever actually worked 😅; there is an old version 1.2.0 build still available on RTD, and you can also see it does not work there: https://sphinx-needs.readthedocs.io/en/rtd_jaav/directives/needextract.html#layout its certainly not a new problem (more than a year old)

I've found why, but don't have a solution available yet. Here: https://github.com/useblocks/sphinx-needs/blob/c394b1f7489dcda8ffdcce6d5d24e396d9808925/sphinx_needs/layout.py#L106

The need_container looks like this initially: <container><Need>...</></>, but then because this now gets processed by all the post-transforms, including the one to transform needs, afterwards it looks like: <container><container classes="need_container" ids="SNCB-c3f165af"><table ..., i.e. you have already turned it in to a table,
so then when you run build_need in the next lines, it doesn't do anything because the need is already built.

In https://github.com/useblocks/sphinx-needs/pull/794, you actually added a commented out line: # node_container += needs[need_id]["need_node"].children. This feels more like what is meant to happen, i.e. only the children should be "re-processed", not the whole need node.

chrisjsewell avatar May 31 '24 04:05 chrisjsewell

fixed in #1249

chrisjsewell avatar Aug 28 '24 11:08 chrisjsewell