Skip to content

rmarkdown expects list of dependencies to be unnamed #533

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

Merged
merged 1 commit into from
Apr 18, 2023

Conversation

cderv
Copy link
Contributor

@cderv cderv commented Apr 5, 2023

This property is used in HTML or LaTeX deps resolution to know when to be recursive.

This is caused by changed in cc80516 which introduced the name

Quite specific case encountered with Quarto processing at quarto-dev/quarto-cli#5093. This PR solves quarto-dev/quarto-cli#5093 (comment) issue

You could also remove the name completely inside list_latex_dep()

Regarding the convention, this is here in rmarkdown
https://github.com/rstudio/rmarkdown/blame/main/R/html_dependencies.R#L382-L400

has_dependencies <- function(knit_meta, class) {
  if (inherits(knit_meta, class))
    return(TRUE)
  if (is.list(knit_meta)) {
    for (dep in knit_meta) {
      if (is.null(names(dep))) { # <<- if unnamed we considered we should recurse
        if (has_dependencies(dep, class))
          return(TRUE)
      } else { # <<- if named then we check if it inherits the class, as a html / latex dependency would
        if (inherits(dep, class))
          return(TRUE)
      }
    }
  }
  FALSE
}

This property is used in HTML or LaTeX deps resolution to know when to be recursive

Quite specific case encountered with Quarto processing at quarto-dev/quarto-cli#5093
@cderv cderv changed the title rmarkdown expect list of dependencies to be unnamed rmarkdown expects list of dependencies to be unnamed Apr 5, 2023
@davidgohel
Copy link
Owner

Thank you @cderv, much appreciated - you saved me hours

@davidgohel davidgohel merged commit e3a0b0c into davidgohel:master Apr 18, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants