Infinite loop when formatting with modern-language-association.csl
agruber opened this issue · comments
If the author.family
starts with de
and the item appears twice, citeproc is stuck in an infinite loop. Only seems to happen with modern-language-association.csl
. Example code given below:
var fs = require('fs');
var CSL = require('citeproc');
const items = {
A: {
type: 'article-journal',
id: 'A',
title: 'Non-cooperative Games',
author: [
{
given: 'John',
family: 'de Nash',
},
],
'container-title': 'Annals of Mathematics',
issued: {
'date-parts': [['1951']],
},
volume: '54',
issue: '2',
page: '286-295',
},
B: {
type: 'article-journal',
id: 'B',
title: 'Non-cooperative Games',
author: [
{
given: 'John',
family: 'de Nash',
},
],
'container-title': 'Annals of Mathematics',
issued: {
'date-parts': [['1951']],
},
volume: '54',
issue: '2',
page: '286-295',
},
};
const sys = {
retrieveLocale: () => {
return fs.readFileSync('./locales-en-US.xml', 'utf8');
},
retrieveItem: (id) => {
return items[id];
},
};
var style = fs.readFileSync('./modern-language-association.csl', 'utf8');
var engine = new CSL.Engine(sys, style, 'en-US', true);
engine.updateItems(['A', 'B']);
var bib = engine.makeBibliography();
console.log(bib);
I can also reproduce this bug. The following is a minimal fixture for easier testing.
>>===== MODE =====>>
citation
<<===== MODE =====<<
>>===== RESULT =====>>
(de Nash; de Nash)
<<===== RESULT =====<<
>>===== CSL =====>>
<style xmlns="http://purl.org/net/xbiblio/csl" class="in-text" version="1.0" demote-non-dropping-particle="never">
<info>
<title/>
<id/>
<updated>2022-04-24T09:59:40-04:00</updated>
</info>
<citation disambiguate-add-givenname="true">
<layout prefix="(" suffix=")" delimiter="; ">
<names variable="author">
<name form="short"/>
</names>
</layout>
</citation>
</style>
<<===== CSL =====<<
>>===== INPUT =====>>
[
{
"type": "article-journal",
"id": "ITEM-1",
"title": "Non-cooperative games",
"author": [
{
"given": "John",
"family": "de Nash"
}
]
},
{
"type": "article-journal",
"id": "ITEM-2",
"title": "The bargaining problem",
"author": [
{
"given": "John",
"family": "de Nash"
}
]
}
]
<<===== INPUT =====<<