Per-chapter footnotes

This is originally from a bug report at zepinglee/citeproc-lua#72. In the LaTeX standard document class, the footnote numbers are reset to 1 at the beginning of every chapter. My question is, does current citeproc-js support this stye of note numbers?

The structure of the document is like in the following LaTeX code. The same item is cited twice in each chapter. I’ve collected what’s inputted into the citeproc engine and made a test fixture (https://github.com/zepinglee/citeproc-js/blob/mytest/fixtures/local/position_NotesPerChapter.txt). The engine raises two warnings of note index not sane.

\chapter{Title1}

test cite1\cite{King2008-Gramma}
test cite2\cite{King2008-Gramma}

\chapter{Title2}

test cite3\cite{King2008-Gramma}
test cite4\cite{King2008-Gramma}
[position_NotesPerChapter] Note index sequence is not sane for citation CITATION-3
[position_NotesPerChapter] Note index sequence is not sane at citationsPre[2]

My plan to solve this is to add a chapter number in the citation properties as an extension in citeproc-lua. Any other suggestions?

{
    "citationID": "CITATION-1",
    "citationItems": [
        {
            "id": "King2008-Gramma"
        }
    ],
    "properties": {
        "chapter": 2,
        "noteIndex": 1
    }
}

I don’t think this is supported in citeproc-js. (I think there’s a solution for pandoc via a plugin, but it’s also not a native citeproc solution.)
There have been discussions about this before, but IIRC one problem is that citeproc-js doesn’t have access to information such as page breaks, new chapters etc. that would be needed for this kind of processing.
Your approach seems ok, but you may also want to look into how biblatex deals with these kind of situations. Biblatex has a couple of ways to make local bibliographies, and to reset ibid- and position-tracking in certain places.

Thanks! I’ve basically implemented this feature in citeproc-lua. The biblatex’s interface, in my opinion, is too complicated for end users (listed below). Most of the options can be covered with CSL’s position conditions.

citereset = none, part, chapter, chapter+, section, section+, subsection, subsection+
citetracker = true, false, context, strict, constrict
ibidtracker = true, false, context, strict, constrict
opcittracker = true, false, context, strict, constrict