pbs-assess / csasdown

:book: An R package for creating CSAS reports in PDF or Word format with R Markdown and bookdown
Other
47 stars 17 forks source link

Errors on csasdown::render() with some French documents #238

Closed seananderson closed 11 months ago

seananderson commented 1 year ago

Unit test failure here: https://github.com/pbs-assess/csasdown/blob/417f88c274099184c16470a5ec04a7759fec6598/tests/testthat/test-fix-envs.R#L91-L96

Error:

Error in `ans[ypos] <- rep(yes, length.out = len)[ypos]`:
! replacement has length zero
Backtrace:
 1. base::ifelse(fr(), meta$french_title, meta$title)

I assume this is related to having to revert to bookdown::render_book("index.Rmd") in some of the unit tests for French documents.

cgrandin commented 1 year ago

This is because the SR now has title_other: in the index.Rmd YAML instead of french_title: for some reason but the error checking code also expects it (weird). Is there a reason that it needs to be title_other: or can I change that back to french_title: like the rest of the doc types? It requires a bit more work to fix the error checking code as well.

seananderson commented 1 year ago

I guess that wasn't that long ago: https://github.com/pbs-assess/csasdown/commit/85cc4dda03d6513c11350f7f607cce1cacb6bf6a

The issue is the same index.Rmd is used for English and French docs. In the resdocs, the other language citation is written out: https://github.com/pbs-assess/csasdown/blob/5fca72471dcb59199d5022642e2fd08cd3a452a7/inst/rmarkdown/templates/resdoc/skeleton/skeleton.Rmd#L31

But the SR figures out that other language citation based on the other title arg. So, for a French document, that 'other' YAML arg should be the English title.

I don't know what's best to do here also thinking about backwards compatibility.

seananderson commented 11 months ago

Fixed here as described in the NEWS.md here.