Closed
Description
If a document is in a sub-directory and the execute directory is not the sub-directory, then a quarto -> docx document with a gt
table will fail to render.
This is important in particular for targets
workflows, where to have access to the targets
environment, the document is rendered with the execute_dir
at the top level.
Or at least that is the config bit I modify to be able to test document renders outside of the actual targets
workflow.
I’ve created a repo here with the files that are rendered below.
Note that d2.qmd
and doc/d1.qmd
are essentially identical documents with the same code, just their physical location in the filesystem are slightly different, and they are generating very basic gt
tables.
Top Level Renders Fine
quarto::quarto_render("d2.qmd")
## �[31m
##
## processing file: d2.qmd
## �[39m
|
| | 0%
|
|........ | 11%
## inline R code fragments
##
##
|
|................ | 22%
## label: setup (with options)
## List of 1
## $ include: logi FALSE
##
##
|
|....................... | 33%
## ordinary text without R code
##
##
|
|............................... | 44%
## label: load-targets (with options)
## List of 1
## $ include: logi FALSE
##
##
|
|....................................... | 56%
## ordinary text without R code
##
##
|
|............................................... | 67%
## label: create_table
##
|
|...................................................... | 78%
## ordinary text without R code
##
##
|
|.............................................................. | 89%
## label: gt_it
##
|
|......................................................................| 100%
## ordinary text without R code
##
##
## �[31moutput file: d2.knit.md
##
## �[39m�[1mpandoc �[22m
## to: docx
## output-file: d2.docx
## default-image-extension: png
##
## �[1mmetadata�[22m
## title: Untitled Draft
## author: Report Author
## date: '`r format(Sys.time(), ''%d %B, %Y'')`'
##
## Output created: d2.docx
In A Sub-Directory With execute_dir as Top Level
quarto::quarto_render("doc/d1.qmd", execute_dir = getwd())
## �[31m
##
## processing file: d1.qmd
## �[39m
|
| | 0%
|
|........ | 11%
## inline R code fragments
##
##
|
|................ | 22%
## label: setup (with options)
## List of 1
## $ include: logi FALSE
##
##
|
|....................... | 33%
## ordinary text without R code
##
##
|
|............................... | 44%
## label: load-targets (with options)
## List of 1
## $ include: logi FALSE
##
##
|
|....................................... | 56%
## ordinary text without R code
##
##
|
|............................................... | 67%
## label: create_table
##
|
|...................................................... | 78%
## ordinary text without R code
##
##
|
|.............................................................. | 89%
## label: gt_it
## �[31mQuitting from lines 51-58 (d1.qmd)
## Error in readLines(con, warn = FALSE) : cannot open the connection
## Calls: .main ... <Anonymous> -> enumerate_output_formats -> read_utf8 -> readLines
## �[39m
## �[31mExecution halted
## �[39m
## Error in "processx::run(quarto_bin, args, echo = TRUE)": ! System command 'quarto' failed
In A Sub-Directory With No execute_dir
quarto::quarto_render("doc/d1.qmd")
## �[31m
##
## processing file: d1.qmd
## �[39m
|
| | 0%
|
|........ | 11%
## inline R code fragments
##
##
|
|................ | 22%
## label: setup (with options)
## List of 1
## $ include: logi FALSE
##
##
|
|....................... | 33%
## ordinary text without R code
##
##
|
|............................... | 44%
## label: load-targets (with options)
## List of 1
## $ include: logi FALSE
##
##
|
|....................................... | 56%
## ordinary text without R code
##
##
|
|............................................... | 67%
## label: create_table
##
|
|...................................................... | 78%
## ordinary text without R code
##
##
|
|.............................................................. | 89%
## label: gt_it
##
|
|......................................................................| 100%
## ordinary text without R code
##
##
## �[31moutput file: d1.knit.md
##
## �[39m�[1mpandoc �[22m
## to: docx
## output-file: d1.docx
## default-image-extension: png
##
## �[1mmetadata�[22m
## title: Untitled Draft
## author: Report Author
## date: '`r format(Sys.time(), ''%d %B, %Y'')`'
##
## Output created: d1.docx
Metadata
Metadata
Assignees
Type
Projects
Status
Done