ropensci-review-tools / babelquarto

Renders a Multilingual Quarto Project (Book or Website)
https://docs.ropensci.org/babelquarto/
Other
40 stars 7 forks source link

Babelquarto now fails with books that have parts #72

Closed Nenuial closed 2 months ago

Nenuial commented 2 months ago

I'm running into problems with my multilingual book. I believe it has something to do with the fact that a book with parts has multiple chapters key under book/chapters (see Quarto docs).

Apparently during the refactoring along with #64, some changes in the way chapters are handled introduced this issue. I was able to trace the problem to commit 96669dff138069488d8d4068c0988eb4291dd3b0. However despite my best efforts, I wasn't really able to understand why this now fails…

Reverting 96669dff138069488d8d4068c0988eb4291dd3b0 would solve the issue, but I don't really understand why and that annoys me!

I've setup a reprex here: https://github.com/Nenuial/babeltest

Nenuial commented 2 months ago

Oh I forgot. The error is:

Error in `map()`:
ℹ In index: 1.
Caused by error in `purrr::map()`:
ℹ In index: 2.
Caused by error in `enc2utf8()`:
! argument is not a character vector

The error is apparently raised by fs::file_exists(chapters_list[["chapters"]]) but I can't understand why the error is raised when this function is inside all() and not when inside any() 🤷‍♂️

maelle commented 2 months ago

can you revert it for now though? and add a test case so I don't break this again :see_no_evil:

this looks really weird :exploding_head:

Nenuial commented 2 months ago

and add a test case so I don't break this again 🙈

This is done in PR #74. I've cherry-picked 96669dff138069488d8d4068c0988eb4291dd3b0 to check that the test fails and it does.

Nenuial commented 2 months ago

This is fixed by the revert.

https://github.com/ropensci-review-tools/babelquarto/blob/77b590853ebd5fbb30d1983ab85610c13c50ff23/R/render.R#L299

This checks for any missing file and can't be replaced by all(fs::file_exists()).