sphinx-needs
sphinx-needs copied to clipboard
Unable to reference need IDs containing dots using :need: directive
Description
When a need ID contains a dot (e.g., REQ_1.a), it's not possible to reference this need, for example using the :need: directive like :need:`REQ_1.a` .
This issue occurs because the function sphinx_needs.utils.split_need_id splits the provided ID at dots, which prevents proper referencing of IDs containing dots.
Steps to reproduce
- set
needs_id_regexinconf.py
needs_id_regex = r"REQ_\d\.[a-z]"
- create a need with id containing a dot:
REQ_1.a - Try to reference it using
:need:`REQ_1.a`.
in rst
.. req:: req-1
:id: REQ_1.a
requirement 1
:need:`REQ_1.a`
- The reference fails or does not work as expected
WARNING: linked need REQ_1.a not found [needs.link_ref]
Possible solution
- add documentation about main id and part id with examples.
- add configuration to allow the split or to change the split character.
- update function
sphinx_needs.roles.need_ref.process_need_refto test theneed_id_fullif theneed_id_mainis not found.
According to your answers, I can fix that with a pull request.
A dot is somehow a reserved character in Sphinx-Needs and is used to address need_parts.
This character is currently hard-coded.
I guess we should add some docs to need-id description to explain this in all related docs.