pandoc-ext / section-bibliographies

Filter to create a separate bibliography for each section or chapter
MIT License
43 stars 4 forks source link

Bug/Question: No "number" before References section in HTML? #11

Closed queirozfcom closed 6 months ago

queirozfcom commented 1 year ago

Hi. I managed to generate the per-chapter references but the header will not follow the proper numbering. In the example below, it should be numbered as 2.8

xx

Here is the relevant part of the config file:

project:
  type: book

book:
  title: "my book title"
  author: "Felipe Almeida"
  date: "5/13/2023"
  chapters:
    - index.qmd

    - chapters/ch_01.qmd

    - part: parts/part_01.qmd
      chapters:
        - chapters/ch_02.qmd

filters:
  - section-bibliographies
bibliography: references.bib
reference-section-title: References

format:
  html:
    toc: true
    toc-expand: 1
    toc-depth: 4
  pdf:
    documentclass: scrreprt

crossref:
  chapters: true
queirozfcom commented 1 year ago

I'm trying to tinker with the lua code to see if I can debug this

tarleb commented 6 months ago

One way to (temporarily) fix this would be to run another Lua filter after this one:

function Div (div)
  div.classes = div.classes:filter(function (cls) return cls == 'unnumbered' end)
  return div
end

This should drop the unnumbered class from all headings.

We could make this configurable and include it in this filter.

tarleb commented 6 months ago

The alternative solution is to manually add a heading at the end of each section. The filter will not add a new bibliography heading if the last element in a section is a heading. E.g.:

## Summary

Text goes here.

### References
queirozfcom commented 4 months ago

The alternative solution is to manually add a heading at the end of each section. The filter will not add a new bibliography heading if the last element in a section is a heading. E.g.:

## Summary

Text goes here.

### References

This worked thanks!