-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Needs list shall take into account "only" directive #1103
Comments
Heya, oo tricky one So, setting aside the logic of how to actually use this data for now, I think we may be able to capture the Here you see we already capture what parent sections the need is under, so we may be able to do the same thing to capture what parent sphinx-needs/sphinx_needs/directives/need.py Line 288 in 4faedec
|
would removing the nodes as it is done for hidden needs be sufficient ? |
Only about display Remove data at this stage is not viable, because it would not work for multiple (cached) builds, using different tags / builders, i.e. subsequent builds would always have this data removed, even if you change the tags The cached data (from the read phase) needs to be agnostic of builder / tags, |
Thanks for the explanation. Anyway, adding a field to the needs is ok. I propose to add boolean field named "excluded_by_only". I think excluding from the html builder is already handled. |
I somehow hate the For me, the builder, somewhere in Sphinx, or the For the above reason, I needed to add an I also see a lot of corner cases, if the need-directive is embedded inside other needs (list-tables, container, other needs, ...). I'm currently not sure what the best solution is. |
Do you mean if the if-builder accepted tags it could greatly replace the only ? (I didn't check the code, sorry) Maybe adding the boolean field at the need level is an acceptable first step for the moment as it will allow to manually filter in needs.json or needtables and so on. I just have to ensure it is correctly computed for nested containers. But this is not very user friendly and should be documented so that users do not forget to manually filter this boolean field when they are using the only directive. edit: another possibility, instead of the boolean would be to copy the tags from the only level to the need, so manually filtering would be more comprehensible for user. Either by appending the the tags field (which content will be displayed, so maybe not the better for user) or by adding a new field. edit-2: |
Will hopefully find some time to review the PR again soon. In the meantime, yes Maybe a small, new sphinx extension Regarding edit-2: I guess this is the way to go. Only having the data inside |
Do you think we have to create a new, independent, sphinx extension of just improve the if-builder to accept tags ? I have to discuss with my teammates but as only is an important feature for our users we could take time to create this directive. Or would you prefer to handle it on your own ? |
Technically we could do it everywhere, but using an updated So, I guess a small standalone Sphinx extension would be much cleaner. And I would be grateful if you could support me here and create the initial extension. |
Hello, I implemented (for the moment locally in our gitlab, not on github) the "only-tags" and "only-builder" directives based on what was made in sphinx-simplepdf. If I do for example:
I get the right toctrees and navigation links in the generated documents based on different builders. Do you have an idea of how I can exclude them from generation or else from search result ? Regards |
Argh, that may be tough, as Sphinx generates automatically all I'm not sure if exlude_patterns could be set programmtically. |
When using the only directive some needs may require to be excluded from the needs list, i.e. from needs.json, needtable, needpie ...
For example:
in this case when I don't build tag1, I don't want req-001 to appear in needs.json or in needtable
Do you agree about the expected behaviour ?
Do you know if while processing the need level we are able to know that the element is under an "only" block ?
just for information, we found this interesting extension which can be inspiring: https://github.com/pfalcon/sphinx_selective_exclude
The text was updated successfully, but these errors were encountered: