# CSL file not applied everywhere when having two bibliographies

Following this answer about having two bibliographies in an R Markdown document, I just saw that CSL files are not applied everywhere.

Indeed, in the example below:

---
title: "Cite R packages"
author: ''
date: ""
output:
pdf_document:
pandoc_args: --lua-filter=multiple-bibliographies.lua
bibliography_software: packages.bib
bibliography_normal: test.bib
csl: anabases.csl
---

This is a citation of a paper: @mayer2011.
This is a citation of an R package @R-dplyr
And another @R-knitr

# Bibliography{-}
\setlength{\parindent}{-0.2in}
\setlength{\leftskip}{0.2in}
\noindent
<div id = "refs_normal"></div>
\setlength{\parindent}{0in}
\setlength{\leftskip}{0in}
\setlength{\parskip}{0pt}

# Software used{-}
\setlength{\parindent}{-0.2in}
\setlength{\leftskip}{0.2in}
\noindent
<div id = "refs_software"></div>
\setlength{\parindent}{0in}
\setlength{\leftskip}{0in}
\setlength{\parskip}{0pt}

{r cite-packages, echo=FALSE}

packages_used <- c("dplyr", "ggplot2", "knitr")

knitr::write_bib(packages_used, file = "packages.bib", tweak = TRUE)




To prevent having a post too long, see here for the contents of multiple-bibliographies.lua and test.bib (packages.bib is created at the end of the .Rmd file).

In this example, I use anabases.csl just because it is easy to see if the csl file was applied or not. You can see what it looks like and download it here. The problem is this R Markdown file applies csl on the citations in text but not on the bibliographies. In the picture below, you can see that capitals are applied on the citations in text but not in the bibliographies, whereas it should be the case.

Why is that? How can I apply csl everywhere in the document?

I think this has to be done in the .lua file but not sure at all.

local tmp_meta = pandoc.Meta{bibliography = doc_meta['bibliography' .. name]}
local tmp_meta = pandoc.Meta{bibliography = doc_meta['bibliography' .. name], csl = doc_meta.csl}
in multiple-bibliographies.lua