Skip to content
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

Filtering with needs_variants #1408

Open
kreuzberger opened this issue Feb 20, 2025 · 0 comments
Open

Filtering with needs_variants #1408

kreuzberger opened this issue Feb 20, 2025 · 0 comments

Comments

@kreuzberger
Copy link
Contributor

I've created a needs_variant like from the examples

needs_variants = {
  "var_a": "'var_a' in sphinx_tags"  # filter_string
}

and added an option to evaluate this variant

needs_variant_options = ["var"]
needs_extra_options = ['var']

I assume to use this now as

.. req:: WOW
  :id: ABC
  :var: var_a

Expected is now that the value of var evaluates to bool.

If i now use this in a filter string, the filter does generate an error:

.. need_table::
  :filter:  "ABC" in id and var
sphinx_needs.api.exceptions.NeedsInvalidFilter:-1: Filter "'ABC' in id and var" not valid. Error: Filter did not evaluate to a boolean, instead <class 'str'>: .

cause it seems that the variant is not evaluated. How could this be evaluated for filtering?

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

No branches or pull requests

1 participant