diff --git a/CHANGELOG.md b/CHANGELOG.md index 04bf776..bad76e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- Fix note position in multiple chapters ([#72](https://github.com/zepinglee/citeproc-lua/discussions/72)). + ## [0.6.1] - 2024-08-15 ### Fixed diff --git a/citeproc/citeproc-engine.lua b/citeproc/citeproc-engine.lua index 057b5d7..945a1d7 100644 --- a/citeproc/citeproc-engine.lua +++ b/citeproc/citeproc-engine.lua @@ -49,12 +49,13 @@ local SortStringFormat = output.SortStringFormat local Position = util.Position +---@alias CitationId string ---@alias ItemId string | number ---@alias NoteIndex integer ----@alias CitationId string +---@alias ChapterIndex number ---@alias CitationData {citationID: CitationId, citationItems: CitationItem[], properties: CitationProperties, citation_index: integer} ----@alias CitationProperties { noteIndex: integer, mode: string? } +---@alias CitationProperties { noteIndex: NoteIndex, chapterIndex: ChapterIndex, mode: string? } ---@class NameVariable ---@field family string? @@ -294,14 +295,18 @@ function CiteProc:updateUncitedItems(uncited_ids) end +---@alias PreCitation [CitationId, NoteIndex, ChapterIndex] +---@alias PostCitation [CitationId, NoteIndex, ChapterIndex] + ---@param citation CitationData ----@param citationsPre (CitationId | NoteIndex)[] ----@param citationsPost (CitationId | NoteIndex)[] +---@param citationsPre PreCitation[] +---@param citationsPost PostCitation[] ---@return (table | (integer | string | CitationId)[])[] function CiteProc:processCitationCluster(citation, citationsPre, citationsPost) -- util.debug(string.format('processCitationCluster(%s)', citation.citationID)) self:check_valid_citation_element() citation = self:normalize_citation_input(citation) + self:_check_input(citation, citationsPre, citationsPost) -- Registor citation self.registry.citations_by_id[citation.citationID] = citation @@ -406,6 +411,9 @@ function CiteProc:normalize_citation_input(citation) if not citation.properties.noteIndex then citation.properties.noteIndex = 0 end + if not citation.properties.chapterIndex then + citation.properties.chapterIndex = 0 + end return citation end @@ -451,6 +459,83 @@ function CiteProc:normalize_cite_item(cite_item) return cite_item end +---@param citation CitationData +---@param citationsPre PreCitation[] +---@param citationsPost PostCitation[] +function CiteProc:_check_input(citation, citationsPre, citationsPost) + ---@type {[CitationId]: boolean} + local citation_dict = {} + local last_note_number = 0 + local last_chapter_number = 0 + + for i, pre_citation in ipairs(citationsPre) do + local citation_id = pre_citation[1] + local note_number = pre_citation[2] + local chapter_number = pre_citation[3] + if citation_dict[citation_id] then + error(string.format("Previously referenced citationID '%s' encountered in citationsPre", citation_id)) + end + if note_number and note_number > 0 then + if note_number < last_note_number then + util.warning(string.format("Note index sequence is not sane at citationsPre[%d]", i)) + end + last_note_number = note_number + end + if chapter_number and chapter_number > 0 then + if chapter_number < last_chapter_number then + util.warning(string.format("Chapter index sequence is not sane at citationsPre[%d]", i)) + end + last_chapter_number = chapter_number + end + citation_dict[citation_id] = true + end + + do + local citation_id = citation.citationID + local note_number = citation.properties.noteIndex + local chapter_number = citation.properties.chapterIndex + if (citation_dict[citation_id]) then + error("Citation with previously referenced citationID " .. citation_id) + end + if note_number and note_number > 0 then + if note_number < last_note_number then + util.warning("Note index sequence is not sane for citation " .. citation_id) + end + last_note_number = note_number + end + if chapter_number and chapter_number > 0 then + if chapter_number < last_chapter_number then + util.warning("Chapter index sequence is not sane for citation " .. citation_id) + end + last_chapter_number = chapter_number + end + citation_dict[citation_id] = true + end + + for i, post_citation in ipairs(citationsPost) do + local citation_id = post_citation[1] + local note_number = post_citation[2] + local chapter_number = post_citation[3] + if citation_dict[citation_id] then + error(string.format("Previously referenced citationID '%s' encountered in citationsPost", citation_id)) + end + if note_number and note_number > 0 then + if note_number < last_note_number then + util.warning(string.format("Note index sequence is not sane at citationsPost[%d]", i)) + end + last_note_number = note_number + end + if chapter_number and chapter_number > 0 then + if chapter_number < last_chapter_number then + util.warning(string.format("Chapter index sequence is not sane at citationsPost[%d]", i)) + end + last_chapter_number = chapter_number + end + citation_dict[citation_id] = true + end + +end + -- A variant of processCitationCluster() for easy use with LaTeX. -- It should be run after refreshing the registry (updateItems()) with all items function CiteProc:process_citation(citation) @@ -517,6 +602,8 @@ function CiteProc:get_tainted_citation_ids(citation_note_pairs) -- have position properties. local in_text_citations = {} + local last_chapter_number = 0 + local previous_citation for citation_index, pair in ipairs(citation_note_pairs) do local citation_id, note_number = table.unpack(pair) @@ -525,6 +612,15 @@ function CiteProc:get_tainted_citation_ids(citation_note_pairs) citation.properties.noteIndex = note_number citation.citation_index = citation_index + local chapter_number = citation.properties.chapterIndex + if chapter_number and chapter_number ~= last_chapter_number then + self.cite_first_note_numbers = {} + self.cite_last_note_numbers = {} + self.note_citations_map = {} + previous_citation = nil + end + + local tainted = false local prev_citation = previous_citation @@ -559,6 +655,8 @@ function CiteProc:get_tainted_citation_ids(citation_note_pairs) previous_citation = citation end end + + last_chapter_number = chapter_number end -- Update tainted citation ids because of citation-number's change diff --git a/citeproc/citeproc-manager.lua b/citeproc/citeproc-manager.lua index fa72a4a..ae65fdd 100644 --- a/citeproc/citeproc-manager.lua +++ b/citeproc/citeproc-manager.lua @@ -573,6 +573,15 @@ function CslCitationManager:_make_citation(citation_info) util.error(string.format("Invalid note index '%s'.", note_index)) end + local chapter_index = citation.properties.chapterIndex + if not chapter_index or chapter_index == "" then + citation.properties.chapterIndex = nil + elseif type(chapter_index) == "string" and string.match(chapter_index, "^%d+$") then + citation.properties.chapterIndex = tonumber(chapter_index) + else + util.error(string.format("Invalid chapter index '%s'.", chapter_index)) + end + -- util.debug(citation) return citation end diff --git a/latex/citation-style-language-cite.sty b/latex/citation-style-language-cite.sty index 709ef61..b547cec 100644 --- a/latex/citation-style-language-cite.sty +++ b/latex/citation-style-language-cite.sty @@ -316,6 +316,11 @@ \__csl_process_citation_id:NN \l__csl_citation_id_tl #1 \__csl_get_note_index:N \l__csl_note_index_tl \prop_put:NnV \l__csl_citation_properties_prop { noteIndex } \l__csl_note_index_tl + \int_if_exist:NT \c@chapter + { + \prop_put:Nnx \l__csl_citation_properties_prop { chapterIndex } + { \int_use:N \c@chapter } + } \__csl_add_back_ref_info: } diff --git a/scripts/testjs.sh b/scripts/testjs.sh index 71aac06..51345fe 100755 --- a/scripts/testjs.sh +++ b/scripts/testjs.sh @@ -2,3 +2,4 @@ cp "$@" ../citeproc-js/fixtures/local/lua_tmp.txt cd ../citeproc-js cslrun -s lua_tmp +rm ../citeproc-js/fixtures/local/lua_tmp.txt diff --git a/tests/fixtures/local/position_NotesPerChapter.txt b/tests/fixtures/local/position_NotesPerChapter.txt new file mode 100644 index 0000000..de1b65e --- /dev/null +++ b/tests/fixtures/local/position_NotesPerChapter.txt @@ -0,0 +1,1648 @@ +>>===== MODE =====>> +citation +<<===== MODE =====<< + + +>>===== DESCRIPTION =====>> + + +In this test, I've added the `chapterIndex` as an extension to CSL and +`citeproc-js`. +<<===== DESCRIPTION =====<< + + +>>===== RESULT =====>> +>>[0] [first] John T. King, “A Grammar of Dhimal” (doctoral dissertation, Universiteit Leiden, 2008), https://scholarlypublications.universiteitleiden.nl/handle/1887/13072. +>>[1] [ibid 1] ibid. +>>[2] [first] John T. King, “A Grammar of Dhimal” (doctoral dissertation, Universiteit Leiden, 2008), https://scholarlypublications.universiteitleiden.nl/handle/1887/13072. +>>[3] [ibid 1] ibid. +<<===== RESULT =====<< + + +>>===== CITATIONS =====>> +[ + [ + { + "citationID": "CITATION-1", + "citationItems": [ + { + "id": "King2008-Gramma" + } + ], + "properties": { + "chapterIndex": 1, + "noteIndex": 1 + } + }, + [], + [] + ], + [ + { + "citationID": "CITATION-2", + "citationItems": [ + { + "id": "King2008-Gramma" + } + ], + "properties": { + "chapterIndex": 1, + "noteIndex": 2 + } + }, + [ + ["CITATION-1", 1] + ], + [] + ], + [ + { + "citationID": "CITATION-3", + "citationItems": [ + { + "id": "King2008-Gramma" + } + ], + "properties": { + "chapterIndex": 2, + "noteIndex": 1 + } + }, + [ + ["CITATION-1", 1], + ["CITATION-2", 2] + ], + [] + ], + [ + { + "citationID": "CITATION-4", + "citationItems": [ + { + "id": "King2008-Gramma" + } + ], + "properties": { + "chapterIndex": 2, + "noteIndex": 2 + } + }, + [ + ["CITATION-1", 1], + ["CITATION-2", 2], + ["CITATION-3", 1] + ], + [] + ] +] +<<===== CITATIONS =====<< + + +>>===== CSL =====>> + + +<<===== CSL =====<< + + +>>===== INPUT =====>> +[ + { + "id": "King2008-Gramma", + "type": "thesis", + "author": [ + { + "family": "King", + "given": "John T." + } + ], + "title": "A Grammar of Dhimal", + "title-short": "Grammar of Dhimal", + "source": "PDF", + "publisher-place": "Netherlands", + "publisher": "Universiteit Leiden", + "URL": "https://scholarlypublications.universiteitleiden.nl/handle/1887/13072", + "genre": "doctoral dissertation", + "issued": { + "date-parts": [ + [ + "2008", + "9", + "3" + ] + ] + }, + "accessed": { + "date-parts": [ + [ + "2024", + "08", + "13" + ] + ] + } + } +] +<<===== INPUT =====<< + + +>>===== VERSION =====>> +1.0 +<<===== VERSION =====<< diff --git a/tests/latex/luatex-1/issue-72.lvt b/tests/latex/luatex-1/issue-72.lvt new file mode 100644 index 0000000..6a6014c --- /dev/null +++ b/tests/latex/luatex-1/issue-72.lvt @@ -0,0 +1,1548 @@ +% + +\input{regression-test} +\documentclass{book} + +\begin{filecontents}[overwrite, noheader]{chicago-fullnote-bibliography-with-ibid.csl} + +\end{filecontents} + +\begin{filecontents}[overwrite, noheader]{\jobname.json} +[ + { + "id": "King2008-Gramma", + "type": "thesis", + "author": [ + { + "family": "King", + "given": "John T." + } + ], + "title": "A Grammar of Dhimal", + "title-short": "Grammar of Dhimal", + "source": "PDF", + "publisher-place": "Netherlands", + "publisher": "Universiteit Leiden", + "URL": "https://scholarlypublications.universiteitleiden.nl/handle/1887/13072", + "genre": "doctoral dissertation", + "issued": { + "date-parts": [ + [ + "2008", + "9", + "3" + ] + ] + }, + "accessed": { + "date-parts": [ + [ + "2024", + "08", + "13" + ] + ] + } + } +] +\end{filecontents} + +\usepackage[style=chicago-fullnote-bibliography-with-ibid]{citation-style-language} +\cslsetup{regression-test = true} +\addbibresource{\jobname.json} + + +\begin{document} +\START + +\chapter{Title1} +test cite1\cite{King2008-Gramma} +test cite2\cite{King2008-Gramma} + +\chapter{Title2} +\TEST{Citation in chapter 2}{ + test cite3\cite{King2008-Gramma} +} +test cite4\cite{King2008-Gramma} + +\OMIT +\end{document} diff --git a/tests/latex/luatex-1/issue-72.tlg b/tests/latex/luatex-1/issue-72.tlg new file mode 100644 index 0000000..183b3f3 --- /dev/null +++ b/tests/latex/luatex-1/issue-72.tlg @@ -0,0 +1,44 @@ +This is a generated file for the l3build validation system. +Don't change this file in any respect. +Chapter 1. +> \l__csl_citation_info_tl=citationID={King2008-Gramma@1},citationItems={{id={King2008-Gramma}}},properties={noteIndex={1},chapterIndex={1}}. + } +l. ...test cite1\cite{King2008-Gramma} +> \l__csl_citation_tl=John T. King, “A Grammar of Dhimal” (doctoral dissertation, Universiteit Leiden, 2008), \url {https://scholarlypublications.universiteitleiden.nl/handle/1887/13072}.. + } +l. ...test cite1\cite{King2008-Gramma} +LaTeX Font Info: External font `cmex10' loaded for size +(Font) <7> on input line .... +LaTeX Font Info: External font `cmex10' loaded for size +(Font) <5> on input line .... +LaTeX Font Info: External font `cmex10' loaded for size +(Font) <8> on input line .... +LaTeX Font Info: External font `cmex10' loaded for size +(Font) <6> on input line .... +> \l__csl_citation_info_tl=citationID={King2008-Gramma@2},citationItems={{id={King2008-Gramma}}},properties={noteIndex={2},chapterIndex={1}}. + } +l. ...test cite2\cite{King2008-Gramma} +> \l__csl_citation_tl=Ibid.. + } +l. ...test cite2\cite{King2008-Gramma} +[1 +] +[2 +] +Chapter 2. +============================================================ +TEST 1: Citation in chapter 2 +============================================================ +> \l__csl_citation_info_tl=citationID={King2008-Gramma@3},citationItems={{id={King2008-Gramma}}},properties={noteIndex={1},chapterIndex={2}}. + } +l. ...} +> \l__csl_citation_tl=John T. King, “A Grammar of Dhimal” (doctoral dissertation, Universiteit Leiden, 2008), \url {https://scholarlypublications.universiteitleiden.nl/handle/1887/13072}.. + } +l. ...} +============================================================ +> \l__csl_citation_info_tl=citationID={King2008-Gramma@4},citationItems={{id={King2008-Gramma}}},properties={noteIndex={2},chapterIndex={2}}. + } +l. ...test cite4\cite{King2008-Gramma} +> \l__csl_citation_tl=Ibid.. + } +l. ...test cite4\cite{King2008-Gramma} diff --git a/tests/latex/luatex-2/issue-72.lvt b/tests/latex/luatex-2/issue-72.lvt new file mode 100644 index 0000000..6a6014c --- /dev/null +++ b/tests/latex/luatex-2/issue-72.lvt @@ -0,0 +1,1548 @@ +% + +\input{regression-test} +\documentclass{book} + +\begin{filecontents}[overwrite, noheader]{chicago-fullnote-bibliography-with-ibid.csl} + +\end{filecontents} + +\begin{filecontents}[overwrite, noheader]{\jobname.json} +[ + { + "id": "King2008-Gramma", + "type": "thesis", + "author": [ + { + "family": "King", + "given": "John T." + } + ], + "title": "A Grammar of Dhimal", + "title-short": "Grammar of Dhimal", + "source": "PDF", + "publisher-place": "Netherlands", + "publisher": "Universiteit Leiden", + "URL": "https://scholarlypublications.universiteitleiden.nl/handle/1887/13072", + "genre": "doctoral dissertation", + "issued": { + "date-parts": [ + [ + "2008", + "9", + "3" + ] + ] + }, + "accessed": { + "date-parts": [ + [ + "2024", + "08", + "13" + ] + ] + } + } +] +\end{filecontents} + +\usepackage[style=chicago-fullnote-bibliography-with-ibid]{citation-style-language} +\cslsetup{regression-test = true} +\addbibresource{\jobname.json} + + +\begin{document} +\START + +\chapter{Title1} +test cite1\cite{King2008-Gramma} +test cite2\cite{King2008-Gramma} + +\chapter{Title2} +\TEST{Citation in chapter 2}{ + test cite3\cite{King2008-Gramma} +} +test cite4\cite{King2008-Gramma} + +\OMIT +\end{document} diff --git a/tests/latex/luatex-2/issue-72.tlg b/tests/latex/luatex-2/issue-72.tlg new file mode 100644 index 0000000..183b3f3 --- /dev/null +++ b/tests/latex/luatex-2/issue-72.tlg @@ -0,0 +1,44 @@ +This is a generated file for the l3build validation system. +Don't change this file in any respect. +Chapter 1. +> \l__csl_citation_info_tl=citationID={King2008-Gramma@1},citationItems={{id={King2008-Gramma}}},properties={noteIndex={1},chapterIndex={1}}. + } +l. ...test cite1\cite{King2008-Gramma} +> \l__csl_citation_tl=John T. King, “A Grammar of Dhimal” (doctoral dissertation, Universiteit Leiden, 2008), \url {https://scholarlypublications.universiteitleiden.nl/handle/1887/13072}.. + } +l. ...test cite1\cite{King2008-Gramma} +LaTeX Font Info: External font `cmex10' loaded for size +(Font) <7> on input line .... +LaTeX Font Info: External font `cmex10' loaded for size +(Font) <5> on input line .... +LaTeX Font Info: External font `cmex10' loaded for size +(Font) <8> on input line .... +LaTeX Font Info: External font `cmex10' loaded for size +(Font) <6> on input line .... +> \l__csl_citation_info_tl=citationID={King2008-Gramma@2},citationItems={{id={King2008-Gramma}}},properties={noteIndex={2},chapterIndex={1}}. + } +l. ...test cite2\cite{King2008-Gramma} +> \l__csl_citation_tl=Ibid.. + } +l. ...test cite2\cite{King2008-Gramma} +[1 +] +[2 +] +Chapter 2. +============================================================ +TEST 1: Citation in chapter 2 +============================================================ +> \l__csl_citation_info_tl=citationID={King2008-Gramma@3},citationItems={{id={King2008-Gramma}}},properties={noteIndex={1},chapterIndex={2}}. + } +l. ...} +> \l__csl_citation_tl=John T. King, “A Grammar of Dhimal” (doctoral dissertation, Universiteit Leiden, 2008), \url {https://scholarlypublications.universiteitleiden.nl/handle/1887/13072}.. + } +l. ...} +============================================================ +> \l__csl_citation_info_tl=citationID={King2008-Gramma@4},citationItems={{id={King2008-Gramma}}},properties={noteIndex={2},chapterIndex={2}}. + } +l. ...test cite4\cite{King2008-Gramma} +> \l__csl_citation_tl=Ibid.. + } +l. ...test cite4\cite{King2008-Gramma} diff --git a/tests/latex/pdftex-1/issue-72.lvt b/tests/latex/pdftex-1/issue-72.lvt new file mode 100644 index 0000000..6a6014c --- /dev/null +++ b/tests/latex/pdftex-1/issue-72.lvt @@ -0,0 +1,1548 @@ +% + +\input{regression-test} +\documentclass{book} + +\begin{filecontents}[overwrite, noheader]{chicago-fullnote-bibliography-with-ibid.csl} + +\end{filecontents} + +\begin{filecontents}[overwrite, noheader]{\jobname.json} +[ + { + "id": "King2008-Gramma", + "type": "thesis", + "author": [ + { + "family": "King", + "given": "John T." + } + ], + "title": "A Grammar of Dhimal", + "title-short": "Grammar of Dhimal", + "source": "PDF", + "publisher-place": "Netherlands", + "publisher": "Universiteit Leiden", + "URL": "https://scholarlypublications.universiteitleiden.nl/handle/1887/13072", + "genre": "doctoral dissertation", + "issued": { + "date-parts": [ + [ + "2008", + "9", + "3" + ] + ] + }, + "accessed": { + "date-parts": [ + [ + "2024", + "08", + "13" + ] + ] + } + } +] +\end{filecontents} + +\usepackage[style=chicago-fullnote-bibliography-with-ibid]{citation-style-language} +\cslsetup{regression-test = true} +\addbibresource{\jobname.json} + + +\begin{document} +\START + +\chapter{Title1} +test cite1\cite{King2008-Gramma} +test cite2\cite{King2008-Gramma} + +\chapter{Title2} +\TEST{Citation in chapter 2}{ + test cite3\cite{King2008-Gramma} +} +test cite4\cite{King2008-Gramma} + +\OMIT +\end{document} diff --git a/tests/latex/pdftex-1/issue-72.tlg b/tests/latex/pdftex-1/issue-72.tlg new file mode 100644 index 0000000..43ff395 --- /dev/null +++ b/tests/latex/pdftex-1/issue-72.tlg @@ -0,0 +1,48 @@ +This is a generated file for the l3build validation system. +Don't change this file in any respect. +Chapter 1. +> \l__csl_citation_info_tl=citationID={King2008-Gramma@1},citationItems={{id={King2008-Gramma}}},properties={noteIndex={1},chapterIndex={1}}. + } +l. ...test cite1\cite{King2008-Gramma} +LaTeX Warning: Citation `King2008-Gramma' on page 1 undefined on input line .... +> \l__csl_citation_tl=[\textbf {King2008-Gramma}]. + } +l. ...test cite1\cite{King2008-Gramma} +LaTeX Font Info: External font `cmex10' loaded for size +(Font) <7> on input line .... +LaTeX Font Info: External font `cmex10' loaded for size +(Font) <5> on input line .... +LaTeX Font Info: External font `cmex10' loaded for size +(Font) <8> on input line .... +LaTeX Font Info: External font `cmex10' loaded for size +(Font) <6> on input line .... +> \l__csl_citation_info_tl=citationID={King2008-Gramma@2},citationItems={{id={King2008-Gramma}}},properties={noteIndex={2},chapterIndex={1}}. + } +l. ...test cite2\cite{King2008-Gramma} +LaTeX Warning: Citation `King2008-Gramma' on page 1 undefined on input line .... +> \l__csl_citation_tl=[\textbf {King2008-Gramma}]. + } +l. ...test cite2\cite{King2008-Gramma} +[1 +] +[2 +] +Chapter 2. +============================================================ +TEST 1: Citation in chapter 2 +============================================================ +> \l__csl_citation_info_tl=citationID={King2008-Gramma@3},citationItems={{id={King2008-Gramma}}},properties={noteIndex={1},chapterIndex={2}}. + } +l. ...} +LaTeX Warning: Citation `King2008-Gramma' on page 3 undefined on input line .... +> \l__csl_citation_tl=[\textbf {King2008-Gramma}]. + } +l. ...} +============================================================ +> \l__csl_citation_info_tl=citationID={King2008-Gramma@4},citationItems={{id={King2008-Gramma}}},properties={noteIndex={2},chapterIndex={2}}. + } +l. ...test cite4\cite{King2008-Gramma} +LaTeX Warning: Citation `King2008-Gramma' on page 3 undefined on input line .... +> \l__csl_citation_tl=[\textbf {King2008-Gramma}]. + } +l. ...test cite4\cite{King2008-Gramma} diff --git a/tests/latex/pdftex-2/issue-72.lvt b/tests/latex/pdftex-2/issue-72.lvt new file mode 100644 index 0000000..6a6014c --- /dev/null +++ b/tests/latex/pdftex-2/issue-72.lvt @@ -0,0 +1,1548 @@ +% + +\input{regression-test} +\documentclass{book} + +\begin{filecontents}[overwrite, noheader]{chicago-fullnote-bibliography-with-ibid.csl} + +\end{filecontents} + +\begin{filecontents}[overwrite, noheader]{\jobname.json} +[ + { + "id": "King2008-Gramma", + "type": "thesis", + "author": [ + { + "family": "King", + "given": "John T." + } + ], + "title": "A Grammar of Dhimal", + "title-short": "Grammar of Dhimal", + "source": "PDF", + "publisher-place": "Netherlands", + "publisher": "Universiteit Leiden", + "URL": "https://scholarlypublications.universiteitleiden.nl/handle/1887/13072", + "genre": "doctoral dissertation", + "issued": { + "date-parts": [ + [ + "2008", + "9", + "3" + ] + ] + }, + "accessed": { + "date-parts": [ + [ + "2024", + "08", + "13" + ] + ] + } + } +] +\end{filecontents} + +\usepackage[style=chicago-fullnote-bibliography-with-ibid]{citation-style-language} +\cslsetup{regression-test = true} +\addbibresource{\jobname.json} + + +\begin{document} +\START + +\chapter{Title1} +test cite1\cite{King2008-Gramma} +test cite2\cite{King2008-Gramma} + +\chapter{Title2} +\TEST{Citation in chapter 2}{ + test cite3\cite{King2008-Gramma} +} +test cite4\cite{King2008-Gramma} + +\OMIT +\end{document} diff --git a/tests/latex/pdftex-2/issue-72.tlg b/tests/latex/pdftex-2/issue-72.tlg new file mode 100644 index 0000000..183b3f3 --- /dev/null +++ b/tests/latex/pdftex-2/issue-72.tlg @@ -0,0 +1,44 @@ +This is a generated file for the l3build validation system. +Don't change this file in any respect. +Chapter 1. +> \l__csl_citation_info_tl=citationID={King2008-Gramma@1},citationItems={{id={King2008-Gramma}}},properties={noteIndex={1},chapterIndex={1}}. + } +l. ...test cite1\cite{King2008-Gramma} +> \l__csl_citation_tl=John T. King, “A Grammar of Dhimal” (doctoral dissertation, Universiteit Leiden, 2008), \url {https://scholarlypublications.universiteitleiden.nl/handle/1887/13072}.. + } +l. ...test cite1\cite{King2008-Gramma} +LaTeX Font Info: External font `cmex10' loaded for size +(Font) <7> on input line .... +LaTeX Font Info: External font `cmex10' loaded for size +(Font) <5> on input line .... +LaTeX Font Info: External font `cmex10' loaded for size +(Font) <8> on input line .... +LaTeX Font Info: External font `cmex10' loaded for size +(Font) <6> on input line .... +> \l__csl_citation_info_tl=citationID={King2008-Gramma@2},citationItems={{id={King2008-Gramma}}},properties={noteIndex={2},chapterIndex={1}}. + } +l. ...test cite2\cite{King2008-Gramma} +> \l__csl_citation_tl=Ibid.. + } +l. ...test cite2\cite{King2008-Gramma} +[1 +] +[2 +] +Chapter 2. +============================================================ +TEST 1: Citation in chapter 2 +============================================================ +> \l__csl_citation_info_tl=citationID={King2008-Gramma@3},citationItems={{id={King2008-Gramma}}},properties={noteIndex={1},chapterIndex={2}}. + } +l. ...} +> \l__csl_citation_tl=John T. King, “A Grammar of Dhimal” (doctoral dissertation, Universiteit Leiden, 2008), \url {https://scholarlypublications.universiteitleiden.nl/handle/1887/13072}.. + } +l. ...} +============================================================ +> \l__csl_citation_info_tl=citationID={King2008-Gramma@4},citationItems={{id={King2008-Gramma}}},properties={noteIndex={2},chapterIndex={2}}. + } +l. ...test cite4\cite{King2008-Gramma} +> \l__csl_citation_tl=Ibid.. + } +l. ...test cite4\cite{King2008-Gramma}