How to create references per chapter and complete references section in quarto book pdf?

  Kiến thức lập trình

I’m working on a Quarto book that I need in pdf output. I need to create references per chapter and also the complete document references.

For the references per chapter, I found the following extension:

That one solved my problem with references per chapter pretty well! Now the issue that I have is that I need to obtain the complete document references placed before my last section which is the appendices.

Here is how I’m using the lua filter:

      - section-bibliographies.lua #This is the lua filter stated above
    bibliography: rap_v002.bib
    citeproc: true 

I know that if citeproc is false is not going to generate the complete references section. If set up as true, it is going to generate the complete document references but at the very end of the document (after the appendices). I need to place those references before the appendices. This is how I have the _quarto.yml:

    - abstract.qmd
    - index.qmd
    - dedication.qmd
    - acknowledgements.qmd
    - list_abbreviations.qmd
    - chapter_1_intro.qmd
    - chapter_2_lm.qmd
    - chapter_3_ml.qmd
    - chapter_4_conclusions.qmd
    - bibliography.qmd
    - appendices.qmd

Inside the bibliography.qmd file I have the following:

# References {.unnumbered}

::: {#refs}

I understand that the lua filter changes the pandoc behavior about those #refs to create the references per chapter. I have tried to change it without success.

Do you have any recommendations on how to achieve placing the complete document references before the appendices without messing up the references per chapter already created with the lua filter?