diff --git a/Taylor and Francis+NEJM.js b/Taylor and Francis+NEJM.js index c1d846c84f..baf7ad24cb 100644 --- a/Taylor and Francis+NEJM.js +++ b/Taylor and Francis+NEJM.js @@ -9,7 +9,7 @@ "inRepository": true, "translatorType": 4, "browserSupport": "gcsibv", - "lastUpdated": "2024-07-02 20:00:15" + "lastUpdated": "2024-12-03 15:37:21" } /* @@ -107,10 +107,18 @@ async function scrape(doc, url = doc.location.href) { let bibtexText = await requestText(postUrl, { method: 'POST', body: postBody + doi + bibtexFormat }); let risText = await requestText(postUrl, { method: 'POST', body: postBody + doi + risFormat }); + + // Z.debug(bibtexText) // Y1 is online publication date if (/^DA\s+-\s+/m.test(risText)) { risText = risText.replace(/^Y1(\s+-.*)/gm, ''); } + // Fix broken BibTeX as in https://github.com/zotero/translators/issues/3398 + if (/@article\{[^,]+\}/.test(bibtexText)) { + Z.debug("Fixing BibTeX"); + bibtexText = bibtexText.replace(/(@article\{[^,]+)\}/, '$1'); + // Z.debug(bibtexText); + } var item; var risItem; @@ -142,7 +150,6 @@ async function scrape(doc, url = doc.location.href) { } item.bookTitle = item.publicationTitle; - if (!item.title) item.title = ""; // RIS title can be even worse, it actually says "null" if (risItem.date) item.date = risItem.date; // More complete if (item.date && /^\d{4}$/.test(item.date)) {