reference section not generated for unnumbered chapters
mikabr opened this issue · 3 comments
I have an unnumbered chapter (a preface) that should have citations and references just like other chapters, but the filter doesn't appear to generate a reference section for it. (running quarto 1.3.433)
Minimal example:
---
format: pdf
bibliography: example.bib
reference-section-title: References
filters:
- section-bibliographies
citeproc: false
---
# Preface {-}
text citing @frank2012
# Chapter 1
text citing @lewis1973
# Chapter 2
text citing @kraus2019
Contrast with running pandoc's default citation handling, which does include the unnumbered chapter:
---
format: pdf
bibliography: example.bib
reference-section-title: References
citeproc: true
---
# Preface {-}
text citing @frank2012
# Chapter 1
text citing @lewis1973
# Chapter 2
text citing @kraus2019
Seems like this could be due to the filter checking that a section has a number attribute in line 23?
local function is_section_div (div)
return div.t == 'Div'
and div.classes[1] == 'section'
and div.attributes.number
end
I ran into this issue as well. I am not familiar with Lua and so my solution probably isn't best, but I was able to get the code to work by changing the following:
On lines 20-24:
local function is_section_div (div)
return div.t == 'Div'
and div.classes[1] == 'section'
end
On lines 46-52:
if bib_header then
bib_header.identifier = 'bibliography-' .. (header.attributes.number or 999)
bib_header.level = header.level + 1
end
if refs and refs.identifier == 'refs' then
refs.identifier = 'refs-' .. (header.attributes.number or 999)
end
As far as I can tell, this hasn't created unanticipated/wanted side effects.
That works great, thanks!
Thanks for the report!