Manually setting parent_needs #1608
Replies: 2 comments
-
|
This topic has a bigger scope unfortunately:
Please comment whether I understood you right and what your preferred solution is. Cannot promise an implementation or a timeline, let's first see what the requirement would be. Thanks for your PR. Unfortunately, I can also say that this will not be enough. As outlined above, the field is calculated and has a clear semantics, so overwriting it does not make sense. |
Beta Was this translation helpful? Give feedback.
-
I wondered if I should just add my own link type, with needs_extra_links. Call it I could then hook into
I'm aware of that, and I would like to keep the calculated values from nesting, just add them to the manually specified ones instead of overwriting them. That's why #1609 just turns I very much would like to keep the ability to quickly draft an outline with list2need, and later on, when working on the details of the need, turn it into a free-standing need, but preserve the parent/child relationship by manually specifying the parent. Is there some reason why a calculated field can not also be specified manually? In my use-case, it would be either/or, but since it is a list anyway, it could even be both, calculated and manually specified, resulting in the union of both. And the PR does that. Would this reason also apply to my own link type, so my plan outlined above ( Also note that today it is already possible to overwrite
Does it? Why does the target format have to understand the semantics of nesting, and can't treat it as "just another link type"?
It is indeed a bit annoying to have the nested needs appear twice in the JSON, but is it really worsened by the ability to specify Actually, I would prefer having the nested needs never appear in the
Well, I'm not suggesting to add that - it already exists, and I'm mostly happy with how it is implemented. Do you plan removing support for nesting? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Manually setting
parent_needsdoesn't work. The setting gets overwritten by what sphinx-needs figures out to be the parent according to the nesting in the rst source.Is this intended behaviour (
parent_needsis meant to be readonly) or should it be possible to manually setparent_needs?The use-case is defining child needs somewhere else, usually in a separate file, than where the parent is defined.
If it's not possible to use
parent_needsfor parent-child relationships, you'd have to define a custom "parent" option. And that would not work out of the box with.. needflow, for example.Currently, you can use
.. needextendto overwriteparent_needs. But ifparent_needsis meant to be readonly, I guess you can't trust that this works in future versions of sphinx-needs.And it doesn't work reliably even now. When it's in the same rst file as the child need, it seems to work. But when it is with the parent need, theparent_needsare not shown as outgoing links in the child.Edit:
.. needextendseems to always work. Can't reproduce the strange observation aftermake clean.Edit: The change to allow setting
parent_needsmanually would be trivial.Just replace one
=by+=:If there are no objections, I would create a PR for this. I just have to figure out how to make a test case for it.Edit: Here's the PR: #1609
Beta Was this translation helpful? Give feedback.
All reactions