Closed florisvdh closed 4 years ago
They easiest way to test it "locally" is through Docker. The Docker image and the scripts are listed in https://github.com/inbo/inbomd_examples/blob/master/wercker.yml
The locale in the Docker image is en_US.UTF-8
. This is set by one of the parent images. Maybe you try to set the locale on your machine to en_US.UTF-8
and see if you can reproduce it.
I'll first try the second option from a shell session.
I could not reproduce it locally (with shell session as below); still shows 's.d.' here. And the bibliography correctly comes up with English terms.
What do you get when you make the Rmd file display the output of Sys.getlocale()
. Just to make sure that render
uses the locale you set at the CL.
What I could find:
Sys.getlocale()
) does not influence the language that is used by pandoc for citations. Hence, with current Rmd content it always falls back to English as a default. And at least locally, this means "s.d." (because it is defined as such for 'en' and 'nl' in our csl file) - but not on the website. I ran this with pandoc 2.3.1 (in older RStudio on bionic) and pandoc 2.7.3 (current Rstudio, on focal).lang:
in the YAML header, see here.
lang: en
, or lang: en-XY
(US, GB, AU) all gave the "s.d." result. (hence, same as without lang)lang: nl
indeed switched to Dutch bibliography./locales-af-ZA.xml:45: <term name="no date" form="short">n.d.</term>
./locales-en-GB.xml:54: <term name="no date" form="short">n.d.</term>
./locales-en-US.xml:54: <term name="no date" form="short">n.d.</term>
./locales-km-KH.xml:45: <term name="no date" form="short">n.d.</term>
./locales-mn-MN.xml:45: <term name="no date" form="short">n.d.</term>
./locales-sk-SK.xml:51: <term name="no date" form="short">n.d.</term>
Presumably the 'n.d.' result on the website just comes from en-GB or en-US, but anyhow it's weird that the English locale setting for this term in the csl is ignored. Likewise, "edn." (defined in the csl file) is not used but instead the English default "ed." for the term 'edition'. It's not clear whether explicitly setting lang: en
would affect this for the result with the docker image.
For further experimenting with this (e.g. lang: en
), the docker image would be needed indeed, though I'm hesitating to let it take my precious disk space ;-).
Anyhow, to me this remains quite a mystery. I can only think of pandoc doing this 'somehow' in the docker image (I think this runs debian buster, but it probably uses the same rstudio pandoc?). Maybe you have other ideas.
@ThierryO , in the docker image, what is the (shell) output of:
which pandoc
which pandoc-citeproc
which rstudio
rstudio --version
pandoc --version
pandoc-citeproc --version
I believe the inbomd_examples repo should reproduce what happens for the RStudio user, i.e. by using pandoc from RStudio. For shell commands (like Rscript
), I set the PATH
variable such that it first finds pandoc from RStudio, i.e. from /usr/lib/rstudio/bin/pandoc/
.
Hmm :thinking: :smile: . @ThierryO the described issue seems to be solved? That's great! What did you change?
I don't have a clue. Maybe something changed in the parent Docker image?
The csl defines a short form of the term "no date" as s.d., both for English and Dutch. When rendering from Rstudio (below pandoc statement is run), this locally results in the citation "Databank Ondergrond Vlaanderen (s.d.).".
/usr/lib/rstudio/bin/pandoc/pandoc +RTS -K512m -RTS ./index.split.md ./010_making_bib.split.md ./100_references.split.md --to html4 --from markdown+autolink_bare_uris+tex_math_single_backslash --output citation_style.html --email-obfuscation none --wrap preserve --csl /home/floris/lib/R/library/INBOmd/research-institute-for-nature-and-forest.csl --standalone --section-divs --table-of-contents --toc-depth 3 --template css/gitbook.html --highlight-style pygments --number-sections --include-in-header /tmp/Rtmp8rS0F7/rmarkdown-str14817c0b00b9.html --mathjax --lua-filter /home/floris/lib/R/library/rmarkdown/rmd/lua/pagebreak.lua --lua-filter /home/floris/lib/R/library/rmarkdown/rmd/lua/latex-div.lua --file-scope --filter /usr/lib/rstudio/bin/pandoc/pandoc-citeproc
However it appears to render on the website (5th bullet here) as "n.d.".
It may have to do with a different locale used in the build, and probably defining a locale fallback in the csl will then be the easiest way to solve this.
@ThierryO How can we test this for the build? Will I put the csl tweak in a PR of INBOmd, after which you merge in INBOmd master and retrigger the build here?
I'll also make a few updates of the report itself, regarding the issues at BBT.