Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infinite loop when formatting with modern-language-association.csl #216

Open
agruber opened this issue Nov 8, 2022 · 1 comment
Open

Comments

@agruber
Copy link

agruber commented Nov 8, 2022

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);

@zepinglee
Copy link
Contributor

zepinglee commented Nov 9, 2022

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 =====<<

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants