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

"No needs passed the filter" warning configurable?

Open kreuzberger opened this issue 2 years ago • 3 comments

I have some usecases where i show and filter some imported needs with e.g. needtable. If the filter has no needs found, i get the above text in my (German) document and the "header" for the table is shown.

Use Case

The directive e.g. needtable has a filter option with empty (no needs) result.

Desired Behaviour

If "no needs passed the filter" the output should be configured in the directive as option, e.g.

.. needtable:: 
   :filter: "Test" in tags
   :filter_warning: "Keine Tests definiert"
  • The output should show the warning.
  • If no warning is given, the output should contain
    • The current text
    • A global configured error text (conf.py)
    • Nothing (e.g. if global configured error text is empty)
  • Any content (in table case the header columns) should not be rendered

Context This might be helpfull for all directives using filter option

kreuzberger avatar Jul 13 '23 07:07 kreuzberger

Good point, the output is not configurable and does not support other languages.

I'm not sure, if this should be given by a directive option or if a variable in conf.py may be better. Maybe we can provide multiple translations, which are selected by the standard sphinx translation solution. Have to check this.

danwos avatar Jul 26 '23 07:07 danwos

The filter option has the advantage that the message could be more or less "context" sensitiv. Translations may be not required in this case, cause e.g the column names used for needtable etc are also "language" specific. So if "no needs passed the filter" you can give a specific warning e.g. "Keine Anforderungen gefunden" if you filter for "req". But a "general", "global" conf.py variable may also help if not specific directive option is provided

kreuzberger avatar Jul 26 '23 07:07 kreuzberger

Maybe a complete "no output" could also be desirable, so if no needs passes the filter, no table, list, plot etc would be visible at all, together with an warning during build.

kreuzberger avatar Jul 26 '23 10:07 kreuzberger