From a2bd2f25e32ce8213c2113a5d9a84a20b7cf44f6 Mon Sep 17 00:00:00 2001 From: Sebastian Karcher Date: Tue, 3 Dec 2024 14:57:56 -0500 Subject: [PATCH] T&F: BibTeX hotfix (#3399) --- Taylor and Francis+NEJM.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Taylor and Francis+NEJM.js b/Taylor and Francis+NEJM.js index c1d846c84f5..baf7ad24cbb 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)) {