I have the following .qmd file:
---
title: Bibliography
filters:
- section-bibliographies
citeproc: false
bibliography: ../citas/references.bib
section-bibliographies:
level: 2
minlevel: 2
---
## Main
<div style="visibility: hidden; height: 0;">
@CasellaBerger2024
@Hastie2009
@Gelman2013
</div>
## Optional
<div style="visibility: hidden; height: 0;">
@Jaynes2003
@Rudin1976
</div>
The current version of the extension doesn't work as intended, I get no bibliography.
If I use level 1 headers then it works, but I want level 2 headers.
After inspecting the Lua code and adding some logging, I figured out the filter was reaching the metadata successfully, but the conversion to numbers in lines 206 and 209 were not working as expected:
|
opts.level = tonumber(opts.level) |
|
or tonumber(meta['section-bibs-level']) |
|
or 1 |
|
opts.minlevel = tonumber(opts.minlevel) |
|
or 1 |
As a result, opts.level and opts.minlevel were always set to 1.
To fix it locally, I applied the following change:
@@ -203,10 +203,10 @@ local function get_options (meta)
opts.bibliography = opts.bibliography
or meta['section-bibs-bibliography']
or meta['bibliography']
- opts.level = tonumber(opts.level)
+ opts.level = tonumber(utils.stringify(opts.level))
or tonumber(meta['section-bibs-level'])
or 1
- opts.minlevel = tonumber(opts.minlevel)
+ opts.minlevel = tonumber(utils.stringify(opts.minlevel))
or 1
opts.references = opts.references
or meta['references']
Do you think this is a satisfactory fix, if this was effectively a bug? Happy to submit a PR, although I'm not very familiar with the testing suite.
I have the following .qmd file:
The current version of the extension doesn't work as intended, I get no bibliography.
If I use level 1 headers then it works, but I want level 2 headers.
After inspecting the Lua code and adding some logging, I figured out the filter was reaching the metadata successfully, but the conversion to numbers in lines 206 and 209 were not working as expected:
section-bibliographies/_extensions/section-bibliographies/section-bibliographies.lua
Lines 206 to 210 in ec4e06b
As a result,
opts.levelandopts.minlevelwere always set to1.To fix it locally, I applied the following change:
Do you think this is a satisfactory fix, if this was effectively a bug? Happy to submit a PR, although I'm not very familiar with the testing suite.