sphinx-needs icon indicating copy to clipboard operation
sphinx-needs copied to clipboard

Custom column titles for needtable does not work for need_extra_options with "-"

Open twodrops opened this issue 2 years ago • 1 comments

If needs_extra_options definition has a "-" in its name, the custom column title for needtable results in empty table column contents.

needs_extra_options = [
    "short-description"
]
.. needtable::
  :columns: short-description as "Description"

twodrops avatar Jan 31 '23 18:01 twodrops

I have an issue somewhat related to this: If you add a % character to the title of a column, the replacement won't work at all:

.. needtable::
    :columns: id;title; modified_conditions as "MCDC Coverage %"

Here the column gets rendered as "Modified Conditions as MCDC Coverage %" and shows no data. I think this is caused by the regex used to interpret the columns titles: https://github.com/useblocks/sphinx-needs/blob/c27bc6449c0d2a106d953f4ec9e3051a9dc4500b/sphinx_needs/defaults.py#L202

Usage of this regex occurs here: https://github.com/useblocks/sphinx-needs/blob/c27bc6449c0d2a106d953f4ec9e3051a9dc4500b/sphinx_needs/directives/needtable.py#L64

([\w]+) as "([\w ]+)" does not match the inputs properly:

  • https://regex101.com/r/ZoXhkK/2
  • https://regex101.com/r/E0mjVI/1

Rubyfi avatar Dec 07 '23 14:12 Rubyfi