Skip to content

Commit

Permalink
docs(quarto): extend comments in quarto files
Browse files Browse the repository at this point in the history
  • Loading branch information
mutlusun committed Oct 14, 2024
1 parent 1c7f122 commit 0e784a9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 6 additions & 2 deletions R/tar_quarto_files.R
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,17 @@ tar_quarto_files_document <- function(path) {
)
}

# Collect data about input files.
# Collect data about input files. It seems that quarto only puts the main
# rendering file (in this case `path`) into `fileInformation`. Even though
# included files might include other files, they still appear in
# `includeMap$target` and not as an own `fileInformation` entry.
for (myfile in names(info$fileInformation)) {
out$input <- c(
out$input,
# `myfile` are relative paths starting from `path`.
myfile,
# `includeMap` contains relative paths starting from `myfile`.
# `includeMap` contains relative paths starting from `myfile`. We can use
# `dirname(path)` here as this is the directory of `myfile`.
file.path(
dirname(path),
info$fileInformation[[myfile]]$includeMap$target
Expand Down
8 changes: 4 additions & 4 deletions tests/testthat/test-tar_quarto_files.R
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,15 @@ targets::tar_test("tar_quarto_files() detects non-code dependencies", {
"output_format: html",
"---",
"",
"{{< include \"text1.qmd\" >}}",
"",
"{{< include \"subdir/text2.qmd\" >}}"
"{{< include \"text1.qmd\" >}}"
)
writeLines(lines, file.path("report", "main.qmd"))
lines <- c(
"# First File",
"",
"Some text here."
"Some text here.",
"",
"{{< include \"subdir/text2.qmd\" >}}"
)
writeLines(lines, file.path("report", "text1.qmd"))
lines <- c(
Expand Down

0 comments on commit 0e784a9

Please sign in to comment.