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

topics cannot be excluded from reference index sections #2040

Closed
bastistician opened this issue Feb 15, 2022 · 1 comment · Fixed by #2119
Closed

topics cannot be excluded from reference index sections #2040

bastistician opened this issue Feb 15, 2022 · 1 comment · Fixed by #2119
Labels
bug an unexpected problem or unintended behavior reference 📚
Milestone

Comments

@bastistician
Copy link
Contributor

The documentation on topic matching says:

Use a leading '-' to remove topics from a section, e.g. '-topic_name', '-starts_with("foo")'.

AFAIK, this is to allow for exclusion of specific topics in one set of references, for example:

- contents:
  - has_keyword("datasets")
  - -foodata

This has worked in version 1.6.1 but it no longer does as from 2.0.0 -- most likely because of the changes in #1664. Topics are no longer selected based on the whole pattern vector (select_topics(section$contents, pkg$topics), but one-by-one (purrr::imap(section$contents, content_info, pkg = pkg, section = index)). The above exclusion pattern actually leads to the inclusion of all topics.

Test code:

ref <- list(
  list(contents = c("matches('[ab]')", "-b")),  # only a
  list(contents = c("b", "c", "?", "e"))        # all but a
)
meta <- list(reference = ref)
pkg <- as_pkgdown(test_path("assets/reference"), override = meta)
lapply(data_reference_index(pkg)$rows, `[[`, "names")

Observed result (in 2.0.2):

[[1]]
   a.Rd    b.Rd    c.Rd    e.Rd help.Rd 
    "a"     "b"     "c"     "e"     "?" 

[[2]]
   b.Rd    c.Rd help.Rd    e.Rd 
    "b"     "c"     "?"     "e" 

Expected result (as in 1.6.1):

[[1]]
a.Rd 
 "a" 

[[2]]
   b.Rd    c.Rd help.Rd    e.Rd 
    "b"     "c"     "?"     "e" 
@maelle maelle added bug an unexpected problem or unintended behavior reference 📚 labels Feb 16, 2022
@maelle
Copy link
Collaborator

maelle commented Feb 16, 2022

Thanks for catching & reporting this @bastistician! There is a draft PR in #2041 (however with no expected time of completion at the moment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior reference 📚
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants