Skip to content

Unable to reference need IDs containing dots using :need: directive #1434

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

Open
PierreEtienneJ opened this issue Apr 6, 2025 · 1 comment · May be fixed by #1435
Open

Unable to reference need IDs containing dots using :need: directive #1434

PierreEtienneJ opened this issue Apr 6, 2025 · 1 comment · May be fixed by #1435

Comments

@PierreEtienneJ
Copy link

PierreEtienneJ commented Apr 6, 2025

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

  1. set needs_id_regex in conf.py
needs_id_regex = r"REQ_\d\.[a-z]"
  1. create a need with id containing a dot: REQ_1.a
  2. Try to reference it using :need:`REQ_1.a` .

in rst

.. req:: req-1
    :id: REQ_1.a

    requirement 1

:need:`REQ_1.a`
  1. The reference fails or does not work as expected
 WARNING: linked need REQ_1.a not found [needs.link_ref]

Possible solution

  1. add documentation about main id and part id with examples.
  2. add configuration to allow the split or to change the split character.
  3. update function sphinx_needs.roles.need_ref.process_need_ref to test the need_id_full if the need_id_main is not found.

According to your answers, I can fix that with a pull request.

PierreEtienneJ added a commit to PierreEtienneJ/sphinx-needs that referenced this issue Apr 6, 2025
@PierreEtienneJ PierreEtienneJ linked a pull request Apr 6, 2025 that will close this issue
@danwos
Copy link
Member

danwos commented Apr 15, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants