Skip to content

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

Open
@PierreEtienneJ

Description

@PierreEtienneJ

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions