From dacd5ba9751b4dc8afafd22c84bfbc4015de8626 Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sat, 4 Jan 2025 17:28:49 +0800 Subject: [PATCH 01/65] Able to identify more fields within CITATION.cff --- GitHub.js | 54 ++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 42 insertions(+), 12 deletions(-) diff --git a/GitHub.js b/GitHub.js index 3008f288b36..bab23f7d731 100644 --- a/GitHub.js +++ b/GitHub.js @@ -39,12 +39,12 @@ function detectWeb(doc, url) { return "multiple"; } } - + if (!doc.querySelector('meta[property="og:type"][content="object"]')) { // exclude the home page and marketing pages return false; } - + // `og:title` is messed up when browsing a file. if (url.startsWith(attr(doc, 'meta[property="og:url"]', 'content') + '/blob/')) { return "computerProgram"; @@ -55,7 +55,7 @@ function detectWeb(doc, url) { // deals with repo pages that we can't scrape, like GitHub Discussions. return false; } - + return "computerProgram"; } @@ -97,7 +97,7 @@ function doWeb(doc, url) { function scrape(doc, url) { var item = new Z.Item("computerProgram"); - + // basic metadata from the meta tags in the head item.url = attr(doc, 'meta[property="og:url"]', 'content'); if (url.includes('/blob/') && !item.url.includes('/blob/')) { @@ -135,7 +135,7 @@ function scrape(doc, url) { return; } var owner = json.owner.login; - + item.programmingLanguage = json.language; item.extra = "original-date: " + json.created_at; item.date = json.updated_at; @@ -148,13 +148,13 @@ function scrape(doc, url) { if (xhr.status == 200) { let doc = new DOMParser().parseFromString(respText, 'text/html'); let bibtex = attr(doc, '[aria-labelledby="bibtex-tab"] input', 'value'); - + if (bibtex && bibtex.trim()) { completeWithBibTeX(item, bibtex); return; } } - + // if there was no CITATION.cff or the response didn't include a // BibTeX representation, we fall back to filling in the title and // authorship using the API. @@ -168,15 +168,15 @@ function completeWithBibTeX(item, bibtex) { // BibTeX translator.setTranslator("9cb70025-a888-4a29-a210-93ec52da40d4"); translator.setString(bibtex); - + translator.setHandler("itemDone", function (obj, bibItem) { let path = item.title; - + delete bibItem.itemType; delete bibItem.attachments; delete bibItem.itemID; Object.assign(item, bibItem); - + if (item.version) { item.complete(); } @@ -186,14 +186,44 @@ function completeWithBibTeX(item, bibtex) { if (version) { item.versionNumber = version[1]; } + + let type = cffText.match(/^\s*(?:"type"|type)\s*:\s*"?(.+)"?\s*$/m); + if (type && type[1] === 'dataset') { + item.itemType = type[1]; + } + + let abstract = cffText.match(/^\s*(?:"abstract"|abstract)\s*:\s*"?(.+)"?\s*$/m); + if (abstract) { + item.abstractNote = abstract[1]; + } + + let keywords = extractKeywords(cffText) + if (keywords.length > 0) { + item.tags = item.tags.concat(keywords) + } + item.complete(); }, null, null, null, false); } }); - + translator.translate(); } +// Parse the YAML and extract keywords +function extractKeywords(cffText) { + // Use a regular expression to extract the `keywords` block + const match = cffText.match(/keywords:\s+((?:- .+\s*)+)/); + if (!match) return []; // Return an empty array if no keywords found + + // Extract the lines under `keywords` and clean them up + const keywordsBlock = match[1]; + return keywordsBlock + .split("\n") // Split into lines + .map(line => line.trim().replace(/^- /, "")) // Trim and remove `- ` + .filter(line => line !== ""); // Remove empty lines +} + function completeWithAPI(item, owner) { ZU.doGet(apiUrl + "users/" + owner, function (user) { var jsonUser = JSON.parse(user); @@ -204,7 +234,7 @@ function completeWithAPI(item, owner) { else { item.company = ownerName; } - + ZU.processDocuments(`/${item.title}`, function (rootDoc) { let readmeTitle = text(rootDoc, '#readme h1'); if (readmeTitle) { From 8cb7327fa5b0b15a19113ab0132d4457b770081a Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sat, 4 Jan 2025 17:39:13 +0800 Subject: [PATCH 02/65] Fix indent style to tab. --- GitHub.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/GitHub.js b/GitHub.js index bab23f7d731..100c7c87c5c 100644 --- a/GitHub.js +++ b/GitHub.js @@ -197,9 +197,9 @@ function completeWithBibTeX(item, bibtex) { item.abstractNote = abstract[1]; } - let keywords = extractKeywords(cffText) + let keywords = extractKeywords(cffText); if (keywords.length > 0) { - item.tags = item.tags.concat(keywords) + item.tags = item.tags.concat(keywords); } item.complete(); @@ -212,14 +212,14 @@ function completeWithBibTeX(item, bibtex) { // Parse the YAML and extract keywords function extractKeywords(cffText) { - // Use a regular expression to extract the `keywords` block - const match = cffText.match(/keywords:\s+((?:- .+\s*)+)/); - if (!match) return []; // Return an empty array if no keywords found - - // Extract the lines under `keywords` and clean them up - const keywordsBlock = match[1]; - return keywordsBlock - .split("\n") // Split into lines + // Use a regular expression to extract the `keywords` block + const match = cffText.match(/keywords:\s+((?:- .+\s*)+)/); + if (!match) return []; // Return an empty array if no keywords found + + // Extract the lines under `keywords` and clean them up + const keywordsBlock = match[1]; + return keywordsBlock + .split("\n") // Split into lines .map(line => line.trim().replace(/^- /, "")) // Trim and remove `- ` .filter(line => line !== ""); // Remove empty lines } From 926806d81cd8e90b4dbef5f4c20ef44bd871b6c4 Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sat, 4 Jan 2025 17:43:15 +0800 Subject: [PATCH 03/65] Fixing indent style to tab. --- GitHub.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/GitHub.js b/GitHub.js index 100c7c87c5c..86cab1718b7 100644 --- a/GitHub.js +++ b/GitHub.js @@ -219,9 +219,9 @@ function extractKeywords(cffText) { // Extract the lines under `keywords` and clean them up const keywordsBlock = match[1]; return keywordsBlock - .split("\n") // Split into lines - .map(line => line.trim().replace(/^- /, "")) // Trim and remove `- ` - .filter(line => line !== ""); // Remove empty lines + .split("\n") // Split into lines + .map(line => line.trim().replace(/^- /, "")) // Trim and remove `- ` + .filter(line => line !== ""); // Remove empty lines } function completeWithAPI(item, owner) { From 767526dfa5f072e2d537e6c6bf5c06d071748b3b Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sat, 4 Jan 2025 18:14:19 +0800 Subject: [PATCH 04/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8804=E6=97=A5=20(=E9=80=B1=E5=85=AD)=2018=E6=99=8214?= =?UTF-8?q?=E5=88=8619=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/GitHub.js b/GitHub.js index 86cab1718b7..14a661063c0 100644 --- a/GitHub.js +++ b/GitHub.js @@ -50,7 +50,8 @@ function detectWeb(doc, url) { return "computerProgram"; } - if (!/^(GitHub - )?[^/\s]+\/[^/\s]+(: .*)?$/.test(attr(doc, 'meta[property="og:title"]', 'content'))) { + if (!/^(GitHub - )?[^/\s]+\/[^/\s]+(: .*)?$/.test(attr(doc, 'meta[property="og:title"]', 'content')) && + !/^(GitHub - )?[^/\s]+\/[^/\s]+( .*)?$/.test(attr(doc, 'meta[property="og:title"]', 'content'))) { // and anything without a repo name (abc/xyz) as its og:title. // deals with repo pages that we can't scrape, like GitHub Discussions. return false; @@ -187,6 +188,11 @@ function completeWithBibTeX(item, bibtex) { item.versionNumber = version[1]; } + let title = cffText.match(/^\s*(?:"title"|title)\s*:\s*"?(.+)"?\s*$/m); + if (title) { + item.title = title[1]; + } + let type = cffText.match(/^\s*(?:"type"|type)\s*:\s*"?(.+)"?\s*$/m); if (type && type[1] === 'dataset') { item.itemType = type[1]; @@ -253,10 +259,10 @@ var testCases = [ "items": [ { "itemType": "computerProgram", - "title": "Zotero", + "title": "zotero/zotero", "creators": [], - "date": "2021-07-29T14:50:36Z", - "abstractNote": "Zotero is a free, easy-to-use tool to help you collect, organize, cite, and share your research sources.", + "date": "2025-01-04T07:24:46Z", + "abstractNote": "Zotero is a free, easy-to-use tool to help you collect, organize, annotate, cite, and share your research sources.", "company": "Zotero", "extra": "original-date: 2011-10-27T07:46:48Z", "libraryCatalog": "GitHub", @@ -280,9 +286,9 @@ var testCases = [ "items": [ { "itemType": "computerProgram", - "title": "DataCite Schema Repository", + "title": "datacite/schema", "creators": [], - "date": "2021-07-23T10:14:44Z", + "date": "2024-12-05T18:31:44Z", "abstractNote": "DataCite Metadata Schema Repository", "company": "DataCite", "extra": "original-date: 2011-04-13T07:08:41Z", @@ -298,21 +304,22 @@ var testCases = [ }, { "type": "web", - "url": "https://github.com/mittagessen/kraken", + "url": "https://github.com/mittagessen/kraken/tree/4.1.2", "items": [ { "itemType": "computerProgram", - "title": "mittagessen/kraken", + "title": "The Kraken OCR system", "creators": [ { - "firstName": "", - "lastName": "mittagessen", - "creatorType": "programmer" + "firstName": "Benjamin", + "lastName": "Kiessling", + "creatorType": "author" } ], "date": "2021-07-29T12:26:11Z", "abstractNote": "OCR engine for all the languages", "extra": "original-date: 2015-05-19T09:24:38Z", + "version": "4.1.2", "libraryCatalog": "GitHub", "programmingLanguage": "Python", "rights": "Apache-2.0", From 57c78f679fe8639afe1f155caa26534f92c33af5 Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sat, 4 Jan 2025 18:17:07 +0800 Subject: [PATCH 05/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8804=E6=97=A5=20(=E9=80=B1=E5=85=AD)=2018=E6=99=8217?= =?UTF-8?q?=E5=88=8607=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GitHub.js b/GitHub.js index 14a661063c0..95ddfc4513f 100644 --- a/GitHub.js +++ b/GitHub.js @@ -50,8 +50,8 @@ function detectWeb(doc, url) { return "computerProgram"; } - if (!/^(GitHub - )?[^/\s]+\/[^/\s]+(: .*)?$/.test(attr(doc, 'meta[property="og:title"]', 'content')) && - !/^(GitHub - )?[^/\s]+\/[^/\s]+( .*)?$/.test(attr(doc, 'meta[property="og:title"]', 'content'))) { + if (!/^(GitHub - )?[^/\s]+\/[^/\s]+(: .*)?$/.test(attr(doc, 'meta[property="og:title"]', 'content')) + && !/^(GitHub - )?[^/\s]+\/[^/\s]+( .*)?$/.test(attr(doc, 'meta[property="og:title"]', 'content'))) { // and anything without a repo name (abc/xyz) as its og:title. // deals with repo pages that we can't scrape, like GitHub Discussions. return false; From d2aed211d5c0cdc14a78758ef88a6df5ab3c2ac0 Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 03:05:41 +0800 Subject: [PATCH 06/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2003=E6=99=8205?= =?UTF-8?q?=E5=88=8641=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Access Science.js | 2 +- GitHub.js | 320 ++++++++++++++++++++++++++++++++++++---------- 2 files changed, 251 insertions(+), 71 deletions(-) diff --git a/Access Science.js b/Access Science.js index 34be151f37b..2ae9f1cee13 100644 --- a/Access Science.js +++ b/Access Science.js @@ -108,7 +108,7 @@ function scrape(doc, url) { item.creators = []; if (authorName.includes(',') && authorName.split(',').length > 2) { authorName = authorName.split(',')[0]; - item.creators.push(ZU.cleanAuthor(authorName, "author", false)); + item.creators.push(ZU.cleanAuthor(authorName, "author", true)); } } } diff --git a/GitHub.js b/GitHub.js index 95ddfc4513f..8c12542e133 100644 --- a/GitHub.js +++ b/GitHub.js @@ -1,7 +1,7 @@ { "translatorID": "a7747ba7-42c6-4a22-9415-1dafae6262a9", "label": "GitHub", - "creator": "Martin Fenner, Philipp Zumstein", + "creator": "Martin Fenner, Philipp Zumstein, Yung-Ting Chen", "target": "^https?://(www\\.)?github\\.com/([^/]+/[^/]+|search\\?)", "minVersion": "3.0", "maxVersion": "", @@ -9,7 +9,7 @@ "inRepository": true, "translatorType": 4, "browserSupport": "gcsibv", - "lastUpdated": "2021-07-29 19:26:28" + "lastUpdated": "2025-01-05 01:34:28" } /** @@ -46,12 +46,12 @@ function detectWeb(doc, url) { } // `og:title` is messed up when browsing a file. - if (url.startsWith(attr(doc, 'meta[property="og:url"]', 'content') + '/blob/')) { + let ogTitle = attr(doc, 'meta[property="og:url"]', 'content') + if (ogTitle.indexOf('/blob/') > -1 || url.startsWith(ogTitle + '/blob/')) { return "computerProgram"; } - if (!/^(GitHub - )?[^/\s]+\/[^/\s]+(: .*)?$/.test(attr(doc, 'meta[property="og:title"]', 'content')) - && !/^(GitHub - )?[^/\s]+\/[^/\s]+( .*)?$/.test(attr(doc, 'meta[property="og:title"]', 'content'))) { + if (!/^(GitHub - )?[^/\s]+\/[^/\s]+(: .*)?$/.test(attr(doc, 'meta[property="og:title"]', 'content')) && !/^(GitHub - )?[^/\s]+\/[^/\s]+( .*)?$/.test(attr(doc, 'meta[property="og:title"]', 'content'))) { // and anything without a repo name (abc/xyz) as its og:title. // deals with repo pages that we can't scrape, like GitHub Discussions. return false; @@ -119,16 +119,59 @@ function scrape(doc, url) { } } // Do not rely on `og:title` since GitHub isn't consistent with its meta attribute. - item.title = item.url.split('/').slice(3, 5).join('/'); + let githubRepository = item.url.split('/').slice(3, 5).join('/'); + item.title = githubRepository; + if (url.includes('/blob/')) { + let fileNameID = text(doc, '#file-name-id'); + if (fileNameID && fileNameID.trim() !== '') { + item.title = fileNameID.trim(); + } + } item.abstractNote = attr(doc, 'meta[property="og:description"]', 'content').split(' - ')[0] - .replace(` Contribute to ${item.title} development by creating an account on GitHub.`, ''); + .replace(` Contribute to ${githubRepository} development by creating an account on GitHub.`, ''); item.libraryCatalog = "GitHub"; var topics = doc.getElementsByClassName('topic-tag'); for (var i = 0; i < topics.length; i++) { item.tags.push(topics[i].textContent.trim()); } - ZU.doGet(apiUrl + "repos/" + item.title, function (result) { + let latestCommitLink = attr(doc, '[data-testid="latest-commit-html"] a', 'href'); + let commitHash = false; + if (latestCommitLink.indexOf('/') > -1) { + commitHash = latestCommitLink.split('/').pop(); + } + + if (url.includes('/blob/') === false) { + let readmeTitle = text(doc, '.markdown-heading h1.heading-element'); + if (readmeTitle) { + item.title = readmeTitle; + } + } + + if (commitHash === false) { + scrapeRepos(item, url, githubRepository); + } + else { + if (!item.versionNumber) { + item.versionNumber = commitHash + } + + let canonical = attr(doc, 'link[rel="canonical"]', 'href'); + if (canonical) { + item.url = canonical; + } + + ZU.doGet(apiUrl + "repos/" + githubRepository + "/commits/" + commitHash, function (result) { + var commitData = JSON.parse(result); + const commitTime = commitData.commit.author.date; // ISO 8601 format + item.date = commitTime; + scrapeRepos(item, url, githubRepository); + }) + } +} + +function scrapeRepos(item, url, githubRepository) { + ZU.doGet(apiUrl + "repos/" + githubRepository, function (result) { var json = JSON.parse(result); if (json.message && json.message.includes("API rate limit exceeded")) { // finish and stop in this case @@ -138,20 +181,25 @@ function scrape(doc, url) { var owner = json.owner.login; item.programmingLanguage = json.language; - item.extra = "original-date: " + json.created_at; - item.date = json.updated_at; + item.extra = "original-date: " + json.created_at; + if (!item.date && json.updated_at) { + item.date = json.updated_at; + } + if (json.license && json.license.spdx_id != "NOASSERTION") { item.rights = json.license.spdx_id; } item.abstractNote = json.description; + item.place = "GitHub"; - ZU.doGet(`/${item.title}/hovercards/citation`, function (respText, xhr) { + ZU.doGet(`/${githubRepository}/hovercards/citation`, function (respText, xhr) { if (xhr.status == 200) { let doc = new DOMParser().parseFromString(respText, 'text/html'); let bibtex = attr(doc, '[aria-labelledby="bibtex-tab"] input', 'value'); if (bibtex && bibtex.trim()) { - completeWithBibTeX(item, bibtex); + item.extra = "1" + completeWithBibTeX(item, bibtex, githubRepository, owner); return; } } @@ -159,25 +207,36 @@ function scrape(doc, url) { // if there was no CITATION.cff or the response didn't include a // BibTeX representation, we fall back to filling in the title and // authorship using the API. - completeWithAPI(item, owner); + completeWithAPI(item, owner, githubRepository); }, null, null, { 'X-Requested-With': 'XMLHttpRequest' }, false); }); } -function completeWithBibTeX(item, bibtex) { +function completeWithBibTeX(item, bibtex, githubRepository, owner) { var translator = Zotero.loadTranslator("import"); // BibTeX translator.setTranslator("9cb70025-a888-4a29-a210-93ec52da40d4"); translator.setString(bibtex); translator.setHandler("itemDone", function (obj, bibItem) { - let path = item.title; + let path = githubRepository; delete bibItem.itemType; delete bibItem.attachments; delete bibItem.itemID; + + let tags = [...item.tags] + let title = item.title + Object.assign(item, bibItem); + if (item.tags.length === 0 && tags.length > 0) { + item.tags = tags + } + if (item.url.includes('/blob/')) { + item.title = title + } + if (item.version) { item.complete(); } @@ -188,11 +247,6 @@ function completeWithBibTeX(item, bibtex) { item.versionNumber = version[1]; } - let title = cffText.match(/^\s*(?:"title"|title)\s*:\s*"?(.+)"?\s*$/m); - if (title) { - item.title = title[1]; - } - let type = cffText.match(/^\s*(?:"type"|type)\s*:\s*"?(.+)"?\s*$/m); if (type && type[1] === 'dataset') { item.itemType = type[1]; @@ -203,12 +257,33 @@ function completeWithBibTeX(item, bibtex) { item.abstractNote = abstract[1]; } - let keywords = extractKeywords(cffText); + let cffUrl = cffText.match(/^\s*(?:"url"|url)\s*:\s*"?(.+)"?\s*$/m); + if (cffUrl) { + item.url = cffUrl[1]; + } + + let repository = cffText.match(/^\s*(?:"repository"|repository)\s*:\s*"?(.+)"?\s*$/m); + if (repository) { + let place = repository[1]; + if (place.endsWith('"')) { + place = place.slice(0, -1) + } + item.place = place; + } + + let keywords = extractKeywords(cffText) if (keywords.length > 0) { - item.tags = item.tags.concat(keywords); + item.tags = []; + item.tags = item.tags.concat(keywords); + item.tags = [...new Set(item.tags)]; } - item.complete(); + if (item.creators.length === 0) { + completeWithAPI(item, owner, githubRepository); + } + else { + item.complete(); + } }, null, null, null, false); } }); @@ -218,36 +293,50 @@ function completeWithBibTeX(item, bibtex) { // Parse the YAML and extract keywords function extractKeywords(cffText) { - // Use a regular expression to extract the `keywords` block - const match = cffText.match(/keywords:\s+((?:- .+\s*)+)/); - if (!match) return []; // Return an empty array if no keywords found - - // Extract the lines under `keywords` and clean them up - const keywordsBlock = match[1]; - return keywordsBlock - .split("\n") // Split into lines - .map(line => line.trim().replace(/^- /, "")) // Trim and remove `- ` - .filter(line => line !== ""); // Remove empty lines + // Use a regular expression to extract the `keywords` block + const match = cffText.match(/keywords:\s+((?:- .+\s*)+)/); + if (!match) return []; // Return an empty array if no keywords found + + // Extract the lines under `keywords` and clean them up + const keywordsBlock = match[1]; + return keywordsBlock + .split("\n") // Split into lines + .map(line => line.trim().replace(/^- /, "")) // Trim and remove `- ` + .filter(line => line !== ""); // Remove empty lines } -function completeWithAPI(item, owner) { +function completeWithAPI(item, owner, githubRepository) { ZU.doGet(apiUrl + "users/" + owner, function (user) { var jsonUser = JSON.parse(user); var ownerName = jsonUser.name || jsonUser.login; if (jsonUser.type == "User") { + item.creators = []; item.creators.push(ZU.cleanAuthor(ownerName, "programmer")); } else { item.company = ownerName; } - ZU.processDocuments(`/${item.title}`, function (rootDoc) { - let readmeTitle = text(rootDoc, '#readme h1'); - if (readmeTitle) { - item.title = readmeTitle; - } + if (item.creators.length === 0) { + item.creators.push({ + "lastName": owner, + fieldMode: 1, + "creatorType": "programmer" + }) + } + + if (item.url.indexOf('/blob/') === -1) { + ZU.processDocuments(`/${githubRepository}`, function (rootDoc) { + let readmeTitle = text(rootDoc, '.markdown-heading h1.heading-element'); + if (readmeTitle) { + item.title = readmeTitle; + } + item.complete(); + }); + } + else { item.complete(); - }); + } }); } @@ -255,13 +344,19 @@ function completeWithAPI(item, owner) { var testCases = [ { "type": "web", - "url": "https://github.com/zotero/zotero/", + "url": "https://github.com/zotero/zotero/tree/0a6095322668908f243a536a4e43911d80f76b75", "items": [ { "itemType": "computerProgram", - "title": "zotero/zotero", - "creators": [], - "date": "2025-01-04T07:24:46Z", + "title": "Zotero", + "creators": [ + { + "lastName": "zotero", + "creatorType": "author" + } + ], + "version": "0a6095322668908f243a536a4e43911d80f76b75", + "date": "2024-12-06T09:38:01Z", "abstractNote": "Zotero is a free, easy-to-use tool to help you collect, organize, annotate, cite, and share your research sources.", "company": "Zotero", "extra": "original-date: 2011-10-27T07:46:48Z", @@ -282,19 +377,25 @@ var testCases = [ }, { "type": "web", - "url": "https://github.com/datacite/schema", + "url": "https://github.com/datacite/schema/tree/4.6.0", "items": [ { "itemType": "computerProgram", - "title": "datacite/schema", - "creators": [], - "date": "2024-12-05T18:31:44Z", + "title": "DataCite Schema Repository", + "creators": [ + { + "lastName": "datacite", + "creatorType": "author" + } + ], + "version": "29c5068d0c9d41c0e678915273ab487c89497135", + "date": "2024-12-05T18:31:38Z", "abstractNote": "DataCite Metadata Schema Repository", "company": "DataCite", "extra": "original-date: 2011-04-13T07:08:41Z", "libraryCatalog": "GitHub", "programmingLanguage": "Ruby", - "url": "https://github.com/datacite/schema", + "url": "https://github.com/datacite/schema/tree/4.6.0", "attachments": [], "tags": [], "notes": [], @@ -316,30 +417,42 @@ var testCases = [ "creatorType": "author" } ], - "date": "2021-07-29T12:26:11Z", + "date": "2022-04", "abstractNote": "OCR engine for all the languages", "extra": "original-date: 2015-05-19T09:24:38Z", - "version": "4.1.2", "libraryCatalog": "GitHub", "programmingLanguage": "Python", + "version": "4.1.2", "rights": "Apache-2.0", - "url": "https://github.com/mittagessen/kraken", + "url": "https://kraken.re", "attachments": [], "tags": [ { "tag": "alto-xml" }, + { + "tag": "handwritten-text-recognition" + }, { "tag": "hocr" }, { - "tag": "lstm" + "tag": "htr" + }, + { + "tag": "layout-analysis" + }, + { + "tag": "optical-character-recognition" }, { "tag": "neural-networks" }, { "tag": "ocr" + }, + { + "tag": "page-xml" } ], "notes": [], @@ -349,7 +462,7 @@ var testCases = [ }, { "type": "web", - "url": "https://github.com/aurimasv/z2csl", + "url": "https://github.com/aurimasv/z2csl/tree/5750900e907b6730ccd724e23444ccc79d15f3f3", "items": [ { "itemType": "computerProgram", @@ -358,15 +471,15 @@ var testCases = [ { "firstName": "Aurimas", "lastName": "Vinckevicius", - "creatorType": "programmer" + "creatorType": "author" } ], - "date": "2021-03-20T15:33:50Z", + "date": "2022-07-14T16:14:40Z", "abstractNote": "Zotero extension for creating Zotero to CSL item type and field mappings.", "extra": "original-date: 2012-05-20T07:53:58Z", "libraryCatalog": "GitHub", "programmingLanguage": "JavaScript", - "url": "https://github.com/aurimasv/z2csl", + "url": "https://github.com/aurimasv/z2csl/tree/5750900e907b6730ccd724e23444ccc79d15f3f3", "attachments": [], "tags": [], "notes": [], @@ -376,13 +489,19 @@ var testCases = [ }, { "type": "web", - "url": "https://github.com/zotero/translators/blob/master/GitHub.js", + "url": "https://github.com/zotero/translators/blob/eb4f39007e62d3d632448e184b1fd3671b3a1349/GitHub.js", "items": [ { "itemType": "computerProgram", - "title": "zotero/translators", - "creators": [], + "title": "GitHub.js", + "creators": [ + { + "lastName": "zotero", + "creatorType": "author" + } + ], "date": "2021-07-29T04:53:43Z", + "version": "eb4f39007e62d3d632448e184b1fd3671b3a1349", "abstractNote": "Zotero Translators", "company": "Zotero", "extra": "original-date: 2011-07-03T17:40:38Z", @@ -398,7 +517,7 @@ var testCases = [ }, { "type": "web", - "url": "https://github.com/citation-file-format/citation-file-format", + "url": "https://github.com/citation-file-format/citation-file-format/tree/1.2.0", "items": [ { "itemType": "computerProgram", @@ -450,16 +569,41 @@ var testCases = [ "creatorType": "author" } ], - "date": "2021-05", - "abstractNote": "A machine-readable and human-readable and -writable format for CITATION files. CITATION files provide reference and citation information for (research/scientific) software.", - "extra": "DOI: 10.5281/zenodo.4751536", + "date": "2021-08", + "abstractNote": "The Citation File Format lets you provide citation metadata for software or datasets in plaintext files that are easy to read by both humans and machines.", + "extra": "DOI: 10.5281/zenodo.5171937", "libraryCatalog": "GitHub", "programmingLanguage": "Python", "rights": "CC-BY-4.0", - "url": "https://github.com/citation-file-format/citation-file-format", - "versionNumber": "1.1.0", + "url": "https://github.com/citation-file-format/citation-file-format/tree/1.2.0", + "versionNumber": "1.2.0", "attachments": [], - "tags": [], + "tags": [ + { + "tag": "attribution" + }, + { + "tag": "citation" + }, + { + "tag": "citation-files" + }, + { + "tag": "credit" + }, + { + "tag": "format" + }, + { + "tag": "research-software-engineering" + }, + { + "tag": "software-sustainability" + }, + { + "tag": "wssspe" + } + ], "notes": [], "seeAlso": [] } @@ -467,11 +611,11 @@ var testCases = [ }, { "type": "web", - "url": "https://github.com/citation-file-format/citation-file-format/blob/main/test/pytest.ini", + "url": "https://github.com/citation-file-format/citation-file-format/blob/1.1.0/test/pytest.ini", "items": [ { "itemType": "computerProgram", - "title": "Citation File Format", + "title": "pytest.ini", "creators": [ { "firstName": "Stephan", @@ -533,6 +677,42 @@ var testCases = [ "seeAlso": [] } ] + }, + { + "type": "web", + "url": "https://github.com/pulipulichen/PTS-Local-News-Dataset/tree/20250105-0131", + "items": [ + { + "itemType": "dataset", + "title": "PTS-Local-News-Dataset", + "creators": [ + { + "firstName": "Yung-Ting", + "lastName": "Chen", + "creatorType": "author" + } + ], + "date": "2025-01-04T17:28:41Z", + "abstractNote": "A dataset containing local news from Taiwan Public Television Service.", + "extra": "DOI: 10.5281/zenodo.14598063", + "libraryCatalog": "GitHub", + "url": "https://github.com/pulipulichen/PTS-Local-News-Dataset", + "attachments": [], + "tags": [ + { + "tag": "dataset" + }, + { + "tag": "news" + }, + { + "tag": "PTS" + } + ], + "notes": [], + "seeAlso": [] + } + ] } ] -/** END TEST CASES **/ +/** END TEST CASES **/ \ No newline at end of file From 0a31d7f076816e5ecbebdb5174632da599e3a899 Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 03:12:20 +0800 Subject: [PATCH 07/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2003=E6=99=8212?= =?UTF-8?q?=E5=88=8620=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 57 +++++++++++++++++++++++++++---------------------------- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/GitHub.js b/GitHub.js index 8c12542e133..3c60942b880 100644 --- a/GitHub.js +++ b/GitHub.js @@ -46,8 +46,8 @@ function detectWeb(doc, url) { } // `og:title` is messed up when browsing a file. - let ogTitle = attr(doc, 'meta[property="og:url"]', 'content') - if (ogTitle.indexOf('/blob/') > -1 || url.startsWith(ogTitle + '/blob/')) { + let ogTitle = attr(doc, 'meta[property="og:url"]', 'content'); + if (ogTitle.includes('/blob/') || url.startsWith(ogTitle + '/blob/')) { return "computerProgram"; } @@ -137,7 +137,7 @@ function scrape(doc, url) { let latestCommitLink = attr(doc, '[data-testid="latest-commit-html"] a', 'href'); let commitHash = false; - if (latestCommitLink.indexOf('/') > -1) { + if (latestCommitLink.includes('/')) { commitHash = latestCommitLink.split('/').pop(); } @@ -153,7 +153,7 @@ function scrape(doc, url) { } else { if (!item.versionNumber) { - item.versionNumber = commitHash + item.versionNumber = commitHash; } let canonical = attr(doc, 'link[rel="canonical"]', 'href'); @@ -166,7 +166,7 @@ function scrape(doc, url) { const commitTime = commitData.commit.author.date; // ISO 8601 format item.date = commitTime; scrapeRepos(item, url, githubRepository); - }) + }); } } @@ -181,7 +181,7 @@ function scrapeRepos(item, url, githubRepository) { var owner = json.owner.login; item.programmingLanguage = json.language; - item.extra = "original-date: " + json.created_at; + item.extra = "original-date: " + json.created_at; if (!item.date && json.updated_at) { item.date = json.updated_at; } @@ -198,7 +198,6 @@ function scrapeRepos(item, url, githubRepository) { let bibtex = attr(doc, '[aria-labelledby="bibtex-tab"] input', 'value'); if (bibtex && bibtex.trim()) { - item.extra = "1" completeWithBibTeX(item, bibtex, githubRepository, owner); return; } @@ -225,16 +224,16 @@ function completeWithBibTeX(item, bibtex, githubRepository, owner) { delete bibItem.attachments; delete bibItem.itemID; - let tags = [...item.tags] - let title = item.title + let tags = [...item.tags]; + let title = item.title; Object.assign(item, bibItem); if (item.tags.length === 0 && tags.length > 0) { - item.tags = tags + item.tags = tags; } if (item.url.includes('/blob/')) { - item.title = title + item.title = title; } if (item.version) { @@ -266,16 +265,16 @@ function completeWithBibTeX(item, bibtex, githubRepository, owner) { if (repository) { let place = repository[1]; if (place.endsWith('"')) { - place = place.slice(0, -1) + place = place.slice(0, -1); } item.place = place; } - let keywords = extractKeywords(cffText) + let keywords = extractKeywords(cffText); if (keywords.length > 0) { item.tags = []; - item.tags = item.tags.concat(keywords); - item.tags = [...new Set(item.tags)]; + item.tags = item.tags.concat(keywords); + item.tags = [...new Set(item.tags)]; } if (item.creators.length === 0) { @@ -293,16 +292,16 @@ function completeWithBibTeX(item, bibtex, githubRepository, owner) { // Parse the YAML and extract keywords function extractKeywords(cffText) { - // Use a regular expression to extract the `keywords` block - const match = cffText.match(/keywords:\s+((?:- .+\s*)+)/); - if (!match) return []; // Return an empty array if no keywords found - - // Extract the lines under `keywords` and clean them up - const keywordsBlock = match[1]; - return keywordsBlock - .split("\n") // Split into lines - .map(line => line.trim().replace(/^- /, "")) // Trim and remove `- ` - .filter(line => line !== ""); // Remove empty lines + // Use a regular expression to extract the `keywords` block + const match = cffText.match(/keywords:\s+((?:- .+\s*)+)/); + if (!match) return []; // Return an empty array if no keywords found + + // Extract the lines under `keywords` and clean them up + const keywordsBlock = match[1]; + return keywordsBlock + .split("\n") // Split into lines + .map(line => line.trim().replace(/^- /, "")) // Trim and remove `- ` + .filter(line => line !== ""); // Remove empty lines } function completeWithAPI(item, owner, githubRepository) { @@ -319,13 +318,13 @@ function completeWithAPI(item, owner, githubRepository) { if (item.creators.length === 0) { item.creators.push({ - "lastName": owner, + lastName: owner, fieldMode: 1, - "creatorType": "programmer" - }) + creatorType: "programmer" + }); } - if (item.url.indexOf('/blob/') === -1) { + if (item.url.includes('/blob/')) { ZU.processDocuments(`/${githubRepository}`, function (rootDoc) { let readmeTitle = text(rootDoc, '.markdown-heading h1.heading-element'); if (readmeTitle) { From fd7ab1b296b387184010753e921bc46aab86f044 Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 03:14:54 +0800 Subject: [PATCH 08/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2003=E6=99=8214?= =?UTF-8?q?=E5=88=8654=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Access Science.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Access Science.js b/Access Science.js index 2ae9f1cee13..0070e8dd9ce 100644 --- a/Access Science.js +++ b/Access Science.js @@ -108,7 +108,7 @@ function scrape(doc, url) { item.creators = []; if (authorName.includes(',') && authorName.split(',').length > 2) { authorName = authorName.split(',')[0]; - item.creators.push(ZU.cleanAuthor(authorName, "author", true)); + item.creators.push(ZU.cleanAuthor(authorName, "author", false)); } } } @@ -388,4 +388,4 @@ var testCases = [ "items": "multiple" } ] -/** END TEST CASES **/ +/** END TEST CASES **/ \ No newline at end of file From bd021b8a6eae199e7bb5bbf67e0713be0b536e18 Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 03:41:13 +0800 Subject: [PATCH 09/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2003=E6=99=8241?= =?UTF-8?q?=E5=88=8613=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 80 ++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 67 insertions(+), 13 deletions(-) diff --git a/GitHub.js b/GitHub.js index 3c60942b880..489b9e55d5a 100644 --- a/GitHub.js +++ b/GitHub.js @@ -64,7 +64,7 @@ function detectWeb(doc, url) { function getSearchResults(doc, checkOnly) { var items = {}; var found = false; - var rows = doc.querySelectorAll('.repo-list-item .f4 a'); + var rows = doc.querySelectorAll('[data-testid="results-list"] .search-title a'); for (var i = 0; i < rows.length; i++) { var href = rows[i].href; var title = ZU.trimInternal(rows[i].textContent); @@ -123,8 +123,12 @@ function scrape(doc, url) { item.title = githubRepository; if (url.includes('/blob/')) { let fileNameID = text(doc, '#file-name-id'); + if (!fileNameID && fileNameID.trim() === '') { + fileNameID = text(doc, '#file-name-id-wide'); + } if (fileNameID && fileNameID.trim() !== '') { item.title = fileNameID.trim(); + item.extra = "a1" } } item.abstractNote = attr(doc, 'meta[property="og:description"]', 'content').split(' - ')[0] @@ -145,6 +149,7 @@ function scrape(doc, url) { let readmeTitle = text(doc, '.markdown-heading h1.heading-element'); if (readmeTitle) { item.title = readmeTitle; + item.extra = "a2" } } @@ -153,7 +158,13 @@ function scrape(doc, url) { } else { if (!item.versionNumber) { - item.versionNumber = commitHash; + let codeTab = attr(doc, "#code-tab", "href"); + if (codeTab.includes('/tree/') && codeTab.endsWith(commitHash) === false) { + item.versionNumber = codeTab.split('/').pop(); + } + else { + item.versionNumber = commitHash; + } } let canonical = attr(doc, 'link[rel="canonical"]', 'href'); @@ -232,8 +243,10 @@ function completeWithBibTeX(item, bibtex, githubRepository, owner) { if (item.tags.length === 0 && tags.length > 0) { item.tags = tags; } + item.extra = "a3" + item.title if (item.url.includes('/blob/')) { item.title = title; + item.extra = "a4" } if (item.version) { @@ -324,7 +337,7 @@ function completeWithAPI(item, owner, githubRepository) { }); } - if (item.url.includes('/blob/')) { + if (item.url.includes('/blob/') === false) { ZU.processDocuments(`/${githubRepository}`, function (rootDoc) { let readmeTitle = text(rootDoc, '.markdown-heading h1.heading-element'); if (readmeTitle) { @@ -351,7 +364,8 @@ var testCases = [ "creators": [ { "lastName": "zotero", - "creatorType": "author" + "creatorType": "programmer", + "fieldMode": 1 } ], "version": "0a6095322668908f243a536a4e43911d80f76b75", @@ -361,7 +375,9 @@ var testCases = [ "extra": "original-date: 2011-10-27T07:46:48Z", "libraryCatalog": "GitHub", "programmingLanguage": "JavaScript", - "url": "https://github.com/zotero/zotero", + "url": "https://github.com/zotero/zotero/tree/0a6095322668908f243a536a4e43911d80f76b75", + "versionNumber": "0a6095322668908f243a536a4e43911d80f76b75", + "place": "GitHub", "attachments": [], "tags": [], "notes": [], @@ -384,17 +400,49 @@ var testCases = [ "creators": [ { "lastName": "datacite", - "creatorType": "author" + "creatorType": "programmer", + "fieldMode": 1 } ], - "version": "29c5068d0c9d41c0e678915273ab487c89497135", - "date": "2024-12-05T18:31:38Z", + "date": "2016-08-23T16:42:17Z", "abstractNote": "DataCite Metadata Schema Repository", "company": "DataCite", "extra": "original-date: 2011-04-13T07:08:41Z", "libraryCatalog": "GitHub", "programmingLanguage": "Ruby", "url": "https://github.com/datacite/schema/tree/4.6.0", + "versionNumber": "4.6.0", + "place": "GitHub", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://github.com/datacite/schema/blob/4.6.0/.dockerignore", + "items": [ + { + "itemType": "computerProgram", + "title": ".dockerignore", + "creators": [ + { + "lastName": "datacite", + "creatorType": "programmer", + "fieldMode": 1 + } + ], + "date": "2016-08-23T16:42:17Z", + "abstractNote": "DataCite Metadata Schema Repository", + "company": "DataCite", + "extra": "original-date: 2011-04-13T07:08:41Z", + "libraryCatalog": "GitHub", + "programmingLanguage": "Ruby", + "url": "https://github.com/datacite/schema/tree/4.6.0", + "versionNumber": "4.6.0", + "place": "GitHub", "attachments": [], "tags": [], "notes": [], @@ -421,7 +469,8 @@ var testCases = [ "extra": "original-date: 2015-05-19T09:24:38Z", "libraryCatalog": "GitHub", "programmingLanguage": "Python", - "version": "4.1.2", + "versionNumber": "4.1.2", + "place": "GitHub", "rights": "Apache-2.0", "url": "https://kraken.re", "attachments": [], @@ -470,15 +519,17 @@ var testCases = [ { "firstName": "Aurimas", "lastName": "Vinckevicius", - "creatorType": "author" + "creatorType": "programmer" } ], - "date": "2022-07-14T16:14:40Z", + "date": "2024-12-23T20:52:59Z", "abstractNote": "Zotero extension for creating Zotero to CSL item type and field mappings.", "extra": "original-date: 2012-05-20T07:53:58Z", "libraryCatalog": "GitHub", "programmingLanguage": "JavaScript", + "versionNumber": "5750900e907b6730ccd724e23444ccc79d15f3f3", "url": "https://github.com/aurimasv/z2csl/tree/5750900e907b6730ccd724e23444ccc79d15f3f3", + "place": "GitHub", "attachments": [], "tags": [], "notes": [], @@ -496,16 +547,18 @@ var testCases = [ "creators": [ { "lastName": "zotero", - "creatorType": "author" + "creatorType": "programmer", + "fieldMode": 1 } ], "date": "2021-07-29T04:53:43Z", - "version": "eb4f39007e62d3d632448e184b1fd3671b3a1349", + "versionNumber": "eb4f39007e62d3d632448e184b1fd3671b3a1349", "abstractNote": "Zotero Translators", "company": "Zotero", "extra": "original-date: 2011-07-03T17:40:38Z", "libraryCatalog": "GitHub", "programmingLanguage": "JavaScript", + "place": "GitHub", "url": "https://github.com/zotero/translators/blob/eb4f39007e62d3d632448e184b1fd3671b3a1349/GitHub.js", "attachments": [], "tags": [], @@ -696,6 +749,7 @@ var testCases = [ "extra": "DOI: 10.5281/zenodo.14598063", "libraryCatalog": "GitHub", "url": "https://github.com/pulipulichen/PTS-Local-News-Dataset", + "versionNumber": "20250105-0131", "attachments": [], "tags": [ { From 12cdf3da60ca76584ddb26a67700738ce257e3ea Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 03:56:57 +0800 Subject: [PATCH 10/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2003=E6=99=8256?= =?UTF-8?q?=E5=88=8657=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Access Science.js | 2 +- GitHub.js | 27 ++++++++++++++------------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/Access Science.js b/Access Science.js index 0070e8dd9ce..34be151f37b 100644 --- a/Access Science.js +++ b/Access Science.js @@ -388,4 +388,4 @@ var testCases = [ "items": "multiple" } ] -/** END TEST CASES **/ \ No newline at end of file +/** END TEST CASES **/ diff --git a/GitHub.js b/GitHub.js index 489b9e55d5a..ffe1aea6585 100644 --- a/GitHub.js +++ b/GitHub.js @@ -128,7 +128,6 @@ function scrape(doc, url) { } if (fileNameID && fileNameID.trim() !== '') { item.title = fileNameID.trim(); - item.extra = "a1" } } item.abstractNote = attr(doc, 'meta[property="og:description"]', 'content').split(' - ')[0] @@ -149,7 +148,6 @@ function scrape(doc, url) { let readmeTitle = text(doc, '.markdown-heading h1.heading-element'); if (readmeTitle) { item.title = readmeTitle; - item.extra = "a2" } } @@ -243,10 +241,8 @@ function completeWithBibTeX(item, bibtex, githubRepository, owner) { if (item.tags.length === 0 && tags.length > 0) { item.tags = tags; } - item.extra = "a3" + item.title if (item.url.includes('/blob/')) { item.title = title; - item.extra = "a4" } if (item.version) { @@ -291,7 +287,10 @@ function completeWithBibTeX(item, bibtex, githubRepository, owner) { } if (item.creators.length === 0) { - completeWithAPI(item, owner, githubRepository); + // Delay execution to avoid API rate limiting. + setTimeout(function () { + completeWithAPI(item, owner, githubRepository); + }, 3000); } else { item.complete(); @@ -404,7 +403,7 @@ var testCases = [ "fieldMode": 1 } ], - "date": "2016-08-23T16:42:17Z", + "date": "2024-12-05T18:31:38Z", "abstractNote": "DataCite Metadata Schema Repository", "company": "DataCite", "extra": "original-date: 2011-04-13T07:08:41Z", @@ -434,13 +433,13 @@ var testCases = [ "fieldMode": 1 } ], - "date": "2016-08-23T16:42:17Z", + "date": "2024-12-05T18:31:38Z", "abstractNote": "DataCite Metadata Schema Repository", "company": "DataCite", "extra": "original-date: 2011-04-13T07:08:41Z", "libraryCatalog": "GitHub", "programmingLanguage": "Ruby", - "url": "https://github.com/datacite/schema/tree/4.6.0", + "url": "https://github.com/datacite/schema/tree/4.6.0/.dockerignore", "versionNumber": "4.6.0", "place": "GitHub", "attachments": [], @@ -629,6 +628,7 @@ var testCases = [ "rights": "CC-BY-4.0", "url": "https://github.com/citation-file-format/citation-file-format/tree/1.2.0", "versionNumber": "1.2.0", + "place": "GitHub", "attachments": [], "tags": [ { @@ -710,19 +710,20 @@ var testCases = [ "creatorType": "author" }, { - "firstName": "Alexander", + "firstName": "Olexandr", "lastName": "Konovalov", "creatorType": "author" } ], - "date": "2021-05", - "abstractNote": "A machine-readable and human-readable and -writable format for CITATION files. CITATION files provide reference and citation information for (research/scientific) software.", + "date": "2021-08", + "abstractNote": "The Citation File Format lets you provide citation metadata for software or datasets in plaintext files that are easy to read by both humans and machines.", "extra": "DOI: 10.5281/zenodo.4751536", "libraryCatalog": "GitHub", "programmingLanguage": "Python", "rights": "CC-BY-4.0", - "url": "https://github.com/citation-file-format/citation-file-format/blob/9879c64a37a9d4f3f18b67594aa3f3bf763fb69a/test/pytest.ini", + "url": "https://github.com/citation-file-format/citation-file-format/blob/1.1.0/test/pytest.ini", "versionNumber": "1.1.0", + "place": "GitHub", "attachments": [], "tags": [], "notes": [], @@ -768,4 +769,4 @@ var testCases = [ ] } ] -/** END TEST CASES **/ \ No newline at end of file +/** END TEST CASES **/ From b6d848094ebc5c213f52ed202f7991937ce07e7d Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 04:00:29 +0800 Subject: [PATCH 11/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2004=E6=99=8200?= =?UTF-8?q?=E5=88=8629=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GitHub.js b/GitHub.js index ffe1aea6585..daf0e23b239 100644 --- a/GitHub.js +++ b/GitHub.js @@ -138,7 +138,7 @@ function scrape(doc, url) { item.tags.push(topics[i].textContent.trim()); } - let latestCommitLink = attr(doc, '[data-testid="latest-commit-html"] a', 'href'); + let latestCommitLink = attr(doc, 'link[rel="canonical"]', 'href'); let commitHash = false; if (latestCommitLink.includes('/')) { commitHash = latestCommitLink.split('/').pop(); From 4968bc90d61fc8408efc2169466f92e22128facd Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 04:09:42 +0800 Subject: [PATCH 12/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2004=E6=99=8209?= =?UTF-8?q?=E5=88=8642=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/GitHub.js b/GitHub.js index daf0e23b239..132cdb8f7f4 100644 --- a/GitHub.js +++ b/GitHub.js @@ -139,6 +139,9 @@ function scrape(doc, url) { } let latestCommitLink = attr(doc, 'link[rel="canonical"]', 'href'); + if (!latestCommitLink) { + latestCommitLink = attr(doc, '[data-testid="latest-commit-html"] a', 'href'); + } let commitHash = false; if (latestCommitLink.includes('/')) { commitHash = latestCommitLink.split('/').pop(); From f33005c7bc0a2518dc3bc30edb051961a9d7d588 Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 04:39:55 +0800 Subject: [PATCH 13/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2004=E6=99=8239?= =?UTF-8?q?=E5=88=8655=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 122 +++++++++++++++++++++++++++++++++--------------------- 1 file changed, 74 insertions(+), 48 deletions(-) diff --git a/GitHub.js b/GitHub.js index 132cdb8f7f4..fe3ca5a575b 100644 --- a/GitHub.js +++ b/GitHub.js @@ -118,6 +118,7 @@ function scrape(doc, url) { } } } + // Do not rely on `og:title` since GitHub isn't consistent with its meta attribute. let githubRepository = item.url.split('/').slice(3, 5).join('/'); item.title = githubRepository; @@ -172,6 +173,7 @@ function scrape(doc, url) { if (canonical) { item.url = canonical; } + item.extra = 'a4' + item.url ZU.doGet(apiUrl + "repos/" + githubRepository + "/commits/" + commitHash, function (result) { var commitData = JSON.parse(result); @@ -236,70 +238,62 @@ function completeWithBibTeX(item, bibtex, githubRepository, owner) { delete bibItem.attachments; delete bibItem.itemID; + let tags = [...item.tags]; let title = item.title; + let versionNumber = item.versionNumber + let url = item.url Object.assign(item, bibItem); if (item.tags.length === 0 && tags.length > 0) { item.tags = tags; } - if (item.url.includes('/blob/')) { + if (url.includes('/blob/')) { item.title = title; + item.versionNumber = versionNumber; + item.version = versionNumber; + item.url = url } - if (item.version) { - item.complete(); - } - else { - ZU.doGet(`https://raw.githubusercontent.com/${path}/HEAD/CITATION.cff`, function (cffText) { - let version = cffText.match(/^\s*(?:"version"|version)\s*:\s*"?(.+)"?\s*$/m); - if (version) { - item.versionNumber = version[1]; - } + ZU.doGet(`https://raw.githubusercontent.com/${path}/HEAD/CITATION.cff`, function (cffText) { + let yaml = parseYAML(cffText) + if (!item.versionNumber && yaml.version) { + item.versionNumber = yaml.version; + } - let type = cffText.match(/^\s*(?:"type"|type)\s*:\s*"?(.+)"?\s*$/m); - if (type && type[1] === 'dataset') { - item.itemType = type[1]; - } + if (yaml.type && yaml.type === 'dataset') { + item.itemType = yaml.type; + } - let abstract = cffText.match(/^\s*(?:"abstract"|abstract)\s*:\s*"?(.+)"?\s*$/m); - if (abstract) { - item.abstractNote = abstract[1]; - } + if (yaml.abstract) { + item.abstractNote = yaml.abstract; + } - let cffUrl = cffText.match(/^\s*(?:"url"|url)\s*:\s*"?(.+)"?\s*$/m); - if (cffUrl) { - item.url = cffUrl[1]; - } + if (yaml.url && item.url.includes('/blob/') === false) { + item.url = yaml.url; + } - let repository = cffText.match(/^\s*(?:"repository"|repository)\s*:\s*"?(.+)"?\s*$/m); - if (repository) { - let place = repository[1]; - if (place.endsWith('"')) { - place = place.slice(0, -1); - } - item.place = place; - } + if (yaml.repository) { + item.place = yaml.place; + } - let keywords = extractKeywords(cffText); - if (keywords.length > 0) { - item.tags = []; - item.tags = item.tags.concat(keywords); - item.tags = [...new Set(item.tags)]; - } + if (yaml.keywords.length > 0) { + item.tags = []; + item.tags = item.tags.concat(yaml.keywords); + item.tags = [...new Set(item.tags)]; + } - if (item.creators.length === 0) { - // Delay execution to avoid API rate limiting. - setTimeout(function () { - completeWithAPI(item, owner, githubRepository); - }, 3000); - } - else { - item.complete(); - } - }, null, null, null, false); - } + if (item.creators.length === 0) { + // Delay execution to avoid API rate limiting. + setTimeout(function () { + completeWithAPI(item, owner, githubRepository); + }, 3000); + } + else { + item.complete(); + } + }, null, null, null, false); }); translator.translate(); @@ -354,6 +348,38 @@ function completeWithAPI(item, owner, githubRepository) { }); } +function parseYAML(yamlText) { + const lines = yamlText.split('\n'); + const result = {}; + + for (let line of lines) { + // Trim whitespace and ignore empty lines or comments + line = line.trim(); + if (!line || line.startsWith('#')) continue; + + // Split key and value at the first colon + const [key, ...valueParts] = line.split(':'); + const value = valueParts.join(':').trim(); + + // Handle different value types + if (value.startsWith('"') && value.endsWith('"')) { + // Quoted string + result[key.trim()] = value.slice(1, -1); + } else if (value === 'true' || value === 'false') { + // Boolean + result[key.trim()] = value === 'true'; + } else if (!isNaN(value)) { + // Number + result[key.trim()] = parseFloat(value); + } else { + // Unquoted string + result[key.trim()] = value; + } + } + + return result; +} + /** BEGIN TEST CASES **/ var testCases = [ { @@ -720,7 +746,7 @@ var testCases = [ ], "date": "2021-08", "abstractNote": "The Citation File Format lets you provide citation metadata for software or datasets in plaintext files that are easy to read by both humans and machines.", - "extra": "DOI: 10.5281/zenodo.4751536", + "extra": "DOI: 10.5281/zenodo.5171937", "libraryCatalog": "GitHub", "programmingLanguage": "Python", "rights": "CC-BY-4.0", From 72c4e4dfd94e91094636e9b8af6b852d80f81f37 Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 04:50:19 +0800 Subject: [PATCH 14/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2004=E6=99=8250?= =?UTF-8?q?=E5=88=8619=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 87 +++++++++++++++++++++++-------------------------------- 1 file changed, 37 insertions(+), 50 deletions(-) diff --git a/GitHub.js b/GitHub.js index fe3ca5a575b..bb6ca27d3fb 100644 --- a/GitHub.js +++ b/GitHub.js @@ -173,7 +173,6 @@ function scrape(doc, url) { if (canonical) { item.url = canonical; } - item.extra = 'a4' + item.url ZU.doGet(apiUrl + "repos/" + githubRepository + "/commits/" + commitHash, function (result) { var commitData = JSON.parse(result); @@ -241,8 +240,8 @@ function completeWithBibTeX(item, bibtex, githubRepository, owner) { let tags = [...item.tags]; let title = item.title; - let versionNumber = item.versionNumber - let url = item.url + let versionNumber = item.versionNumber; + let url = item.url; Object.assign(item, bibItem); @@ -253,7 +252,7 @@ function completeWithBibTeX(item, bibtex, githubRepository, owner) { item.title = title; item.versionNumber = versionNumber; item.version = versionNumber; - item.url = url + item.url = url; } ZU.doGet(`https://raw.githubusercontent.com/${path}/HEAD/CITATION.cff`, function (cffText) { @@ -299,20 +298,6 @@ function completeWithBibTeX(item, bibtex, githubRepository, owner) { translator.translate(); } -// Parse the YAML and extract keywords -function extractKeywords(cffText) { - // Use a regular expression to extract the `keywords` block - const match = cffText.match(/keywords:\s+((?:- .+\s*)+)/); - if (!match) return []; // Return an empty array if no keywords found - - // Extract the lines under `keywords` and clean them up - const keywordsBlock = match[1]; - return keywordsBlock - .split("\n") // Split into lines - .map(line => line.trim().replace(/^- /, "")) // Trim and remove `- ` - .filter(line => line !== ""); // Remove empty lines -} - function completeWithAPI(item, owner, githubRepository) { ZU.doGet(apiUrl + "users/" + owner, function (user) { var jsonUser = JSON.parse(user); @@ -349,35 +334,37 @@ function completeWithAPI(item, owner, githubRepository) { } function parseYAML(yamlText) { - const lines = yamlText.split('\n'); - const result = {}; - - for (let line of lines) { - // Trim whitespace and ignore empty lines or comments - line = line.trim(); - if (!line || line.startsWith('#')) continue; - - // Split key and value at the first colon - const [key, ...valueParts] = line.split(':'); - const value = valueParts.join(':').trim(); - - // Handle different value types - if (value.startsWith('"') && value.endsWith('"')) { - // Quoted string - result[key.trim()] = value.slice(1, -1); - } else if (value === 'true' || value === 'false') { - // Boolean - result[key.trim()] = value === 'true'; - } else if (!isNaN(value)) { - // Number - result[key.trim()] = parseFloat(value); - } else { - // Unquoted string - result[key.trim()] = value; - } - } - - return result; + const lines = yamlText.split('\n'); + const result = {}; + + for (let line of lines) { + // Trim whitespace and ignore empty lines or comments + line = line.trim(); + if (!line || line.startsWith('#')) { + continue; + } + + // Split key and value at the first colon + const [key, ...valueParts] = line.split(':'); + const value = valueParts.join(':').trim(); + + // Handle different value types + if (value.startsWith('"') && value.endsWith('"')) { + // Quoted string + result[key.trim()] = value.slice(1, -1); + } else if (value === 'true' || value === 'false') { + // Boolean + result[key.trim()] = value === 'true'; + } else if (!isNaN(value)) { + // Number + result[key.trim()] = parseFloat(value); + } else { + // Unquoted string + result[key.trim()] = value; + } + } + + return result; } /** BEGIN TEST CASES **/ @@ -432,13 +419,13 @@ var testCases = [ "fieldMode": 1 } ], - "date": "2024-12-05T18:31:38Z", + "date": "2024-12-05T18:31:44Z", "abstractNote": "DataCite Metadata Schema Repository", "company": "DataCite", "extra": "original-date: 2011-04-13T07:08:41Z", "libraryCatalog": "GitHub", "programmingLanguage": "Ruby", - "url": "https://github.com/datacite/schema/tree/4.6.0", + "url": "https://github.com/datacite/schema/blob/4.6.0", "versionNumber": "4.6.0", "place": "GitHub", "attachments": [], @@ -462,7 +449,7 @@ var testCases = [ "fieldMode": 1 } ], - "date": "2024-12-05T18:31:38Z", + "date": "2016-08-23T16:42:17Z", "abstractNote": "DataCite Metadata Schema Repository", "company": "DataCite", "extra": "original-date: 2011-04-13T07:08:41Z", From 5e9a9493e5b29365351aa1b8616847f34c3b0025 Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 05:07:25 +0800 Subject: [PATCH 15/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2005=E6=99=8207?= =?UTF-8?q?=E5=88=8625=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 47 ++++++++--------------------------------------- 1 file changed, 8 insertions(+), 39 deletions(-) diff --git a/GitHub.js b/GitHub.js index bb6ca27d3fb..c20d3788957 100644 --- a/GitHub.js +++ b/GitHub.js @@ -256,7 +256,7 @@ function completeWithBibTeX(item, bibtex, githubRepository, owner) { } ZU.doGet(`https://raw.githubusercontent.com/${path}/HEAD/CITATION.cff`, function (cffText) { - let yaml = parseYAML(cffText) + let yaml = jsyaml.load(cffText); if (!item.versionNumber && yaml.version) { item.versionNumber = yaml.version; } @@ -333,39 +333,8 @@ function completeWithAPI(item, owner, githubRepository) { }); } -function parseYAML(yamlText) { - const lines = yamlText.split('\n'); - const result = {}; - - for (let line of lines) { - // Trim whitespace and ignore empty lines or comments - line = line.trim(); - if (!line || line.startsWith('#')) { - continue; - } - - // Split key and value at the first colon - const [key, ...valueParts] = line.split(':'); - const value = valueParts.join(':').trim(); - - // Handle different value types - if (value.startsWith('"') && value.endsWith('"')) { - // Quoted string - result[key.trim()] = value.slice(1, -1); - } else if (value === 'true' || value === 'false') { - // Boolean - result[key.trim()] = value === 'true'; - } else if (!isNaN(value)) { - // Number - result[key.trim()] = parseFloat(value); - } else { - // Unquoted string - result[key.trim()] = value; - } - } - - return result; -} +/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).jsyaml={})}(this,(function(e){"use strict";function t(e){return null==e}var n={isNothing:t,isObject:function(e){return"object"==typeof e&&null!==e},toArray:function(e){return Array.isArray(e)?e:t(e)?[]:[e]},repeat:function(e,t){var n,i="";for(n=0;nl&&(t=i-l+(o=" ... ").length),n-i>l&&(n=i+l-(a=" ...").length),{str:o+e.slice(t,n).replace(/\t/g,"→")+a,pos:i-t+o.length}}function l(e,t){return n.repeat(" ",t-e.length)+e}var c=function(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),"number"!=typeof t.indent&&(t.indent=1),"number"!=typeof t.linesBefore&&(t.linesBefore=3),"number"!=typeof t.linesAfter&&(t.linesAfter=2);for(var i,r=/\r?\n|\r|\0/g,o=[0],c=[],s=-1;i=r.exec(e.buffer);)c.push(i.index),o.push(i.index+i[0].length),e.position<=i.index&&s<0&&(s=o.length-2);s<0&&(s=o.length-1);var u,p,f="",d=Math.min(e.line+t.linesAfter,c.length).toString().length,h=t.maxLength-(t.indent+d+3);for(u=1;u<=t.linesBefore&&!(s-u<0);u++)p=a(e.buffer,o[s-u],c[s-u],e.position-(o[s]-o[s-u]),h),f=n.repeat(" ",t.indent)+l((e.line-u+1).toString(),d)+" | "+p.str+"\n"+f;for(p=a(e.buffer,o[s],c[s],e.position,h),f+=n.repeat(" ",t.indent)+l((e.line+1).toString(),d)+" | "+p.str+"\n",f+=n.repeat("-",t.indent+d+3+p.pos)+"^\n",u=1;u<=t.linesAfter&&!(s+u>=c.length);u++)p=a(e.buffer,o[s+u],c[s+u],e.position-(o[s]-o[s+u]),h),f+=n.repeat(" ",t.indent)+l((e.line+u+1).toString(),d)+" | "+p.str+"\n";return f.replace(/\n$/,"")},s=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],u=["scalar","sequence","mapping"];var p=function(e,t){if(t=t||{},Object.keys(t).forEach((function(t){if(-1===s.indexOf(t))throw new o('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')})),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=function(e){var t={};return null!==e&&Object.keys(e).forEach((function(n){e[n].forEach((function(e){t[String(e)]=n}))})),t}(t.styleAliases||null),-1===u.indexOf(this.kind))throw new o('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')};function f(e,t){var n=[];return e[t].forEach((function(e){var t=n.length;n.forEach((function(n,i){n.tag===e.tag&&n.kind===e.kind&&n.multi===e.multi&&(t=i)})),n[t]=e})),n}function d(e){return this.extend(e)}d.prototype.extend=function(e){var t=[],n=[];if(e instanceof p)n.push(e);else if(Array.isArray(e))n=n.concat(e);else{if(!e||!Array.isArray(e.implicit)&&!Array.isArray(e.explicit))throw new o("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");e.implicit&&(t=t.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit))}t.forEach((function(e){if(!(e instanceof p))throw new o("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(e.loadKind&&"scalar"!==e.loadKind)throw new o("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(e.multi)throw new o("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")})),n.forEach((function(e){if(!(e instanceof p))throw new o("Specified list of YAML types (or a single Type object) contains a non-Type object.")}));var i=Object.create(d.prototype);return i.implicit=(this.implicit||[]).concat(t),i.explicit=(this.explicit||[]).concat(n),i.compiledImplicit=f(i,"implicit"),i.compiledExplicit=f(i,"explicit"),i.compiledTypeMap=function(){var e,t,n={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function i(e){e.multi?(n.multi[e.kind].push(e),n.multi.fallback.push(e)):n[e.kind][e.tag]=n.fallback[e.tag]=e}for(e=0,t=arguments.length;e=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),x=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var I=/^[-+]?[0-9]+e/;var S=new p("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!x.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n;return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:n*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||n.isNegativeZero(e))},represent:function(e,t){var i;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(n.isNegativeZero(e))return"-0.0";return i=e.toString(10),I.test(i)?i.replace("e",".e"):i},defaultStyle:"lowercase"}),O=b.extend({implicit:[A,v,C,S]}),j=O,T=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),N=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");var F=new p("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==T.exec(e)||null!==N.exec(e))},construct:function(e){var t,n,i,r,o,a,l,c,s=0,u=null;if(null===(t=T.exec(e))&&(t=N.exec(e)),null===t)throw new Error("Date resolve error");if(n=+t[1],i=+t[2]-1,r=+t[3],!t[4])return new Date(Date.UTC(n,i,r));if(o=+t[4],a=+t[5],l=+t[6],t[7]){for(s=t[7].slice(0,3);s.length<3;)s+="0";s=+s}return t[9]&&(u=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(u=-u)),c=new Date(Date.UTC(n,i,r,o,a,l,s)),u&&c.setTime(c.getTime()-u),c},instanceOf:Date,represent:function(e){return e.toISOString()}});var E=new p("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}}),M="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";var L=new p("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,i=0,r=e.length,o=M;for(n=0;n64)){if(t<0)return!1;i+=6}return i%8==0},construct:function(e){var t,n,i=e.replace(/[\r\n=]/g,""),r=i.length,o=M,a=0,l=[];for(t=0;t>16&255),l.push(a>>8&255),l.push(255&a)),a=a<<6|o.indexOf(i.charAt(t));return 0===(n=r%4*6)?(l.push(a>>16&255),l.push(a>>8&255),l.push(255&a)):18===n?(l.push(a>>10&255),l.push(a>>2&255)):12===n&&l.push(a>>4&255),new Uint8Array(l)},predicate:function(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)},represent:function(e){var t,n,i="",r=0,o=e.length,a=M;for(t=0;t>18&63],i+=a[r>>12&63],i+=a[r>>6&63],i+=a[63&r]),r=(r<<8)+e[t];return 0===(n=o%3)?(i+=a[r>>18&63],i+=a[r>>12&63],i+=a[r>>6&63],i+=a[63&r]):2===n?(i+=a[r>>10&63],i+=a[r>>4&63],i+=a[r<<2&63],i+=a[64]):1===n&&(i+=a[r>>2&63],i+=a[r<<4&63],i+=a[64],i+=a[64]),i}}),_=Object.prototype.hasOwnProperty,D=Object.prototype.toString;var U=new p("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,i,r,o,a=[],l=e;for(t=0,n=l.length;t>10),56320+(e-65536&1023))}for(var ie=new Array(256),re=new Array(256),oe=0;oe<256;oe++)ie[oe]=te(oe)?1:0,re[oe]=te(oe);function ae(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||K,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function le(e,t){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=c(n),new o(t,n)}function ce(e,t){throw le(e,t)}function se(e,t){e.onWarning&&e.onWarning.call(null,le(e,t))}var ue={YAML:function(e,t,n){var i,r,o;null!==e.version&&ce(e,"duplication of %YAML directive"),1!==n.length&&ce(e,"YAML directive accepts exactly one argument"),null===(i=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&ce(e,"ill-formed argument of the YAML directive"),r=parseInt(i[1],10),o=parseInt(i[2],10),1!==r&&ce(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=o<2,1!==o&&2!==o&&se(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var i,r;2!==n.length&&ce(e,"TAG directive accepts exactly two arguments"),i=n[0],r=n[1],G.test(i)||ce(e,"ill-formed tag handle (first argument) of the TAG directive"),P.call(e.tagMap,i)&&ce(e,'there is a previously declared suffix for "'+i+'" tag handle'),V.test(r)||ce(e,"ill-formed tag prefix (second argument) of the TAG directive");try{r=decodeURIComponent(r)}catch(t){ce(e,"tag prefix is malformed: "+r)}e.tagMap[i]=r}};function pe(e,t,n,i){var r,o,a,l;if(t1&&(e.result+=n.repeat("\n",t-1))}function be(e,t){var n,i,r=e.tag,o=e.anchor,a=[],l=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=a),i=e.input.charCodeAt(e.position);0!==i&&(-1!==e.firstTabInLine&&(e.position=e.firstTabInLine,ce(e,"tab characters must not be used in indentation")),45===i)&&z(e.input.charCodeAt(e.position+1));)if(l=!0,e.position++,ge(e,!0,-1)&&e.lineIndent<=t)a.push(null),i=e.input.charCodeAt(e.position);else if(n=e.line,we(e,t,3,!1,!0),a.push(e.result),ge(e,!0,-1),i=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==i)ce(e,"bad indentation of a sequence entry");else if(e.lineIndentt?g=1:e.lineIndent===t?g=0:e.lineIndentt?g=1:e.lineIndent===t?g=0:e.lineIndentt)&&(y&&(a=e.line,l=e.lineStart,c=e.position),we(e,t,4,!0,r)&&(y?g=e.result:m=e.result),y||(de(e,f,d,h,g,m,a,l,c),h=g=m=null),ge(e,!0,-1),s=e.input.charCodeAt(e.position)),(e.line===o||e.lineIndent>t)&&0!==s)ce(e,"bad indentation of a mapping entry");else if(e.lineIndent=0))break;0===o?ce(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):u?ce(e,"repeat of an indentation width identifier"):(p=t+o-1,u=!0)}if(Q(a)){do{a=e.input.charCodeAt(++e.position)}while(Q(a));if(35===a)do{a=e.input.charCodeAt(++e.position)}while(!J(a)&&0!==a)}for(;0!==a;){for(he(e),e.lineIndent=0,a=e.input.charCodeAt(e.position);(!u||e.lineIndentp&&(p=e.lineIndent),J(a))f++;else{if(e.lineIndent0){for(r=a,o=0;r>0;r--)(a=ee(l=e.input.charCodeAt(++e.position)))>=0?o=(o<<4)+a:ce(e,"expected hexadecimal character");e.result+=ne(o),e.position++}else ce(e,"unknown escape sequence");n=i=e.position}else J(l)?(pe(e,n,i,!0),ye(e,ge(e,!1,t)),n=i=e.position):e.position===e.lineStart&&me(e)?ce(e,"unexpected end of the document within a double quoted scalar"):(e.position++,i=e.position)}ce(e,"unexpected end of the stream within a double quoted scalar")}(e,d)?y=!0:!function(e){var t,n,i;if(42!==(i=e.input.charCodeAt(e.position)))return!1;for(i=e.input.charCodeAt(++e.position),t=e.position;0!==i&&!z(i)&&!X(i);)i=e.input.charCodeAt(++e.position);return e.position===t&&ce(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),P.call(e.anchorMap,n)||ce(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],ge(e,!0,-1),!0}(e)?function(e,t,n){var i,r,o,a,l,c,s,u,p=e.kind,f=e.result;if(z(u=e.input.charCodeAt(e.position))||X(u)||35===u||38===u||42===u||33===u||124===u||62===u||39===u||34===u||37===u||64===u||96===u)return!1;if((63===u||45===u)&&(z(i=e.input.charCodeAt(e.position+1))||n&&X(i)))return!1;for(e.kind="scalar",e.result="",r=o=e.position,a=!1;0!==u;){if(58===u){if(z(i=e.input.charCodeAt(e.position+1))||n&&X(i))break}else if(35===u){if(z(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&me(e)||n&&X(u))break;if(J(u)){if(l=e.line,c=e.lineStart,s=e.lineIndent,ge(e,!1,-1),e.lineIndent>=t){a=!0,u=e.input.charCodeAt(e.position);continue}e.position=o,e.line=l,e.lineStart=c,e.lineIndent=s;break}}a&&(pe(e,r,o,!1),ye(e,e.line-l),r=o=e.position,a=!1),Q(u)||(o=e.position+1),u=e.input.charCodeAt(++e.position)}return pe(e,r,o,!1),!!e.result||(e.kind=p,e.result=f,!1)}(e,d,1===i)&&(y=!0,null===e.tag&&(e.tag="?")):(y=!0,null===e.tag&&null===e.anchor||ce(e,"alias node should not have any properties")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===g&&(y=c&&be(e,h))),null===e.tag)null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);else if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&ce(e,'unacceptable node kind for ! tag; it should be "scalar", not "'+e.kind+'"'),s=0,u=e.implicitTypes.length;s"),null!==e.result&&f.kind!==e.kind&&ce(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+f.kind+'", not "'+e.kind+'"'),f.resolve(e.result,e.tag)?(e.result=f.construct(e.result,e.tag),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):ce(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||y}function ke(e){var t,n,i,r,o=e.position,a=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);0!==(r=e.input.charCodeAt(e.position))&&(ge(e,!0,-1),r=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==r));){for(a=!0,r=e.input.charCodeAt(++e.position),t=e.position;0!==r&&!z(r);)r=e.input.charCodeAt(++e.position);for(i=[],(n=e.input.slice(t,e.position)).length<1&&ce(e,"directive name must not be less than one character in length");0!==r;){for(;Q(r);)r=e.input.charCodeAt(++e.position);if(35===r){do{r=e.input.charCodeAt(++e.position)}while(0!==r&&!J(r));break}if(J(r))break;for(t=e.position;0!==r&&!z(r);)r=e.input.charCodeAt(++e.position);i.push(e.input.slice(t,e.position))}0!==r&&he(e),P.call(ue,n)?ue[n](e,n,i):se(e,'unknown document directive "'+n+'"')}ge(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,ge(e,!0,-1)):a&&ce(e,"directives end mark is expected"),we(e,e.lineIndent-1,4,!1,!0),ge(e,!0,-1),e.checkLineBreaks&&H.test(e.input.slice(o,e.position))&&se(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&me(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,ge(e,!0,-1)):e.position=55296&&i<=56319&&t+1=56320&&n<=57343?1024*(i-55296)+n-56320+65536:i}function Re(e){return/^\n* /.test(e)}function Be(e,t,n,i,r,o,a,l){var c,s,u=0,p=null,f=!1,d=!1,h=-1!==i,g=-1,m=De(s=Ye(e,0))&&s!==Oe&&!_e(s)&&45!==s&&63!==s&&58!==s&&44!==s&&91!==s&&93!==s&&123!==s&&125!==s&&35!==s&&38!==s&&42!==s&&33!==s&&124!==s&&61!==s&&62!==s&&39!==s&&34!==s&&37!==s&&64!==s&&96!==s&&function(e){return!_e(e)&&58!==e}(Ye(e,e.length-1));if(t||a)for(c=0;c=65536?c+=2:c++){if(!De(u=Ye(e,c)))return 5;m=m&&qe(u,p,l),p=u}else{for(c=0;c=65536?c+=2:c++){if(10===(u=Ye(e,c)))f=!0,h&&(d=d||c-g-1>i&&" "!==e[g+1],g=c);else if(!De(u))return 5;m=m&&qe(u,p,l),p=u}d=d||h&&c-g-1>i&&" "!==e[g+1]}return f||d?n>9&&Re(e)?5:a?2===o?5:2:d?4:3:!m||a||r(e)?2===o?5:2:1}function Ke(e,t,n,i,r){e.dump=function(){if(0===t.length)return 2===e.quotingType?'""':"''";if(!e.noCompatMode&&(-1!==Te.indexOf(t)||Ne.test(t)))return 2===e.quotingType?'"'+t+'"':"'"+t+"'";var a=e.indent*Math.max(1,n),l=-1===e.lineWidth?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-a),c=i||e.flowLevel>-1&&n>=e.flowLevel;switch(Be(t,c,e.indent,l,(function(t){return function(e,t){var n,i;for(n=0,i=e.implicitTypes.length;n"+Pe(t,e.indent)+We(Me(function(e,t){var n,i,r=/(\n+)([^\n]*)/g,o=(l=e.indexOf("\n"),l=-1!==l?l:e.length,r.lastIndex=l,He(e.slice(0,l),t)),a="\n"===e[0]||" "===e[0];var l;for(;i=r.exec(e);){var c=i[1],s=i[2];n=" "===s[0],o+=c+(a||n||""===s?"":"\n")+He(s,t),a=n}return o}(t,l),a));case 5:return'"'+function(e){for(var t,n="",i=0,r=0;r=65536?r+=2:r++)i=Ye(e,r),!(t=je[i])&&De(i)?(n+=e[r],i>=65536&&(n+=e[r+1])):n+=t||Fe(i);return n}(t)+'"';default:throw new o("impossible error: invalid scalar style")}}()}function Pe(e,t){var n=Re(e)?String(t):"",i="\n"===e[e.length-1];return n+(i&&("\n"===e[e.length-2]||"\n"===e)?"+":i?"":"-")+"\n"}function We(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function He(e,t){if(""===e||" "===e[0])return e;for(var n,i,r=/ [^ ]/g,o=0,a=0,l=0,c="";n=r.exec(e);)(l=n.index)-o>t&&(i=a>o?a:l,c+="\n"+e.slice(o,i),o=i+1),a=l;return c+="\n",e.length-o>t&&a>o?c+=e.slice(o,a)+"\n"+e.slice(a+1):c+=e.slice(o),c.slice(1)}function $e(e,t,n,i){var r,o,a,l="",c=e.tag;for(r=0,o=n.length;r tag resolver accepts not "'+s+'" style');i=c.represent[s](t,s)}e.dump=i}return!0}return!1}function Ve(e,t,n,i,r,a,l){e.tag=null,e.dump=n,Ge(e,n,!1)||Ge(e,n,!0);var c,s=Ie.call(e.dump),u=i;i&&(i=e.flowLevel<0||e.flowLevel>t);var p,f,d="[object Object]"===s||"[object Array]"===s;if(d&&(f=-1!==(p=e.duplicates.indexOf(n))),(null!==e.tag&&"?"!==e.tag||f||2!==e.indent&&t>0)&&(r=!1),f&&e.usedDuplicates[p])e.dump="*ref_"+p;else{if(d&&f&&!e.usedDuplicates[p]&&(e.usedDuplicates[p]=!0),"[object Object]"===s)i&&0!==Object.keys(e.dump).length?(!function(e,t,n,i){var r,a,l,c,s,u,p="",f=e.tag,d=Object.keys(n);if(!0===e.sortKeys)d.sort();else if("function"==typeof e.sortKeys)d.sort(e.sortKeys);else if(e.sortKeys)throw new o("sortKeys must be a boolean or a function");for(r=0,a=d.length;r1024)&&(e.dump&&10===e.dump.charCodeAt(0)?u+="?":u+="? "),u+=e.dump,s&&(u+=Le(e,t)),Ve(e,t+1,c,!0,s)&&(e.dump&&10===e.dump.charCodeAt(0)?u+=":":u+=": ",p+=u+=e.dump));e.tag=f,e.dump=p||"{}"}(e,t,e.dump,r),f&&(e.dump="&ref_"+p+e.dump)):(!function(e,t,n){var i,r,o,a,l,c="",s=e.tag,u=Object.keys(n);for(i=0,r=u.length;i1024&&(l+="? "),l+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),Ve(e,t,a,!1,!1)&&(c+=l+=e.dump));e.tag=s,e.dump="{"+c+"}"}(e,t,e.dump),f&&(e.dump="&ref_"+p+" "+e.dump));else if("[object Array]"===s)i&&0!==e.dump.length?(e.noArrayIndent&&!l&&t>0?$e(e,t-1,e.dump,r):$e(e,t,e.dump,r),f&&(e.dump="&ref_"+p+e.dump)):(!function(e,t,n){var i,r,o,a="",l=e.tag;for(i=0,r=n.length;i",e.dump=c+" "+e.dump)}return!0}function Ze(e,t){var n,i,r=[],o=[];for(Je(e,r,o),n=0,i=o.length;n Date: Sun, 5 Jan 2025 05:14:35 +0800 Subject: [PATCH 16/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2005=E6=99=8214?= =?UTF-8?q?=E5=88=8635=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 51 ++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 42 insertions(+), 9 deletions(-) diff --git a/GitHub.js b/GitHub.js index c20d3788957..3b1d7cd64c1 100644 --- a/GitHub.js +++ b/GitHub.js @@ -606,7 +606,7 @@ var testCases = [ } ], "date": "2021-08", - "abstractNote": "The Citation File Format lets you provide citation metadata for software or datasets in plaintext files that are easy to read by both humans and machines.", + "abstractNote": "CITATION.cff files are plain text files with human- and machine-readable citation information for software. Code developers can include them in their repositories to let others know how to correctly cite their software. This is the specification for the Citation File Format.", "extra": "DOI: 10.5281/zenodo.5171937", "libraryCatalog": "GitHub", "programmingLanguage": "Python", @@ -617,11 +617,15 @@ var testCases = [ "attachments": [], "tags": [ { - "tag": "attribution" + "tag": "CFF" }, { - "tag": "citation" + "tag": "YAML" }, + { + "tag": "citation file format" + }, + { "tag": "citation-files" }, @@ -629,16 +633,16 @@ var testCases = [ "tag": "credit" }, { - "tag": "format" + "tag": "file format" }, { - "tag": "research-software-engineering" + "tag": "research software" }, { - "tag": "software-sustainability" + "tag": "software citation" }, { - "tag": "wssspe" + "tag": "software-sustainability" } ], "notes": [], @@ -701,7 +705,7 @@ var testCases = [ } ], "date": "2021-08", - "abstractNote": "The Citation File Format lets you provide citation metadata for software or datasets in plaintext files that are easy to read by both humans and machines.", + "abstractNote": "CITATION.cff files are plain text files with human- and machine-readable citation information for software. Code developers can include them in their repositories to let others know how to correctly cite their software. This is the specification for the Citation File Format.", "extra": "DOI: 10.5281/zenodo.5171937", "libraryCatalog": "GitHub", "programmingLanguage": "Python", @@ -710,7 +714,36 @@ var testCases = [ "versionNumber": "1.1.0", "place": "GitHub", "attachments": [], - "tags": [], + "tags": [ + { + "tag": "CFF" + }, + { + "tag": "YAML" + }, + { + "tag": "citation file format" + }, + + { + "tag": "citation-files" + }, + { + "tag": "credit" + }, + { + "tag": "file format" + }, + { + "tag": "research software" + }, + { + "tag": "software citation" + }, + { + "tag": "software-sustainability" + } + ], "notes": [], "seeAlso": [] } From 5486b46264466b899f3c1b3dff812bcb75b4b3ef Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 05:22:47 +0800 Subject: [PATCH 17/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2005=E6=99=8222?= =?UTF-8?q?=E5=88=8647=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/GitHub.js b/GitHub.js index 3b1d7cd64c1..8838b6f2aec 100644 --- a/GitHub.js +++ b/GitHub.js @@ -143,6 +143,9 @@ function scrape(doc, url) { if (!latestCommitLink) { latestCommitLink = attr(doc, '[data-testid="latest-commit-html"] a', 'href'); } + if (!latestCommitLink) { + latestCommitLink = attr(doc, '[data-testid="breadcrumbs-repo-link"]', 'href'); + } let commitHash = false; if (latestCommitLink.includes('/')) { commitHash = latestCommitLink.split('/').pop(); @@ -241,6 +244,7 @@ function completeWithBibTeX(item, bibtex, githubRepository, owner) { let tags = [...item.tags]; let title = item.title; let versionNumber = item.versionNumber; + let version = item.version; let url = item.url; Object.assign(item, bibItem); @@ -251,7 +255,7 @@ function completeWithBibTeX(item, bibtex, githubRepository, owner) { if (url.includes('/blob/')) { item.title = title; item.versionNumber = versionNumber; - item.version = versionNumber; + item.version = version; item.url = url; } @@ -627,7 +631,7 @@ var testCases = [ }, { - "tag": "citation-files" + "tag": "citation files" }, { "tag": "credit" @@ -642,7 +646,7 @@ var testCases = [ "tag": "software citation" }, { - "tag": "software-sustainability" + "tag": "software sustainability" } ], "notes": [], @@ -726,7 +730,7 @@ var testCases = [ }, { - "tag": "citation-files" + "tag": "citation files" }, { "tag": "credit" @@ -741,7 +745,7 @@ var testCases = [ "tag": "software citation" }, { - "tag": "software-sustainability" + "tag": "software sustainability" } ], "notes": [], From c89515b1828c5429af69551b362b4216b1ba6e72 Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 05:43:23 +0800 Subject: [PATCH 18/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2005=E6=99=8243?= =?UTF-8?q?=E5=88=8623=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/GitHub.js b/GitHub.js index 8838b6f2aec..2afb696a6e5 100644 --- a/GitHub.js +++ b/GitHub.js @@ -13,7 +13,7 @@ } /** - Copyright (c) 2017-2021 Martin Fenner, Philipp Zumstein + Copyright (c) 2017-2025 Martin Fenner, Philipp Zumstein, Yung-Ting Chen This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License @@ -140,9 +140,6 @@ function scrape(doc, url) { } let latestCommitLink = attr(doc, 'link[rel="canonical"]', 'href'); - if (!latestCommitLink) { - latestCommitLink = attr(doc, '[data-testid="latest-commit-html"] a', 'href'); - } if (!latestCommitLink) { latestCommitLink = attr(doc, '[data-testid="breadcrumbs-repo-link"]', 'href'); } @@ -176,7 +173,6 @@ function scrape(doc, url) { if (canonical) { item.url = canonical; } - ZU.doGet(apiUrl + "repos/" + githubRepository + "/commits/" + commitHash, function (result) { var commitData = JSON.parse(result); const commitTime = commitData.commit.author.date; // ISO 8601 format @@ -539,7 +535,7 @@ var testCases = [ "fieldMode": 1 } ], - "date": "2021-07-29T04:53:43Z", + "date": "2021-07-28T21:54:41Z", "versionNumber": "eb4f39007e62d3d632448e184b1fd3671b3a1349", "abstractNote": "Zotero Translators", "company": "Zotero", From d1b956de2276b3100a5f12b03288d16d0105df1f Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 05:47:45 +0800 Subject: [PATCH 19/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2005=E6=99=8247?= =?UTF-8?q?=E5=88=8645=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/GitHub.js b/GitHub.js index 2afb696a6e5..92a6d6495d1 100644 --- a/GitHub.js +++ b/GitHub.js @@ -35,9 +35,10 @@ const apiUrl = "https://api.github.com/"; function detectWeb(doc, url) { if (url.includes("/search?")) { - if (getSearchResults(doc, true)) { - return "multiple"; - } + return "multiple"; +// if (getSearchResults(doc, true)) { +// return "multiple"; +// } } if (!doc.querySelector('meta[property="og:type"][content="object"]')) { @@ -277,7 +278,7 @@ function completeWithBibTeX(item, bibtex, githubRepository, owner) { item.place = yaml.place; } - if (yaml.keywords.length > 0) { + if (yaml.keywords && yaml.keywords.length > 0) { item.tags = []; item.tags = item.tags.concat(yaml.keywords); item.tags = [...new Set(item.tags)]; @@ -418,7 +419,7 @@ var testCases = [ "fieldMode": 1 } ], - "date": "2016-08-23T16:42:17Z", + "date": "2024-12-05T18:31:38Z", "abstractNote": "DataCite Metadata Schema Repository", "company": "DataCite", "extra": "original-date: 2011-04-13T07:08:41Z", From 957c897db563c94048bc21fefebe66d46216aa14 Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 05:52:32 +0800 Subject: [PATCH 20/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2005=E6=99=8252?= =?UTF-8?q?=E5=88=8632=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GitHub.js b/GitHub.js index 92a6d6495d1..0f9500407a9 100644 --- a/GitHub.js +++ b/GitHub.js @@ -372,7 +372,7 @@ var testCases = [ }, { "type": "web", - "url": "https://github.com/search?utf8=%E2%9C%93&q=topic%3Ahocr&type=", + "url": "https://github.com/search?utf8=%E2%9C%93&q=topic%3Ahocr&type=repositories", "items": "multiple" }, { @@ -755,7 +755,7 @@ var testCases = [ "url": "https://github.com/pulipulichen/PTS-Local-News-Dataset/tree/20250105-0131", "items": [ { - "itemType": "dataset", + "itemType": "computerProgram", "title": "PTS-Local-News-Dataset", "creators": [ { From dae0d5afdc5bf8104b2887cdb40586af57c9ee78 Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 05:58:46 +0800 Subject: [PATCH 21/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2005=E6=99=8258?= =?UTF-8?q?=E5=88=8646=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/GitHub.js b/GitHub.js index 0f9500407a9..42cd72a7774 100644 --- a/GitHub.js +++ b/GitHub.js @@ -373,6 +373,7 @@ var testCases = [ { "type": "web", "url": "https://github.com/search?utf8=%E2%9C%93&q=topic%3Ahocr&type=repositories", + "defer": true, "items": "multiple" }, { @@ -755,7 +756,7 @@ var testCases = [ "url": "https://github.com/pulipulichen/PTS-Local-News-Dataset/tree/20250105-0131", "items": [ { - "itemType": "computerProgram", + "itemType": "dataset", "title": "PTS-Local-News-Dataset", "creators": [ { @@ -768,6 +769,8 @@ var testCases = [ "abstractNote": "A dataset containing local news from Taiwan Public Television Service.", "extra": "DOI: 10.5281/zenodo.14598063", "libraryCatalog": "GitHub", + "DOI": "10.5281/zenodo.14598063", + "rights": "MIT", "url": "https://github.com/pulipulichen/PTS-Local-News-Dataset", "versionNumber": "20250105-0131", "attachments": [], From 735eb1611cfc32f3b9d72dbe77cd8ffabf4fda56 Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 06:04:39 +0800 Subject: [PATCH 22/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2006=E6=99=8204?= =?UTF-8?q?=E5=88=8639=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GitHub.js b/GitHub.js index 42cd72a7774..14afb770c4e 100644 --- a/GitHub.js +++ b/GitHub.js @@ -145,7 +145,7 @@ function scrape(doc, url) { latestCommitLink = attr(doc, '[data-testid="breadcrumbs-repo-link"]', 'href'); } let commitHash = false; - if (latestCommitLink.includes('/')) { + if (latestCommitLink.includes('/') && latestCommitLink.endsWith(githubRepository) === false) { commitHash = latestCommitLink.split('/').pop(); } From 5dd3fafa19c06d46611b0a1d60da9bf03a6dfd34 Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 06:11:48 +0800 Subject: [PATCH 23/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2006=E6=99=8211?= =?UTF-8?q?=E5=88=8648=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/GitHub.js b/GitHub.js index 14afb770c4e..81d86f2a01b 100644 --- a/GitHub.js +++ b/GitHub.js @@ -33,7 +33,7 @@ const apiUrl = "https://api.github.com/"; -function detectWeb(doc, url) { +async function detectWeb(doc, url) { if (url.includes("/search?")) { return "multiple"; // if (getSearchResults(doc, true)) { @@ -58,7 +58,19 @@ function detectWeb(doc, url) { return false; } - return "computerProgram"; + return new Promise(function (resolve) { + let path = url.split('/').slice(3, 5).join('/'); + ZU.doGet(`https://raw.githubusercontent.com/${path}/HEAD/CITATION.cff`, function (cffText) { + let yaml = jsyaml.load(cffText); + if (yaml.type && yaml.type === 'dataset') { + resolve(yaml.type); + } + else { + resolve("computerProgram"); + } + }); + + }); } @@ -78,8 +90,8 @@ function getSearchResults(doc, checkOnly) { } -function doWeb(doc, url) { - if (detectWeb(doc, url) == "multiple") { +async function doWeb(doc, url) { + if (await detectWeb(doc, url) == "multiple") { Zotero.selectItems(getSearchResults(doc, false), function (items) { if (!items) { return; From 4621ec7cdfddaadcecddf20f8febc5678ca92617 Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 06:22:33 +0800 Subject: [PATCH 24/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2006=E6=99=8222?= =?UTF-8?q?=E5=88=8633=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/GitHub.js b/GitHub.js index 81d86f2a01b..e6897abb19c 100644 --- a/GitHub.js +++ b/GitHub.js @@ -60,16 +60,16 @@ async function detectWeb(doc, url) { return new Promise(function (resolve) { let path = url.split('/').slice(3, 5).join('/'); - ZU.doGet(`https://raw.githubusercontent.com/${path}/HEAD/CITATION.cff`, function (cffText) { + ZU.doGet(`https://raw.githubusercontent.com/${path}/HEAD/CITATION.cff`, function (cffText, xhr) { + if (xhr.status !== 200) { + return resolve("computerProgram"); + } let yaml = jsyaml.load(cffText); if (yaml.type && yaml.type === 'dataset') { - resolve(yaml.type); - } - else { - resolve("computerProgram"); + return resolve(yaml.type); } - }); - + resolve("computerProgram"); + }, null, null, { 'X-Requested-With': 'XMLHttpRequest' }, false); }); } From 6700575634694d1048ff1fe6ace032854974408a Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 06:48:27 +0800 Subject: [PATCH 25/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2006=E6=99=8248?= =?UTF-8?q?=E5=88=8627=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 77 ++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 59 insertions(+), 18 deletions(-) diff --git a/GitHub.js b/GitHub.js index e6897abb19c..93551b35031 100644 --- a/GitHub.js +++ b/GitHub.js @@ -64,9 +64,14 @@ async function detectWeb(doc, url) { if (xhr.status !== 200) { return resolve("computerProgram"); } - let yaml = jsyaml.load(cffText); - if (yaml.type && yaml.type === 'dataset') { - return resolve(yaml.type); + try { + let type = searchFieldValue(cffText, "type") + if (type && type === 'dataset') { + return resolve(type); + } + } + catch (e) { + resolve("computerProgram"); } resolve("computerProgram"); }, null, null, { 'X-Requested-With': 'XMLHttpRequest' }, false); @@ -269,30 +274,35 @@ function completeWithBibTeX(item, bibtex, githubRepository, owner) { } ZU.doGet(`https://raw.githubusercontent.com/${path}/HEAD/CITATION.cff`, function (cffText) { - let yaml = jsyaml.load(cffText); - if (!item.versionNumber && yaml.version) { - item.versionNumber = yaml.version; + let cffVersion = searchFieldValue(cffText, "version"); + if (!item.versionNumber && cffVersion) { + item.versionNumber = cffVersion; } - if (yaml.type && yaml.type === 'dataset') { - item.itemType = yaml.type; + let cffType = searchFieldValue(cffText, "type"); + if (cffType && cffType === 'dataset') { + item.itemType = cffType; } - if (yaml.abstract) { - item.abstractNote = yaml.abstract; + let cffAbstract = searchFieldValue(cffText, "abstract"); + if (cffAbstract) { + item.abstractNote = cffAbstract; } - if (yaml.url && item.url.includes('/blob/') === false) { - item.url = yaml.url; + let cffURL = searchFieldValue(cffText, "url"); + if (cffURL && item.url.includes('/blob/') === false) { + item.url = cffURL; } - if (yaml.repository) { - item.place = yaml.place; + let cffRepository = searchFieldValue(cffText, "repository"); + if (cffRepository) { + item.place = cffRepository; } - if (yaml.keywords && yaml.keywords.length > 0) { + let cffKeywords = extractKeywords(cffText) + if (cffKeywords && cffKeywords.length > 0) { item.tags = []; - item.tags = item.tags.concat(yaml.keywords); + item.tags = item.tags.concat(cffKeywords); item.tags = [...new Set(item.tags)]; } @@ -346,8 +356,39 @@ function completeWithAPI(item, owner, githubRepository) { }); } -/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).jsyaml={})}(this,(function(e){"use strict";function t(e){return null==e}var n={isNothing:t,isObject:function(e){return"object"==typeof e&&null!==e},toArray:function(e){return Array.isArray(e)?e:t(e)?[]:[e]},repeat:function(e,t){var n,i="";for(n=0;nl&&(t=i-l+(o=" ... ").length),n-i>l&&(n=i+l-(a=" ...").length),{str:o+e.slice(t,n).replace(/\t/g,"→")+a,pos:i-t+o.length}}function l(e,t){return n.repeat(" ",t-e.length)+e}var c=function(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),"number"!=typeof t.indent&&(t.indent=1),"number"!=typeof t.linesBefore&&(t.linesBefore=3),"number"!=typeof t.linesAfter&&(t.linesAfter=2);for(var i,r=/\r?\n|\r|\0/g,o=[0],c=[],s=-1;i=r.exec(e.buffer);)c.push(i.index),o.push(i.index+i[0].length),e.position<=i.index&&s<0&&(s=o.length-2);s<0&&(s=o.length-1);var u,p,f="",d=Math.min(e.line+t.linesAfter,c.length).toString().length,h=t.maxLength-(t.indent+d+3);for(u=1;u<=t.linesBefore&&!(s-u<0);u++)p=a(e.buffer,o[s-u],c[s-u],e.position-(o[s]-o[s-u]),h),f=n.repeat(" ",t.indent)+l((e.line-u+1).toString(),d)+" | "+p.str+"\n"+f;for(p=a(e.buffer,o[s],c[s],e.position,h),f+=n.repeat(" ",t.indent)+l((e.line+1).toString(),d)+" | "+p.str+"\n",f+=n.repeat("-",t.indent+d+3+p.pos)+"^\n",u=1;u<=t.linesAfter&&!(s+u>=c.length);u++)p=a(e.buffer,o[s+u],c[s+u],e.position-(o[s]-o[s+u]),h),f+=n.repeat(" ",t.indent)+l((e.line+u+1).toString(),d)+" | "+p.str+"\n";return f.replace(/\n$/,"")},s=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],u=["scalar","sequence","mapping"];var p=function(e,t){if(t=t||{},Object.keys(t).forEach((function(t){if(-1===s.indexOf(t))throw new o('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')})),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=function(e){var t={};return null!==e&&Object.keys(e).forEach((function(n){e[n].forEach((function(e){t[String(e)]=n}))})),t}(t.styleAliases||null),-1===u.indexOf(this.kind))throw new o('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')};function f(e,t){var n=[];return e[t].forEach((function(e){var t=n.length;n.forEach((function(n,i){n.tag===e.tag&&n.kind===e.kind&&n.multi===e.multi&&(t=i)})),n[t]=e})),n}function d(e){return this.extend(e)}d.prototype.extend=function(e){var t=[],n=[];if(e instanceof p)n.push(e);else if(Array.isArray(e))n=n.concat(e);else{if(!e||!Array.isArray(e.implicit)&&!Array.isArray(e.explicit))throw new o("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");e.implicit&&(t=t.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit))}t.forEach((function(e){if(!(e instanceof p))throw new o("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(e.loadKind&&"scalar"!==e.loadKind)throw new o("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(e.multi)throw new o("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")})),n.forEach((function(e){if(!(e instanceof p))throw new o("Specified list of YAML types (or a single Type object) contains a non-Type object.")}));var i=Object.create(d.prototype);return i.implicit=(this.implicit||[]).concat(t),i.explicit=(this.explicit||[]).concat(n),i.compiledImplicit=f(i,"implicit"),i.compiledExplicit=f(i,"explicit"),i.compiledTypeMap=function(){var e,t,n={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function i(e){e.multi?(n.multi[e.kind].push(e),n.multi.fallback.push(e)):n[e.kind][e.tag]=n.fallback[e.tag]=e}for(e=0,t=arguments.length;e=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),x=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var I=/^[-+]?[0-9]+e/;var S=new p("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!x.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n;return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:n*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||n.isNegativeZero(e))},represent:function(e,t){var i;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(n.isNegativeZero(e))return"-0.0";return i=e.toString(10),I.test(i)?i.replace("e",".e"):i},defaultStyle:"lowercase"}),O=b.extend({implicit:[A,v,C,S]}),j=O,T=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),N=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");var F=new p("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==T.exec(e)||null!==N.exec(e))},construct:function(e){var t,n,i,r,o,a,l,c,s=0,u=null;if(null===(t=T.exec(e))&&(t=N.exec(e)),null===t)throw new Error("Date resolve error");if(n=+t[1],i=+t[2]-1,r=+t[3],!t[4])return new Date(Date.UTC(n,i,r));if(o=+t[4],a=+t[5],l=+t[6],t[7]){for(s=t[7].slice(0,3);s.length<3;)s+="0";s=+s}return t[9]&&(u=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(u=-u)),c=new Date(Date.UTC(n,i,r,o,a,l,s)),u&&c.setTime(c.getTime()-u),c},instanceOf:Date,represent:function(e){return e.toISOString()}});var E=new p("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}}),M="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";var L=new p("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,i=0,r=e.length,o=M;for(n=0;n64)){if(t<0)return!1;i+=6}return i%8==0},construct:function(e){var t,n,i=e.replace(/[\r\n=]/g,""),r=i.length,o=M,a=0,l=[];for(t=0;t>16&255),l.push(a>>8&255),l.push(255&a)),a=a<<6|o.indexOf(i.charAt(t));return 0===(n=r%4*6)?(l.push(a>>16&255),l.push(a>>8&255),l.push(255&a)):18===n?(l.push(a>>10&255),l.push(a>>2&255)):12===n&&l.push(a>>4&255),new Uint8Array(l)},predicate:function(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)},represent:function(e){var t,n,i="",r=0,o=e.length,a=M;for(t=0;t>18&63],i+=a[r>>12&63],i+=a[r>>6&63],i+=a[63&r]),r=(r<<8)+e[t];return 0===(n=o%3)?(i+=a[r>>18&63],i+=a[r>>12&63],i+=a[r>>6&63],i+=a[63&r]):2===n?(i+=a[r>>10&63],i+=a[r>>4&63],i+=a[r<<2&63],i+=a[64]):1===n&&(i+=a[r>>2&63],i+=a[r<<4&63],i+=a[64],i+=a[64]),i}}),_=Object.prototype.hasOwnProperty,D=Object.prototype.toString;var U=new p("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,i,r,o,a=[],l=e;for(t=0,n=l.length;t>10),56320+(e-65536&1023))}for(var ie=new Array(256),re=new Array(256),oe=0;oe<256;oe++)ie[oe]=te(oe)?1:0,re[oe]=te(oe);function ae(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||K,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function le(e,t){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart};return n.snippet=c(n),new o(t,n)}function ce(e,t){throw le(e,t)}function se(e,t){e.onWarning&&e.onWarning.call(null,le(e,t))}var ue={YAML:function(e,t,n){var i,r,o;null!==e.version&&ce(e,"duplication of %YAML directive"),1!==n.length&&ce(e,"YAML directive accepts exactly one argument"),null===(i=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&ce(e,"ill-formed argument of the YAML directive"),r=parseInt(i[1],10),o=parseInt(i[2],10),1!==r&&ce(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=o<2,1!==o&&2!==o&&se(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var i,r;2!==n.length&&ce(e,"TAG directive accepts exactly two arguments"),i=n[0],r=n[1],G.test(i)||ce(e,"ill-formed tag handle (first argument) of the TAG directive"),P.call(e.tagMap,i)&&ce(e,'there is a previously declared suffix for "'+i+'" tag handle'),V.test(r)||ce(e,"ill-formed tag prefix (second argument) of the TAG directive");try{r=decodeURIComponent(r)}catch(t){ce(e,"tag prefix is malformed: "+r)}e.tagMap[i]=r}};function pe(e,t,n,i){var r,o,a,l;if(t1&&(e.result+=n.repeat("\n",t-1))}function be(e,t){var n,i,r=e.tag,o=e.anchor,a=[],l=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=a),i=e.input.charCodeAt(e.position);0!==i&&(-1!==e.firstTabInLine&&(e.position=e.firstTabInLine,ce(e,"tab characters must not be used in indentation")),45===i)&&z(e.input.charCodeAt(e.position+1));)if(l=!0,e.position++,ge(e,!0,-1)&&e.lineIndent<=t)a.push(null),i=e.input.charCodeAt(e.position);else if(n=e.line,we(e,t,3,!1,!0),a.push(e.result),ge(e,!0,-1),i=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==i)ce(e,"bad indentation of a sequence entry");else if(e.lineIndentt?g=1:e.lineIndent===t?g=0:e.lineIndentt?g=1:e.lineIndent===t?g=0:e.lineIndentt)&&(y&&(a=e.line,l=e.lineStart,c=e.position),we(e,t,4,!0,r)&&(y?g=e.result:m=e.result),y||(de(e,f,d,h,g,m,a,l,c),h=g=m=null),ge(e,!0,-1),s=e.input.charCodeAt(e.position)),(e.line===o||e.lineIndent>t)&&0!==s)ce(e,"bad indentation of a mapping entry");else if(e.lineIndent=0))break;0===o?ce(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):u?ce(e,"repeat of an indentation width identifier"):(p=t+o-1,u=!0)}if(Q(a)){do{a=e.input.charCodeAt(++e.position)}while(Q(a));if(35===a)do{a=e.input.charCodeAt(++e.position)}while(!J(a)&&0!==a)}for(;0!==a;){for(he(e),e.lineIndent=0,a=e.input.charCodeAt(e.position);(!u||e.lineIndentp&&(p=e.lineIndent),J(a))f++;else{if(e.lineIndent0){for(r=a,o=0;r>0;r--)(a=ee(l=e.input.charCodeAt(++e.position)))>=0?o=(o<<4)+a:ce(e,"expected hexadecimal character");e.result+=ne(o),e.position++}else ce(e,"unknown escape sequence");n=i=e.position}else J(l)?(pe(e,n,i,!0),ye(e,ge(e,!1,t)),n=i=e.position):e.position===e.lineStart&&me(e)?ce(e,"unexpected end of the document within a double quoted scalar"):(e.position++,i=e.position)}ce(e,"unexpected end of the stream within a double quoted scalar")}(e,d)?y=!0:!function(e){var t,n,i;if(42!==(i=e.input.charCodeAt(e.position)))return!1;for(i=e.input.charCodeAt(++e.position),t=e.position;0!==i&&!z(i)&&!X(i);)i=e.input.charCodeAt(++e.position);return e.position===t&&ce(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),P.call(e.anchorMap,n)||ce(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],ge(e,!0,-1),!0}(e)?function(e,t,n){var i,r,o,a,l,c,s,u,p=e.kind,f=e.result;if(z(u=e.input.charCodeAt(e.position))||X(u)||35===u||38===u||42===u||33===u||124===u||62===u||39===u||34===u||37===u||64===u||96===u)return!1;if((63===u||45===u)&&(z(i=e.input.charCodeAt(e.position+1))||n&&X(i)))return!1;for(e.kind="scalar",e.result="",r=o=e.position,a=!1;0!==u;){if(58===u){if(z(i=e.input.charCodeAt(e.position+1))||n&&X(i))break}else if(35===u){if(z(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&me(e)||n&&X(u))break;if(J(u)){if(l=e.line,c=e.lineStart,s=e.lineIndent,ge(e,!1,-1),e.lineIndent>=t){a=!0,u=e.input.charCodeAt(e.position);continue}e.position=o,e.line=l,e.lineStart=c,e.lineIndent=s;break}}a&&(pe(e,r,o,!1),ye(e,e.line-l),r=o=e.position,a=!1),Q(u)||(o=e.position+1),u=e.input.charCodeAt(++e.position)}return pe(e,r,o,!1),!!e.result||(e.kind=p,e.result=f,!1)}(e,d,1===i)&&(y=!0,null===e.tag&&(e.tag="?")):(y=!0,null===e.tag&&null===e.anchor||ce(e,"alias node should not have any properties")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===g&&(y=c&&be(e,h))),null===e.tag)null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);else if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&ce(e,'unacceptable node kind for ! tag; it should be "scalar", not "'+e.kind+'"'),s=0,u=e.implicitTypes.length;s"),null!==e.result&&f.kind!==e.kind&&ce(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+f.kind+'", not "'+e.kind+'"'),f.resolve(e.result,e.tag)?(e.result=f.construct(e.result,e.tag),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):ce(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||y}function ke(e){var t,n,i,r,o=e.position,a=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);0!==(r=e.input.charCodeAt(e.position))&&(ge(e,!0,-1),r=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==r));){for(a=!0,r=e.input.charCodeAt(++e.position),t=e.position;0!==r&&!z(r);)r=e.input.charCodeAt(++e.position);for(i=[],(n=e.input.slice(t,e.position)).length<1&&ce(e,"directive name must not be less than one character in length");0!==r;){for(;Q(r);)r=e.input.charCodeAt(++e.position);if(35===r){do{r=e.input.charCodeAt(++e.position)}while(0!==r&&!J(r));break}if(J(r))break;for(t=e.position;0!==r&&!z(r);)r=e.input.charCodeAt(++e.position);i.push(e.input.slice(t,e.position))}0!==r&&he(e),P.call(ue,n)?ue[n](e,n,i):se(e,'unknown document directive "'+n+'"')}ge(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,ge(e,!0,-1)):a&&ce(e,"directives end mark is expected"),we(e,e.lineIndent-1,4,!1,!0),ge(e,!0,-1),e.checkLineBreaks&&H.test(e.input.slice(o,e.position))&&se(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&me(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,ge(e,!0,-1)):e.position=55296&&i<=56319&&t+1=56320&&n<=57343?1024*(i-55296)+n-56320+65536:i}function Re(e){return/^\n* /.test(e)}function Be(e,t,n,i,r,o,a,l){var c,s,u=0,p=null,f=!1,d=!1,h=-1!==i,g=-1,m=De(s=Ye(e,0))&&s!==Oe&&!_e(s)&&45!==s&&63!==s&&58!==s&&44!==s&&91!==s&&93!==s&&123!==s&&125!==s&&35!==s&&38!==s&&42!==s&&33!==s&&124!==s&&61!==s&&62!==s&&39!==s&&34!==s&&37!==s&&64!==s&&96!==s&&function(e){return!_e(e)&&58!==e}(Ye(e,e.length-1));if(t||a)for(c=0;c=65536?c+=2:c++){if(!De(u=Ye(e,c)))return 5;m=m&&qe(u,p,l),p=u}else{for(c=0;c=65536?c+=2:c++){if(10===(u=Ye(e,c)))f=!0,h&&(d=d||c-g-1>i&&" "!==e[g+1],g=c);else if(!De(u))return 5;m=m&&qe(u,p,l),p=u}d=d||h&&c-g-1>i&&" "!==e[g+1]}return f||d?n>9&&Re(e)?5:a?2===o?5:2:d?4:3:!m||a||r(e)?2===o?5:2:1}function Ke(e,t,n,i,r){e.dump=function(){if(0===t.length)return 2===e.quotingType?'""':"''";if(!e.noCompatMode&&(-1!==Te.indexOf(t)||Ne.test(t)))return 2===e.quotingType?'"'+t+'"':"'"+t+"'";var a=e.indent*Math.max(1,n),l=-1===e.lineWidth?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-a),c=i||e.flowLevel>-1&&n>=e.flowLevel;switch(Be(t,c,e.indent,l,(function(t){return function(e,t){var n,i;for(n=0,i=e.implicitTypes.length;n"+Pe(t,e.indent)+We(Me(function(e,t){var n,i,r=/(\n+)([^\n]*)/g,o=(l=e.indexOf("\n"),l=-1!==l?l:e.length,r.lastIndex=l,He(e.slice(0,l),t)),a="\n"===e[0]||" "===e[0];var l;for(;i=r.exec(e);){var c=i[1],s=i[2];n=" "===s[0],o+=c+(a||n||""===s?"":"\n")+He(s,t),a=n}return o}(t,l),a));case 5:return'"'+function(e){for(var t,n="",i=0,r=0;r=65536?r+=2:r++)i=Ye(e,r),!(t=je[i])&&De(i)?(n+=e[r],i>=65536&&(n+=e[r+1])):n+=t||Fe(i);return n}(t)+'"';default:throw new o("impossible error: invalid scalar style")}}()}function Pe(e,t){var n=Re(e)?String(t):"",i="\n"===e[e.length-1];return n+(i&&("\n"===e[e.length-2]||"\n"===e)?"+":i?"":"-")+"\n"}function We(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function He(e,t){if(""===e||" "===e[0])return e;for(var n,i,r=/ [^ ]/g,o=0,a=0,l=0,c="";n=r.exec(e);)(l=n.index)-o>t&&(i=a>o?a:l,c+="\n"+e.slice(o,i),o=i+1),a=l;return c+="\n",e.length-o>t&&a>o?c+=e.slice(o,a)+"\n"+e.slice(a+1):c+=e.slice(o),c.slice(1)}function $e(e,t,n,i){var r,o,a,l="",c=e.tag;for(r=0,o=n.length;r tag resolver accepts not "'+s+'" style');i=c.represent[s](t,s)}e.dump=i}return!0}return!1}function Ve(e,t,n,i,r,a,l){e.tag=null,e.dump=n,Ge(e,n,!1)||Ge(e,n,!0);var c,s=Ie.call(e.dump),u=i;i&&(i=e.flowLevel<0||e.flowLevel>t);var p,f,d="[object Object]"===s||"[object Array]"===s;if(d&&(f=-1!==(p=e.duplicates.indexOf(n))),(null!==e.tag&&"?"!==e.tag||f||2!==e.indent&&t>0)&&(r=!1),f&&e.usedDuplicates[p])e.dump="*ref_"+p;else{if(d&&f&&!e.usedDuplicates[p]&&(e.usedDuplicates[p]=!0),"[object Object]"===s)i&&0!==Object.keys(e.dump).length?(!function(e,t,n,i){var r,a,l,c,s,u,p="",f=e.tag,d=Object.keys(n);if(!0===e.sortKeys)d.sort();else if("function"==typeof e.sortKeys)d.sort(e.sortKeys);else if(e.sortKeys)throw new o("sortKeys must be a boolean or a function");for(r=0,a=d.length;r1024)&&(e.dump&&10===e.dump.charCodeAt(0)?u+="?":u+="? "),u+=e.dump,s&&(u+=Le(e,t)),Ve(e,t+1,c,!0,s)&&(e.dump&&10===e.dump.charCodeAt(0)?u+=":":u+=": ",p+=u+=e.dump));e.tag=f,e.dump=p||"{}"}(e,t,e.dump,r),f&&(e.dump="&ref_"+p+e.dump)):(!function(e,t,n){var i,r,o,a,l,c="",s=e.tag,u=Object.keys(n);for(i=0,r=u.length;i1024&&(l+="? "),l+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),Ve(e,t,a,!1,!1)&&(c+=l+=e.dump));e.tag=s,e.dump="{"+c+"}"}(e,t,e.dump),f&&(e.dump="&ref_"+p+" "+e.dump));else if("[object Array]"===s)i&&0!==e.dump.length?(e.noArrayIndent&&!l&&t>0?$e(e,t-1,e.dump,r):$e(e,t,e.dump,r),f&&(e.dump="&ref_"+p+e.dump)):(!function(e,t,n){var i,r,o,a="",l=e.tag;for(i=0,r=n.length;i",e.dump=c+" "+e.dump)}return!0}function Ze(e,t){var n,i,r=[],o=[];for(Je(e,r,o),n=0,i=o.length;n keyword.trim()) // Remove extra spaces + .filter(keyword => keyword.startsWith('- ')) // Only include list items + .map(keyword => keyword.slice(2)); // Remove the "- " prefix + } + + return null; // Return null if "keywords" not found +} /** BEGIN TEST CASES **/ var testCases = [ From 39d0344423366dd1a2382414a30b2fc6c7c7236a Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 06:54:07 +0800 Subject: [PATCH 26/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2006=E6=99=8254?= =?UTF-8?q?=E5=88=8607=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/GitHub.js b/GitHub.js index 93551b35031..1848eedb656 100644 --- a/GitHub.js +++ b/GitHub.js @@ -35,10 +35,9 @@ const apiUrl = "https://api.github.com/"; async function detectWeb(doc, url) { if (url.includes("/search?")) { - return "multiple"; -// if (getSearchResults(doc, true)) { -// return "multiple"; -// } + if (getSearchResults(doc, true)) { + return "multiple"; + } } if (!doc.querySelector('meta[property="og:type"][content="object"]')) { @@ -65,15 +64,15 @@ async function detectWeb(doc, url) { return resolve("computerProgram"); } try { - let type = searchFieldValue(cffText, "type") + let type = searchFieldValue(cffText, "type"); if (type && type === 'dataset') { return resolve(type); } } catch (e) { - resolve("computerProgram"); + // do nothing } - resolve("computerProgram"); + return resolve("computerProgram"); }, null, null, { 'X-Requested-With': 'XMLHttpRequest' }, false); }); } @@ -299,7 +298,7 @@ function completeWithBibTeX(item, bibtex, githubRepository, owner) { item.place = cffRepository; } - let cffKeywords = extractKeywords(cffText) + let cffKeywords = extractKeywords(cffText); if (cffKeywords && cffKeywords.length > 0) { item.tags = []; item.tags = item.tags.concat(cffKeywords); @@ -364,7 +363,7 @@ function completeWithAPI(item, owner, githubRepository) { * @returns {string|null} - The value of the field if found, or null if not found. */ function searchFieldValue(yamlContent, field) { - const regex = new RegExp(`${field}:\\s*(.+)`); + const regex = new RegExp(`^${field}:\\s*(.+)`, 'm'); const match = yamlContent.match(regex); return match ? match[1].trim() : null; } From b96949e476074ef4a7ab9f8f758ec6248663c0c2 Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 06:58:17 +0800 Subject: [PATCH 27/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2006=E6=99=8258?= =?UTF-8?q?=E5=88=8617=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/GitHub.js b/GitHub.js index 1848eedb656..114480f83c4 100644 --- a/GitHub.js +++ b/GitHub.js @@ -365,7 +365,15 @@ function completeWithAPI(item, owner, githubRepository) { function searchFieldValue(yamlContent, field) { const regex = new RegExp(`^${field}:\\s*(.+)`, 'm'); const match = yamlContent.match(regex); - return match ? match[1].trim() : null; + + let value = null; + if (match) { + value = match[1].trim(); + if (value.startsWith('"') && value.endsWith('"')) { + value = value.slice(1, -1); + } + } + return value; } /** @@ -825,6 +833,7 @@ var testCases = [ "rights": "MIT", "url": "https://github.com/pulipulichen/PTS-Local-News-Dataset", "versionNumber": "20250105-0131", + "repositoryLocation": "GitHub", "attachments": [], "tags": [ { From 4efa6e95d90d8b0a6d758c5b08c4936210526c6f Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 07:00:39 +0800 Subject: [PATCH 28/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2007=E6=99=8200?= =?UTF-8?q?=E5=88=8639=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/GitHub.js b/GitHub.js index 114480f83c4..d3fec0bb655 100644 --- a/GitHub.js +++ b/GitHub.js @@ -35,9 +35,7 @@ const apiUrl = "https://api.github.com/"; async function detectWeb(doc, url) { if (url.includes("/search?")) { - if (getSearchResults(doc, true)) { - return "multiple"; - } + return "multiple"; } if (!doc.querySelector('meta[property="og:type"][content="object"]')) { From 772cfa6aa0867b41ec87e38b6e12358775eba7be Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 07:08:31 +0800 Subject: [PATCH 29/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2007=E6=99=8208?= =?UTF-8?q?=E5=88=8631=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From e6ab9f8e0f312e6e5efe165d1e03ac94df76a4d3 Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 07:34:32 +0800 Subject: [PATCH 30/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2007=E6=99=8234?= =?UTF-8?q?=E5=88=8632=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/GitHub.js b/GitHub.js index d3fec0bb655..af2d64369a6 100644 --- a/GitHub.js +++ b/GitHub.js @@ -35,7 +35,10 @@ const apiUrl = "https://api.github.com/"; async function detectWeb(doc, url) { if (url.includes("/search?")) { - return "multiple"; + var rows = doc.querySelectorAll('[data-testid="results-list"] .search-title a'); + if (rows.length > 0) { + return "multiple"; + } } if (!doc.querySelector('meta[property="og:type"][content="object"]')) { @@ -44,19 +47,22 @@ async function detectWeb(doc, url) { } // `og:title` is messed up when browsing a file. - let ogTitle = attr(doc, 'meta[property="og:url"]', 'content'); - if (ogTitle.includes('/blob/') || url.startsWith(ogTitle + '/blob/')) { + let ogURL = attr(doc, 'meta[property="og:url"]', 'content'); + if (ogURL.includes('/blob/') || url.startsWith(ogURL + '/blob/')) { return "computerProgram"; } - if (!/^(GitHub - )?[^/\s]+\/[^/\s]+(: .*)?$/.test(attr(doc, 'meta[property="og:title"]', 'content')) && !/^(GitHub - )?[^/\s]+\/[^/\s]+( .*)?$/.test(attr(doc, 'meta[property="og:title"]', 'content'))) { + let ogTitle = attr(doc, 'meta[property="og:title"]', 'content'); + let path = url.split('/').slice(3, 5).join('/'); + let repo = url.split('/').slice(4, 5)[0]; + // if (!/^(GitHub - )?[^/\s]+\/[^/\s]+(: .*)?$/.test(attr(doc, 'meta[property="og:title"]', 'content')) && !/^(GitHub - )?[^/\s]+\/[^/\s]+( .*)?$/.test(attr(doc, 'meta[property="og:title"]', 'content'))) { + if (!ogTitle.startsWith(path) && !ogTitle.startsWith(repo + '/')) { // and anything without a repo name (abc/xyz) as its og:title. // deals with repo pages that we can't scrape, like GitHub Discussions. return false; } return new Promise(function (resolve) { - let path = url.split('/').slice(3, 5).join('/'); ZU.doGet(`https://raw.githubusercontent.com/${path}/HEAD/CITATION.cff`, function (cffText, xhr) { if (xhr.status !== 200) { return resolve("computerProgram"); From ad3645c47cfc6989bb9aa833f5856bb3eda81dc3 Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 07:36:51 +0800 Subject: [PATCH 31/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2007=E6=99=8236?= =?UTF-8?q?=E5=88=8651=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 1 - 1 file changed, 1 deletion(-) diff --git a/GitHub.js b/GitHub.js index af2d64369a6..a57e23bd342 100644 --- a/GitHub.js +++ b/GitHub.js @@ -55,7 +55,6 @@ async function detectWeb(doc, url) { let ogTitle = attr(doc, 'meta[property="og:title"]', 'content'); let path = url.split('/').slice(3, 5).join('/'); let repo = url.split('/').slice(4, 5)[0]; - // if (!/^(GitHub - )?[^/\s]+\/[^/\s]+(: .*)?$/.test(attr(doc, 'meta[property="og:title"]', 'content')) && !/^(GitHub - )?[^/\s]+\/[^/\s]+( .*)?$/.test(attr(doc, 'meta[property="og:title"]', 'content'))) { if (!ogTitle.startsWith(path) && !ogTitle.startsWith(repo + '/')) { // and anything without a repo name (abc/xyz) as its og:title. // deals with repo pages that we can't scrape, like GitHub Discussions. From 05fc48ef6173d40046c730d3476e46d0fa5ad856 Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 11:45:25 +0800 Subject: [PATCH 32/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2011=E6=99=8245?= =?UTF-8?q?=E5=88=8625=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/GitHub.js b/GitHub.js index a57e23bd342..709bcaf9b32 100644 --- a/GitHub.js +++ b/GitHub.js @@ -73,7 +73,9 @@ async function detectWeb(doc, url) { } } catch (e) { - // do nothing + console.error(`CITATION.cff format is invalid: + +${cffText}`) } return resolve("computerProgram"); }, null, null, { 'X-Requested-With': 'XMLHttpRequest' }, false); From 7ca33e40a5e7f43bf3a4792215d9a558bb187aba Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 18:08:02 +0800 Subject: [PATCH 33/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2018=E6=99=8208?= =?UTF-8?q?=E5=88=8602=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/GitHub.js b/GitHub.js index 709bcaf9b32..f24742bc85a 100644 --- a/GitHub.js +++ b/GitHub.js @@ -75,7 +75,7 @@ async function detectWeb(doc, url) { catch (e) { console.error(`CITATION.cff format is invalid: -${cffText}`) +${cffText}`); } return resolve("computerProgram"); }, null, null, { 'X-Requested-With': 'XMLHttpRequest' }, false); @@ -162,6 +162,9 @@ function scrape(doc, url) { } let latestCommitLink = attr(doc, 'link[rel="canonical"]', 'href'); + if (!latestCommitLink && url.includes('/blob/') === false) { + latestCommitLink = attr(doc, '[data-testid="latest-commit-html"] a', 'href'); + } if (!latestCommitLink) { latestCommitLink = attr(doc, '[data-testid="breadcrumbs-repo-link"]', 'href'); } From 0401ac6c80489059982d4f3c70ed70c18d02ce9f Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 18:11:35 +0800 Subject: [PATCH 34/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2018=E6=99=8211?= =?UTF-8?q?=E5=88=8635=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/GitHub.js b/GitHub.js index f24742bc85a..91d39c2a07a 100644 --- a/GitHub.js +++ b/GitHub.js @@ -410,6 +410,7 @@ var testCases = [ { "type": "web", "url": "https://github.com/zotero/zotero/tree/0a6095322668908f243a536a4e43911d80f76b75", + "defer": true, "items": [ { "itemType": "computerProgram", @@ -446,6 +447,7 @@ var testCases = [ }, { "type": "web", + "defer": true, "url": "https://github.com/datacite/schema/tree/4.6.0", "items": [ { @@ -476,6 +478,7 @@ var testCases = [ }, { "type": "web", + "defer": true, "url": "https://github.com/datacite/schema/blob/4.6.0/.dockerignore", "items": [ { @@ -506,6 +509,7 @@ var testCases = [ }, { "type": "web", + "defer": true, "url": "https://github.com/mittagessen/kraken/tree/4.1.2", "items": [ { @@ -564,6 +568,7 @@ var testCases = [ }, { "type": "web", + "defer": true, "url": "https://github.com/aurimasv/z2csl/tree/5750900e907b6730ccd724e23444ccc79d15f3f3", "items": [ { @@ -593,6 +598,7 @@ var testCases = [ }, { "type": "web", + "defer": true, "url": "https://github.com/zotero/translators/blob/eb4f39007e62d3d632448e184b1fd3671b3a1349/GitHub.js", "items": [ { @@ -623,6 +629,7 @@ var testCases = [ }, { "type": "web", + "defer": true, "url": "https://github.com/citation-file-format/citation-file-format/tree/1.2.0", "items": [ { @@ -722,6 +729,7 @@ var testCases = [ }, { "type": "web", + "defer": true, "url": "https://github.com/citation-file-format/citation-file-format/blob/1.1.0/test/pytest.ini", "items": [ { @@ -821,6 +829,7 @@ var testCases = [ }, { "type": "web", + "defer": true, "url": "https://github.com/pulipulichen/PTS-Local-News-Dataset/tree/20250105-0131", "items": [ { From adc898a1f6eafd87b30e1114402eb266c6e24b74 Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 18:22:52 +0800 Subject: [PATCH 35/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2018=E6=99=8222?= =?UTF-8?q?=E5=88=8652=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 858 +++++++++++++++++++++++++++--------------------------- 1 file changed, 429 insertions(+), 429 deletions(-) diff --git a/GitHub.js b/GitHub.js index 91d39c2a07a..772398e433e 100644 --- a/GitHub.js +++ b/GitHub.js @@ -439,434 +439,434 @@ var testCases = [ } ] }, - { - "type": "web", - "url": "https://github.com/search?utf8=%E2%9C%93&q=topic%3Ahocr&type=repositories", - "defer": true, - "items": "multiple" - }, - { - "type": "web", - "defer": true, - "url": "https://github.com/datacite/schema/tree/4.6.0", - "items": [ - { - "itemType": "computerProgram", - "title": "DataCite Schema Repository", - "creators": [ - { - "lastName": "datacite", - "creatorType": "programmer", - "fieldMode": 1 - } - ], - "date": "2024-12-05T18:31:38Z", - "abstractNote": "DataCite Metadata Schema Repository", - "company": "DataCite", - "extra": "original-date: 2011-04-13T07:08:41Z", - "libraryCatalog": "GitHub", - "programmingLanguage": "Ruby", - "url": "https://github.com/datacite/schema/tree/4.6.0", - "versionNumber": "4.6.0", - "place": "GitHub", - "attachments": [], - "tags": [], - "notes": [], - "seeAlso": [] - } - ] - }, - { - "type": "web", - "defer": true, - "url": "https://github.com/datacite/schema/blob/4.6.0/.dockerignore", - "items": [ - { - "itemType": "computerProgram", - "title": ".dockerignore", - "creators": [ - { - "lastName": "datacite", - "creatorType": "programmer", - "fieldMode": 1 - } - ], - "date": "2024-12-05T18:31:38Z", - "abstractNote": "DataCite Metadata Schema Repository", - "company": "DataCite", - "extra": "original-date: 2011-04-13T07:08:41Z", - "libraryCatalog": "GitHub", - "programmingLanguage": "Ruby", - "url": "https://github.com/datacite/schema/blob/4.6.0/.dockerignore", - "versionNumber": "4.6.0", - "place": "GitHub", - "attachments": [], - "tags": [], - "notes": [], - "seeAlso": [] - } - ] - }, - { - "type": "web", - "defer": true, - "url": "https://github.com/mittagessen/kraken/tree/4.1.2", - "items": [ - { - "itemType": "computerProgram", - "title": "The Kraken OCR system", - "creators": [ - { - "firstName": "Benjamin", - "lastName": "Kiessling", - "creatorType": "author" - } - ], - "date": "2022-04", - "abstractNote": "OCR engine for all the languages", - "extra": "original-date: 2015-05-19T09:24:38Z", - "libraryCatalog": "GitHub", - "programmingLanguage": "Python", - "versionNumber": "4.1.2", - "place": "GitHub", - "rights": "Apache-2.0", - "url": "https://kraken.re", - "attachments": [], - "tags": [ - { - "tag": "alto-xml" - }, - { - "tag": "handwritten-text-recognition" - }, - { - "tag": "hocr" - }, - { - "tag": "htr" - }, - { - "tag": "layout-analysis" - }, - { - "tag": "optical-character-recognition" - }, - { - "tag": "neural-networks" - }, - { - "tag": "ocr" - }, - { - "tag": "page-xml" - } - ], - "notes": [], - "seeAlso": [] - } - ] - }, - { - "type": "web", - "defer": true, - "url": "https://github.com/aurimasv/z2csl/tree/5750900e907b6730ccd724e23444ccc79d15f3f3", - "items": [ - { - "itemType": "computerProgram", - "title": "z2csl - Zotero to CSL extension and mappings", - "creators": [ - { - "firstName": "Aurimas", - "lastName": "Vinckevicius", - "creatorType": "programmer" - } - ], - "date": "2022-07-14T16:14:40Z", - "abstractNote": "Zotero extension for creating Zotero to CSL item type and field mappings.", - "extra": "original-date: 2012-05-20T07:53:58Z", - "libraryCatalog": "GitHub", - "programmingLanguage": "JavaScript", - "versionNumber": "5750900e907b6730ccd724e23444ccc79d15f3f3", - "url": "https://github.com/aurimasv/z2csl/tree/5750900e907b6730ccd724e23444ccc79d15f3f3", - "place": "GitHub", - "attachments": [], - "tags": [], - "notes": [], - "seeAlso": [] - } - ] - }, - { - "type": "web", - "defer": true, - "url": "https://github.com/zotero/translators/blob/eb4f39007e62d3d632448e184b1fd3671b3a1349/GitHub.js", - "items": [ - { - "itemType": "computerProgram", - "title": "GitHub.js", - "creators": [ - { - "lastName": "zotero", - "creatorType": "programmer", - "fieldMode": 1 - } - ], - "date": "2021-07-28T21:54:41Z", - "versionNumber": "eb4f39007e62d3d632448e184b1fd3671b3a1349", - "abstractNote": "Zotero Translators", - "company": "Zotero", - "extra": "original-date: 2011-07-03T17:40:38Z", - "libraryCatalog": "GitHub", - "programmingLanguage": "JavaScript", - "place": "GitHub", - "url": "https://github.com/zotero/translators/blob/eb4f39007e62d3d632448e184b1fd3671b3a1349/GitHub.js", - "attachments": [], - "tags": [], - "notes": [], - "seeAlso": [] - } - ] - }, - { - "type": "web", - "defer": true, - "url": "https://github.com/citation-file-format/citation-file-format/tree/1.2.0", - "items": [ - { - "itemType": "computerProgram", - "title": "Citation File Format", - "creators": [ - { - "firstName": "Stephan", - "lastName": "Druskat", - "creatorType": "author" - }, - { - "firstName": "Jurriaan H.", - "lastName": "Spaaks", - "creatorType": "author" - }, - { - "firstName": "Neil", - "lastName": "Chue Hong", - "creatorType": "author" - }, - { - "firstName": "Robert", - "lastName": "Haines", - "creatorType": "author" - }, - { - "firstName": "James", - "lastName": "Baker", - "creatorType": "author" - }, - { - "firstName": "Spencer", - "lastName": "Bliven", - "creatorType": "author" - }, - { - "firstName": "Egon", - "lastName": "Willighagen", - "creatorType": "author" - }, - { - "firstName": "David", - "lastName": "Pérez-Suárez", - "creatorType": "author" - }, - { - "firstName": "Olexandr", - "lastName": "Konovalov", - "creatorType": "author" - } - ], - "date": "2021-08", - "abstractNote": "CITATION.cff files are plain text files with human- and machine-readable citation information for software. Code developers can include them in their repositories to let others know how to correctly cite their software. This is the specification for the Citation File Format.", - "extra": "DOI: 10.5281/zenodo.5171937", - "libraryCatalog": "GitHub", - "programmingLanguage": "Python", - "rights": "CC-BY-4.0", - "url": "https://github.com/citation-file-format/citation-file-format/tree/1.2.0", - "versionNumber": "1.2.0", - "place": "GitHub", - "attachments": [], - "tags": [ - { - "tag": "CFF" - }, - { - "tag": "YAML" - }, - { - "tag": "citation file format" - }, - - { - "tag": "citation files" - }, - { - "tag": "credit" - }, - { - "tag": "file format" - }, - { - "tag": "research software" - }, - { - "tag": "software citation" - }, - { - "tag": "software sustainability" - } - ], - "notes": [], - "seeAlso": [] - } - ] - }, - { - "type": "web", - "defer": true, - "url": "https://github.com/citation-file-format/citation-file-format/blob/1.1.0/test/pytest.ini", - "items": [ - { - "itemType": "computerProgram", - "title": "pytest.ini", - "creators": [ - { - "firstName": "Stephan", - "lastName": "Druskat", - "creatorType": "author" - }, - { - "firstName": "Jurriaan H.", - "lastName": "Spaaks", - "creatorType": "author" - }, - { - "firstName": "Neil", - "lastName": "Chue Hong", - "creatorType": "author" - }, - { - "firstName": "Robert", - "lastName": "Haines", - "creatorType": "author" - }, - { - "firstName": "James", - "lastName": "Baker", - "creatorType": "author" - }, - { - "firstName": "Spencer", - "lastName": "Bliven", - "creatorType": "author" - }, - { - "firstName": "Egon", - "lastName": "Willighagen", - "creatorType": "author" - }, - { - "firstName": "David", - "lastName": "Pérez-Suárez", - "creatorType": "author" - }, - { - "firstName": "Olexandr", - "lastName": "Konovalov", - "creatorType": "author" - } - ], - "date": "2021-08", - "abstractNote": "CITATION.cff files are plain text files with human- and machine-readable citation information for software. Code developers can include them in their repositories to let others know how to correctly cite their software. This is the specification for the Citation File Format.", - "extra": "DOI: 10.5281/zenodo.5171937", - "libraryCatalog": "GitHub", - "programmingLanguage": "Python", - "rights": "CC-BY-4.0", - "url": "https://github.com/citation-file-format/citation-file-format/blob/1.1.0/test/pytest.ini", - "versionNumber": "1.1.0", - "place": "GitHub", - "attachments": [], - "tags": [ - { - "tag": "CFF" - }, - { - "tag": "YAML" - }, - { - "tag": "citation file format" - }, - - { - "tag": "citation files" - }, - { - "tag": "credit" - }, - { - "tag": "file format" - }, - { - "tag": "research software" - }, - { - "tag": "software citation" - }, - { - "tag": "software sustainability" - } - ], - "notes": [], - "seeAlso": [] - } - ] - }, - { - "type": "web", - "defer": true, - "url": "https://github.com/pulipulichen/PTS-Local-News-Dataset/tree/20250105-0131", - "items": [ - { - "itemType": "dataset", - "title": "PTS-Local-News-Dataset", - "creators": [ - { - "firstName": "Yung-Ting", - "lastName": "Chen", - "creatorType": "author" - } - ], - "date": "2025-01-04T17:28:41Z", - "abstractNote": "A dataset containing local news from Taiwan Public Television Service.", - "extra": "DOI: 10.5281/zenodo.14598063", - "libraryCatalog": "GitHub", - "DOI": "10.5281/zenodo.14598063", - "rights": "MIT", - "url": "https://github.com/pulipulichen/PTS-Local-News-Dataset", - "versionNumber": "20250105-0131", - "repositoryLocation": "GitHub", - "attachments": [], - "tags": [ - { - "tag": "dataset" - }, - { - "tag": "news" - }, - { - "tag": "PTS" - } - ], - "notes": [], - "seeAlso": [] - } - ] - } + // { + // "type": "web", + // "url": "https://github.com/search?utf8=%E2%9C%93&q=topic%3Ahocr&type=repositories", + // "defer": true, + // "items": "multiple" + // }, + // { + // "type": "web", + // "defer": true, + // "url": "https://github.com/datacite/schema/tree/4.6.0", + // "items": [ + // { + // "itemType": "computerProgram", + // "title": "DataCite Schema Repository", + // "creators": [ + // { + // "lastName": "datacite", + // "creatorType": "programmer", + // "fieldMode": 1 + // } + // ], + // "date": "2024-12-05T18:31:38Z", + // "abstractNote": "DataCite Metadata Schema Repository", + // "company": "DataCite", + // "extra": "original-date: 2011-04-13T07:08:41Z", + // "libraryCatalog": "GitHub", + // "programmingLanguage": "Ruby", + // "url": "https://github.com/datacite/schema/tree/4.6.0", + // "versionNumber": "4.6.0", + // "place": "GitHub", + // "attachments": [], + // "tags": [], + // "notes": [], + // "seeAlso": [] + // } + // ] + // }, + // { + // "type": "web", + // "defer": true, + // "url": "https://github.com/datacite/schema/blob/4.6.0/.dockerignore", + // "items": [ + // { + // "itemType": "computerProgram", + // "title": ".dockerignore", + // "creators": [ + // { + // "lastName": "datacite", + // "creatorType": "programmer", + // "fieldMode": 1 + // } + // ], + // "date": "2024-12-05T18:31:38Z", + // "abstractNote": "DataCite Metadata Schema Repository", + // "company": "DataCite", + // "extra": "original-date: 2011-04-13T07:08:41Z", + // "libraryCatalog": "GitHub", + // "programmingLanguage": "Ruby", + // "url": "https://github.com/datacite/schema/blob/4.6.0/.dockerignore", + // "versionNumber": "4.6.0", + // "place": "GitHub", + // "attachments": [], + // "tags": [], + // "notes": [], + // "seeAlso": [] + // } + // ] + // }, + // { + // "type": "web", + // "defer": true, + // "url": "https://github.com/mittagessen/kraken/tree/4.1.2", + // "items": [ + // { + // "itemType": "computerProgram", + // "title": "The Kraken OCR system", + // "creators": [ + // { + // "firstName": "Benjamin", + // "lastName": "Kiessling", + // "creatorType": "author" + // } + // ], + // "date": "2022-04", + // "abstractNote": "OCR engine for all the languages", + // "extra": "original-date: 2015-05-19T09:24:38Z", + // "libraryCatalog": "GitHub", + // "programmingLanguage": "Python", + // "versionNumber": "4.1.2", + // "place": "GitHub", + // "rights": "Apache-2.0", + // "url": "https://kraken.re", + // "attachments": [], + // "tags": [ + // { + // "tag": "alto-xml" + // }, + // { + // "tag": "handwritten-text-recognition" + // }, + // { + // "tag": "hocr" + // }, + // { + // "tag": "htr" + // }, + // { + // "tag": "layout-analysis" + // }, + // { + // "tag": "optical-character-recognition" + // }, + // { + // "tag": "neural-networks" + // }, + // { + // "tag": "ocr" + // }, + // { + // "tag": "page-xml" + // } + // ], + // "notes": [], + // "seeAlso": [] + // } + // ] + // }, + // { + // "type": "web", + // "defer": true, + // "url": "https://github.com/aurimasv/z2csl/tree/5750900e907b6730ccd724e23444ccc79d15f3f3", + // "items": [ + // { + // "itemType": "computerProgram", + // "title": "z2csl - Zotero to CSL extension and mappings", + // "creators": [ + // { + // "firstName": "Aurimas", + // "lastName": "Vinckevicius", + // "creatorType": "programmer" + // } + // ], + // "date": "2022-07-14T16:14:40Z", + // "abstractNote": "Zotero extension for creating Zotero to CSL item type and field mappings.", + // "extra": "original-date: 2012-05-20T07:53:58Z", + // "libraryCatalog": "GitHub", + // "programmingLanguage": "JavaScript", + // "versionNumber": "5750900e907b6730ccd724e23444ccc79d15f3f3", + // "url": "https://github.com/aurimasv/z2csl/tree/5750900e907b6730ccd724e23444ccc79d15f3f3", + // "place": "GitHub", + // "attachments": [], + // "tags": [], + // "notes": [], + // "seeAlso": [] + // } + // ] + // }, + // { + // "type": "web", + // "defer": true, + // "url": "https://github.com/zotero/translators/blob/eb4f39007e62d3d632448e184b1fd3671b3a1349/GitHub.js", + // "items": [ + // { + // "itemType": "computerProgram", + // "title": "GitHub.js", + // "creators": [ + // { + // "lastName": "zotero", + // "creatorType": "programmer", + // "fieldMode": 1 + // } + // ], + // "date": "2021-07-28T21:54:41Z", + // "versionNumber": "eb4f39007e62d3d632448e184b1fd3671b3a1349", + // "abstractNote": "Zotero Translators", + // "company": "Zotero", + // "extra": "original-date: 2011-07-03T17:40:38Z", + // "libraryCatalog": "GitHub", + // "programmingLanguage": "JavaScript", + // "place": "GitHub", + // "url": "https://github.com/zotero/translators/blob/eb4f39007e62d3d632448e184b1fd3671b3a1349/GitHub.js", + // "attachments": [], + // "tags": [], + // "notes": [], + // "seeAlso": [] + // } + // ] + // }, + // { + // "type": "web", + // "defer": true, + // "url": "https://github.com/citation-file-format/citation-file-format/tree/1.2.0", + // "items": [ + // { + // "itemType": "computerProgram", + // "title": "Citation File Format", + // "creators": [ + // { + // "firstName": "Stephan", + // "lastName": "Druskat", + // "creatorType": "author" + // }, + // { + // "firstName": "Jurriaan H.", + // "lastName": "Spaaks", + // "creatorType": "author" + // }, + // { + // "firstName": "Neil", + // "lastName": "Chue Hong", + // "creatorType": "author" + // }, + // { + // "firstName": "Robert", + // "lastName": "Haines", + // "creatorType": "author" + // }, + // { + // "firstName": "James", + // "lastName": "Baker", + // "creatorType": "author" + // }, + // { + // "firstName": "Spencer", + // "lastName": "Bliven", + // "creatorType": "author" + // }, + // { + // "firstName": "Egon", + // "lastName": "Willighagen", + // "creatorType": "author" + // }, + // { + // "firstName": "David", + // "lastName": "Pérez-Suárez", + // "creatorType": "author" + // }, + // { + // "firstName": "Olexandr", + // "lastName": "Konovalov", + // "creatorType": "author" + // } + // ], + // "date": "2021-08", + // "abstractNote": "CITATION.cff files are plain text files with human- and machine-readable citation information for software. Code developers can include them in their repositories to let others know how to correctly cite their software. This is the specification for the Citation File Format.", + // "extra": "DOI: 10.5281/zenodo.5171937", + // "libraryCatalog": "GitHub", + // "programmingLanguage": "Python", + // "rights": "CC-BY-4.0", + // "url": "https://github.com/citation-file-format/citation-file-format/tree/1.2.0", + // "versionNumber": "1.2.0", + // "place": "GitHub", + // "attachments": [], + // "tags": [ + // { + // "tag": "CFF" + // }, + // { + // "tag": "YAML" + // }, + // { + // "tag": "citation file format" + // }, + + // { + // "tag": "citation files" + // }, + // { + // "tag": "credit" + // }, + // { + // "tag": "file format" + // }, + // { + // "tag": "research software" + // }, + // { + // "tag": "software citation" + // }, + // { + // "tag": "software sustainability" + // } + // ], + // "notes": [], + // "seeAlso": [] + // } + // ] + // }, + // { + // "type": "web", + // "defer": true, + // "url": "https://github.com/citation-file-format/citation-file-format/blob/1.1.0/test/pytest.ini", + // "items": [ + // { + // "itemType": "computerProgram", + // "title": "pytest.ini", + // "creators": [ + // { + // "firstName": "Stephan", + // "lastName": "Druskat", + // "creatorType": "author" + // }, + // { + // "firstName": "Jurriaan H.", + // "lastName": "Spaaks", + // "creatorType": "author" + // }, + // { + // "firstName": "Neil", + // "lastName": "Chue Hong", + // "creatorType": "author" + // }, + // { + // "firstName": "Robert", + // "lastName": "Haines", + // "creatorType": "author" + // }, + // { + // "firstName": "James", + // "lastName": "Baker", + // "creatorType": "author" + // }, + // { + // "firstName": "Spencer", + // "lastName": "Bliven", + // "creatorType": "author" + // }, + // { + // "firstName": "Egon", + // "lastName": "Willighagen", + // "creatorType": "author" + // }, + // { + // "firstName": "David", + // "lastName": "Pérez-Suárez", + // "creatorType": "author" + // }, + // { + // "firstName": "Olexandr", + // "lastName": "Konovalov", + // "creatorType": "author" + // } + // ], + // "date": "2021-08", + // "abstractNote": "CITATION.cff files are plain text files with human- and machine-readable citation information for software. Code developers can include them in their repositories to let others know how to correctly cite their software. This is the specification for the Citation File Format.", + // "extra": "DOI: 10.5281/zenodo.5171937", + // "libraryCatalog": "GitHub", + // "programmingLanguage": "Python", + // "rights": "CC-BY-4.0", + // "url": "https://github.com/citation-file-format/citation-file-format/blob/1.1.0/test/pytest.ini", + // "versionNumber": "1.1.0", + // "place": "GitHub", + // "attachments": [], + // "tags": [ + // { + // "tag": "CFF" + // }, + // { + // "tag": "YAML" + // }, + // { + // "tag": "citation file format" + // }, + + // { + // "tag": "citation files" + // }, + // { + // "tag": "credit" + // }, + // { + // "tag": "file format" + // }, + // { + // "tag": "research software" + // }, + // { + // "tag": "software citation" + // }, + // { + // "tag": "software sustainability" + // } + // ], + // "notes": [], + // "seeAlso": [] + // } + // ] + // }, + // { + // "type": "web", + // "defer": true, + // "url": "https://github.com/pulipulichen/PTS-Local-News-Dataset/tree/20250105-0131", + // "items": [ + // { + // "itemType": "dataset", + // "title": "PTS-Local-News-Dataset", + // "creators": [ + // { + // "firstName": "Yung-Ting", + // "lastName": "Chen", + // "creatorType": "author" + // } + // ], + // "date": "2025-01-04T17:28:41Z", + // "abstractNote": "A dataset containing local news from Taiwan Public Television Service.", + // "extra": "DOI: 10.5281/zenodo.14598063", + // "libraryCatalog": "GitHub", + // "DOI": "10.5281/zenodo.14598063", + // "rights": "MIT", + // "url": "https://github.com/pulipulichen/PTS-Local-News-Dataset", + // "versionNumber": "20250105-0131", + // "repositoryLocation": "GitHub", + // "attachments": [], + // "tags": [ + // { + // "tag": "dataset" + // }, + // { + // "tag": "news" + // }, + // { + // "tag": "PTS" + // } + // ], + // "notes": [], + // "seeAlso": [] + // } + // ] + // } ] /** END TEST CASES **/ From c3a076e0178985af70d8bd8bad6f76d80b060cf6 Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 18:26:12 +0800 Subject: [PATCH 36/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2018=E6=99=8226?= =?UTF-8?q?=E5=88=8612=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/GitHub.js b/GitHub.js index 772398e433e..18cb06446dc 100644 --- a/GitHub.js +++ b/GitHub.js @@ -439,12 +439,12 @@ var testCases = [ } ] }, - // { - // "type": "web", - // "url": "https://github.com/search?utf8=%E2%9C%93&q=topic%3Ahocr&type=repositories", - // "defer": true, - // "items": "multiple" - // }, + { + "type": "web", + "url": "https://github.com/search?utf8=%E2%9C%93&q=topic%3Ahocr&type=repositories", + "defer": true, + "items": "multiple" + } // { // "type": "web", // "defer": true, From 9b1557e98fe7e2a6986c724ca16b5bfb1a9e1493 Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 18:32:07 +0800 Subject: [PATCH 37/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2018=E6=99=8232?= =?UTF-8?q?=E5=88=8607=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 67 ++++++++++++++++++++++++++----------------------------- 1 file changed, 32 insertions(+), 35 deletions(-) diff --git a/GitHub.js b/GitHub.js index 18cb06446dc..0770b198f78 100644 --- a/GitHub.js +++ b/GitHub.js @@ -410,7 +410,6 @@ var testCases = [ { "type": "web", "url": "https://github.com/zotero/zotero/tree/0a6095322668908f243a536a4e43911d80f76b75", - "defer": true, "items": [ { "itemType": "computerProgram", @@ -422,7 +421,6 @@ var testCases = [ "fieldMode": 1 } ], - "version": "0a6095322668908f243a536a4e43911d80f76b75", "date": "2024-12-06T09:38:01Z", "abstractNote": "Zotero is a free, easy-to-use tool to help you collect, organize, annotate, cite, and share your research sources.", "company": "Zotero", @@ -439,43 +437,42 @@ var testCases = [ } ] }, - { - "type": "web", - "url": "https://github.com/search?utf8=%E2%9C%93&q=topic%3Ahocr&type=repositories", - "defer": true, - "items": "multiple" - } // { // "type": "web", + // "url": "https://github.com/search?utf8=%E2%9C%93&q=topic%3Ahocr&type=repositories", // "defer": true, - // "url": "https://github.com/datacite/schema/tree/4.6.0", - // "items": [ - // { - // "itemType": "computerProgram", - // "title": "DataCite Schema Repository", - // "creators": [ - // { - // "lastName": "datacite", - // "creatorType": "programmer", - // "fieldMode": 1 - // } - // ], - // "date": "2024-12-05T18:31:38Z", - // "abstractNote": "DataCite Metadata Schema Repository", - // "company": "DataCite", - // "extra": "original-date: 2011-04-13T07:08:41Z", - // "libraryCatalog": "GitHub", - // "programmingLanguage": "Ruby", - // "url": "https://github.com/datacite/schema/tree/4.6.0", - // "versionNumber": "4.6.0", - // "place": "GitHub", - // "attachments": [], - // "tags": [], - // "notes": [], - // "seeAlso": [] - // } - // ] + // "items": "multiple" // }, + { + "type": "web", + "url": "https://github.com/datacite/schema/tree/4.6.0", + "items": [ + { + "itemType": "computerProgram", + "title": "DataCite Schema Repository", + "creators": [ + { + "lastName": "datacite", + "creatorType": "programmer", + "fieldMode": 1 + } + ], + "date": "2024-12-05T18:31:38Z", + "abstractNote": "DataCite Metadata Schema Repository", + "company": "DataCite", + "extra": "original-date: 2011-04-13T07:08:41Z", + "libraryCatalog": "GitHub", + "programmingLanguage": "Ruby", + "url": "https://github.com/datacite/schema/tree/4.6.0", + "versionNumber": "4.6.0", + "place": "GitHub", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + } // { // "type": "web", // "defer": true, From a15ed7ab52b432a3ffb9fee67ee06b0c45b52d16 Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 18:36:54 +0800 Subject: [PATCH 38/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2018=E6=99=8236?= =?UTF-8?q?=E5=88=8654=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 791 +++++++++++++++++++++++++++--------------------------- 1 file changed, 392 insertions(+), 399 deletions(-) diff --git a/GitHub.js b/GitHub.js index 0770b198f78..c76959e7d24 100644 --- a/GitHub.js +++ b/GitHub.js @@ -421,6 +421,7 @@ var testCases = [ "fieldMode": 1 } ], + "version": "0a6095322668908f243a536a4e43911d80f76b75", "date": "2024-12-06T09:38:01Z", "abstractNote": "Zotero is a free, easy-to-use tool to help you collect, organize, annotate, cite, and share your research sources.", "company": "Zotero", @@ -437,12 +438,12 @@ var testCases = [ } ] }, - // { - // "type": "web", - // "url": "https://github.com/search?utf8=%E2%9C%93&q=topic%3Ahocr&type=repositories", - // "defer": true, - // "items": "multiple" - // }, + { + "type": "web", + "url": "https://github.com/search?utf8=%E2%9C%93&q=topic%3Ahocr&type=repositories", + "defer": true, + "items": "multiple" + }, { "type": "web", "url": "https://github.com/datacite/schema/tree/4.6.0", @@ -472,398 +473,390 @@ var testCases = [ "seeAlso": [] } ] + }, + { + "type": "web", + "url": "https://github.com/datacite/schema/blob/4.6.0/.dockerignore", + "items": [ + { + "itemType": "computerProgram", + "title": ".dockerignore", + "creators": [ + { + "lastName": "datacite", + "creatorType": "programmer", + "fieldMode": 1 + } + ], + "date": "2024-12-05T18:31:38Z", + "abstractNote": "DataCite Metadata Schema Repository", + "company": "DataCite", + "extra": "original-date: 2011-04-13T07:08:41Z", + "libraryCatalog": "GitHub", + "programmingLanguage": "Ruby", + "url": "https://github.com/datacite/schema/blob/4.6.0/.dockerignore", + "versionNumber": "4.6.0", + "place": "GitHub", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://github.com/mittagessen/kraken/tree/4.1.2", + "items": [ + { + "itemType": "computerProgram", + "title": "The Kraken OCR system", + "creators": [ + { + "firstName": "Benjamin", + "lastName": "Kiessling", + "creatorType": "author" + } + ], + "date": "2022-04", + "abstractNote": "OCR engine for all the languages", + "extra": "original-date: 2015-05-19T09:24:38Z", + "libraryCatalog": "GitHub", + "programmingLanguage": "Python", + "versionNumber": "4.1.2", + "place": "GitHub", + "rights": "Apache-2.0", + "url": "https://kraken.re", + "attachments": [], + "tags": [ + { + "tag": "alto-xml" + }, + { + "tag": "handwritten-text-recognition" + }, + { + "tag": "hocr" + }, + { + "tag": "htr" + }, + { + "tag": "layout-analysis" + }, + { + "tag": "optical-character-recognition" + }, + { + "tag": "neural-networks" + }, + { + "tag": "ocr" + }, + { + "tag": "page-xml" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://github.com/aurimasv/z2csl/tree/5750900e907b6730ccd724e23444ccc79d15f3f3", + "items": [ + { + "itemType": "computerProgram", + "title": "z2csl - Zotero to CSL extension and mappings", + "creators": [ + { + "firstName": "Aurimas", + "lastName": "Vinckevicius", + "creatorType": "programmer" + } + ], + "date": "2022-07-14T16:14:40Z", + "abstractNote": "Zotero extension for creating Zotero to CSL item type and field mappings.", + "extra": "original-date: 2012-05-20T07:53:58Z", + "libraryCatalog": "GitHub", + "programmingLanguage": "JavaScript", + "versionNumber": "5750900e907b6730ccd724e23444ccc79d15f3f3", + "url": "https://github.com/aurimasv/z2csl/tree/5750900e907b6730ccd724e23444ccc79d15f3f3", + "place": "GitHub", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://github.com/zotero/translators/blob/eb4f39007e62d3d632448e184b1fd3671b3a1349/GitHub.js", + "items": [ + { + "itemType": "computerProgram", + "title": "GitHub.js", + "creators": [ + { + "lastName": "zotero", + "creatorType": "programmer", + "fieldMode": 1 + } + ], + "date": "2021-07-28T21:54:41Z", + "versionNumber": "eb4f39007e62d3d632448e184b1fd3671b3a1349", + "abstractNote": "Zotero Translators", + "company": "Zotero", + "extra": "original-date: 2011-07-03T17:40:38Z", + "libraryCatalog": "GitHub", + "programmingLanguage": "JavaScript", + "place": "GitHub", + "url": "https://github.com/zotero/translators/blob/eb4f39007e62d3d632448e184b1fd3671b3a1349/GitHub.js", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://github.com/citation-file-format/citation-file-format/tree/1.2.0", + "items": [ + { + "itemType": "computerProgram", + "title": "Citation File Format", + "creators": [ + { + "firstName": "Stephan", + "lastName": "Druskat", + "creatorType": "author" + }, + { + "firstName": "Jurriaan H.", + "lastName": "Spaaks", + "creatorType": "author" + }, + { + "firstName": "Neil", + "lastName": "Chue Hong", + "creatorType": "author" + }, + { + "firstName": "Robert", + "lastName": "Haines", + "creatorType": "author" + }, + { + "firstName": "James", + "lastName": "Baker", + "creatorType": "author" + }, + { + "firstName": "Spencer", + "lastName": "Bliven", + "creatorType": "author" + }, + { + "firstName": "Egon", + "lastName": "Willighagen", + "creatorType": "author" + }, + { + "firstName": "David", + "lastName": "Pérez-Suárez", + "creatorType": "author" + }, + { + "firstName": "Olexandr", + "lastName": "Konovalov", + "creatorType": "author" + } + ], + "date": "2021-08", + "abstractNote": "CITATION.cff files are plain text files with human- and machine-readable citation information for software. Code developers can include them in their repositories to let others know how to correctly cite their software. This is the specification for the Citation File Format.", + "extra": "DOI: 10.5281/zenodo.5171937", + "libraryCatalog": "GitHub", + "programmingLanguage": "Python", + "rights": "CC-BY-4.0", + "url": "https://github.com/citation-file-format/citation-file-format/tree/1.2.0", + "versionNumber": "1.2.0", + "place": "GitHub", + "attachments": [], + "tags": [ + { + "tag": "CFF" + }, + { + "tag": "YAML" + }, + { + "tag": "citation file format" + }, + + { + "tag": "citation files" + }, + { + "tag": "credit" + }, + { + "tag": "file format" + }, + { + "tag": "research software" + }, + { + "tag": "software citation" + }, + { + "tag": "software sustainability" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://github.com/citation-file-format/citation-file-format/blob/1.1.0/test/pytest.ini", + "items": [ + { + "itemType": "computerProgram", + "title": "pytest.ini", + "creators": [ + { + "firstName": "Stephan", + "lastName": "Druskat", + "creatorType": "author" + }, + { + "firstName": "Jurriaan H.", + "lastName": "Spaaks", + "creatorType": "author" + }, + { + "firstName": "Neil", + "lastName": "Chue Hong", + "creatorType": "author" + }, + { + "firstName": "Robert", + "lastName": "Haines", + "creatorType": "author" + }, + { + "firstName": "James", + "lastName": "Baker", + "creatorType": "author" + }, + { + "firstName": "Spencer", + "lastName": "Bliven", + "creatorType": "author" + }, + { + "firstName": "Egon", + "lastName": "Willighagen", + "creatorType": "author" + }, + { + "firstName": "David", + "lastName": "Pérez-Suárez", + "creatorType": "author" + }, + { + "firstName": "Olexandr", + "lastName": "Konovalov", + "creatorType": "author" + } + ], + "date": "2021-08", + "abstractNote": "CITATION.cff files are plain text files with human- and machine-readable citation information for software. Code developers can include them in their repositories to let others know how to correctly cite their software. This is the specification for the Citation File Format.", + "extra": "DOI: 10.5281/zenodo.5171937", + "libraryCatalog": "GitHub", + "programmingLanguage": "Python", + "rights": "CC-BY-4.0", + "url": "https://github.com/citation-file-format/citation-file-format/blob/1.1.0/test/pytest.ini", + "versionNumber": "1.1.0", + "place": "GitHub", + "attachments": [], + "tags": [ + { + "tag": "CFF" + }, + { + "tag": "YAML" + }, + { + "tag": "citation file format" + }, + + { + "tag": "citation files" + }, + { + "tag": "credit" + }, + { + "tag": "file format" + }, + { + "tag": "research software" + }, + { + "tag": "software citation" + }, + { + "tag": "software sustainability" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://github.com/pulipulichen/PTS-Local-News-Dataset/tree/20250105-0131", + "items": [ + { + "itemType": "dataset", + "title": "PTS-Local-News-Dataset", + "creators": [ + { + "firstName": "Yung-Ting", + "lastName": "Chen", + "creatorType": "author" + } + ], + "date": "2025-01-04T17:28:41Z", + "abstractNote": "A dataset containing local news from Taiwan Public Television Service.", + "extra": "DOI: 10.5281/zenodo.14598063", + "libraryCatalog": "GitHub", + "DOI": "10.5281/zenodo.14598063", + "rights": "MIT", + "url": "https://github.com/pulipulichen/PTS-Local-News-Dataset", + "versionNumber": "20250105-0131", + "attachments": [], + "tags": [ + { + "tag": "dataset" + }, + { + "tag": "news" + }, + { + "tag": "PTS" + } + ], + "notes": [], + "seeAlso": [] + } + ] } - // { - // "type": "web", - // "defer": true, - // "url": "https://github.com/datacite/schema/blob/4.6.0/.dockerignore", - // "items": [ - // { - // "itemType": "computerProgram", - // "title": ".dockerignore", - // "creators": [ - // { - // "lastName": "datacite", - // "creatorType": "programmer", - // "fieldMode": 1 - // } - // ], - // "date": "2024-12-05T18:31:38Z", - // "abstractNote": "DataCite Metadata Schema Repository", - // "company": "DataCite", - // "extra": "original-date: 2011-04-13T07:08:41Z", - // "libraryCatalog": "GitHub", - // "programmingLanguage": "Ruby", - // "url": "https://github.com/datacite/schema/blob/4.6.0/.dockerignore", - // "versionNumber": "4.6.0", - // "place": "GitHub", - // "attachments": [], - // "tags": [], - // "notes": [], - // "seeAlso": [] - // } - // ] - // }, - // { - // "type": "web", - // "defer": true, - // "url": "https://github.com/mittagessen/kraken/tree/4.1.2", - // "items": [ - // { - // "itemType": "computerProgram", - // "title": "The Kraken OCR system", - // "creators": [ - // { - // "firstName": "Benjamin", - // "lastName": "Kiessling", - // "creatorType": "author" - // } - // ], - // "date": "2022-04", - // "abstractNote": "OCR engine for all the languages", - // "extra": "original-date: 2015-05-19T09:24:38Z", - // "libraryCatalog": "GitHub", - // "programmingLanguage": "Python", - // "versionNumber": "4.1.2", - // "place": "GitHub", - // "rights": "Apache-2.0", - // "url": "https://kraken.re", - // "attachments": [], - // "tags": [ - // { - // "tag": "alto-xml" - // }, - // { - // "tag": "handwritten-text-recognition" - // }, - // { - // "tag": "hocr" - // }, - // { - // "tag": "htr" - // }, - // { - // "tag": "layout-analysis" - // }, - // { - // "tag": "optical-character-recognition" - // }, - // { - // "tag": "neural-networks" - // }, - // { - // "tag": "ocr" - // }, - // { - // "tag": "page-xml" - // } - // ], - // "notes": [], - // "seeAlso": [] - // } - // ] - // }, - // { - // "type": "web", - // "defer": true, - // "url": "https://github.com/aurimasv/z2csl/tree/5750900e907b6730ccd724e23444ccc79d15f3f3", - // "items": [ - // { - // "itemType": "computerProgram", - // "title": "z2csl - Zotero to CSL extension and mappings", - // "creators": [ - // { - // "firstName": "Aurimas", - // "lastName": "Vinckevicius", - // "creatorType": "programmer" - // } - // ], - // "date": "2022-07-14T16:14:40Z", - // "abstractNote": "Zotero extension for creating Zotero to CSL item type and field mappings.", - // "extra": "original-date: 2012-05-20T07:53:58Z", - // "libraryCatalog": "GitHub", - // "programmingLanguage": "JavaScript", - // "versionNumber": "5750900e907b6730ccd724e23444ccc79d15f3f3", - // "url": "https://github.com/aurimasv/z2csl/tree/5750900e907b6730ccd724e23444ccc79d15f3f3", - // "place": "GitHub", - // "attachments": [], - // "tags": [], - // "notes": [], - // "seeAlso": [] - // } - // ] - // }, - // { - // "type": "web", - // "defer": true, - // "url": "https://github.com/zotero/translators/blob/eb4f39007e62d3d632448e184b1fd3671b3a1349/GitHub.js", - // "items": [ - // { - // "itemType": "computerProgram", - // "title": "GitHub.js", - // "creators": [ - // { - // "lastName": "zotero", - // "creatorType": "programmer", - // "fieldMode": 1 - // } - // ], - // "date": "2021-07-28T21:54:41Z", - // "versionNumber": "eb4f39007e62d3d632448e184b1fd3671b3a1349", - // "abstractNote": "Zotero Translators", - // "company": "Zotero", - // "extra": "original-date: 2011-07-03T17:40:38Z", - // "libraryCatalog": "GitHub", - // "programmingLanguage": "JavaScript", - // "place": "GitHub", - // "url": "https://github.com/zotero/translators/blob/eb4f39007e62d3d632448e184b1fd3671b3a1349/GitHub.js", - // "attachments": [], - // "tags": [], - // "notes": [], - // "seeAlso": [] - // } - // ] - // }, - // { - // "type": "web", - // "defer": true, - // "url": "https://github.com/citation-file-format/citation-file-format/tree/1.2.0", - // "items": [ - // { - // "itemType": "computerProgram", - // "title": "Citation File Format", - // "creators": [ - // { - // "firstName": "Stephan", - // "lastName": "Druskat", - // "creatorType": "author" - // }, - // { - // "firstName": "Jurriaan H.", - // "lastName": "Spaaks", - // "creatorType": "author" - // }, - // { - // "firstName": "Neil", - // "lastName": "Chue Hong", - // "creatorType": "author" - // }, - // { - // "firstName": "Robert", - // "lastName": "Haines", - // "creatorType": "author" - // }, - // { - // "firstName": "James", - // "lastName": "Baker", - // "creatorType": "author" - // }, - // { - // "firstName": "Spencer", - // "lastName": "Bliven", - // "creatorType": "author" - // }, - // { - // "firstName": "Egon", - // "lastName": "Willighagen", - // "creatorType": "author" - // }, - // { - // "firstName": "David", - // "lastName": "Pérez-Suárez", - // "creatorType": "author" - // }, - // { - // "firstName": "Olexandr", - // "lastName": "Konovalov", - // "creatorType": "author" - // } - // ], - // "date": "2021-08", - // "abstractNote": "CITATION.cff files are plain text files with human- and machine-readable citation information for software. Code developers can include them in their repositories to let others know how to correctly cite their software. This is the specification for the Citation File Format.", - // "extra": "DOI: 10.5281/zenodo.5171937", - // "libraryCatalog": "GitHub", - // "programmingLanguage": "Python", - // "rights": "CC-BY-4.0", - // "url": "https://github.com/citation-file-format/citation-file-format/tree/1.2.0", - // "versionNumber": "1.2.0", - // "place": "GitHub", - // "attachments": [], - // "tags": [ - // { - // "tag": "CFF" - // }, - // { - // "tag": "YAML" - // }, - // { - // "tag": "citation file format" - // }, - - // { - // "tag": "citation files" - // }, - // { - // "tag": "credit" - // }, - // { - // "tag": "file format" - // }, - // { - // "tag": "research software" - // }, - // { - // "tag": "software citation" - // }, - // { - // "tag": "software sustainability" - // } - // ], - // "notes": [], - // "seeAlso": [] - // } - // ] - // }, - // { - // "type": "web", - // "defer": true, - // "url": "https://github.com/citation-file-format/citation-file-format/blob/1.1.0/test/pytest.ini", - // "items": [ - // { - // "itemType": "computerProgram", - // "title": "pytest.ini", - // "creators": [ - // { - // "firstName": "Stephan", - // "lastName": "Druskat", - // "creatorType": "author" - // }, - // { - // "firstName": "Jurriaan H.", - // "lastName": "Spaaks", - // "creatorType": "author" - // }, - // { - // "firstName": "Neil", - // "lastName": "Chue Hong", - // "creatorType": "author" - // }, - // { - // "firstName": "Robert", - // "lastName": "Haines", - // "creatorType": "author" - // }, - // { - // "firstName": "James", - // "lastName": "Baker", - // "creatorType": "author" - // }, - // { - // "firstName": "Spencer", - // "lastName": "Bliven", - // "creatorType": "author" - // }, - // { - // "firstName": "Egon", - // "lastName": "Willighagen", - // "creatorType": "author" - // }, - // { - // "firstName": "David", - // "lastName": "Pérez-Suárez", - // "creatorType": "author" - // }, - // { - // "firstName": "Olexandr", - // "lastName": "Konovalov", - // "creatorType": "author" - // } - // ], - // "date": "2021-08", - // "abstractNote": "CITATION.cff files are plain text files with human- and machine-readable citation information for software. Code developers can include them in their repositories to let others know how to correctly cite their software. This is the specification for the Citation File Format.", - // "extra": "DOI: 10.5281/zenodo.5171937", - // "libraryCatalog": "GitHub", - // "programmingLanguage": "Python", - // "rights": "CC-BY-4.0", - // "url": "https://github.com/citation-file-format/citation-file-format/blob/1.1.0/test/pytest.ini", - // "versionNumber": "1.1.0", - // "place": "GitHub", - // "attachments": [], - // "tags": [ - // { - // "tag": "CFF" - // }, - // { - // "tag": "YAML" - // }, - // { - // "tag": "citation file format" - // }, - - // { - // "tag": "citation files" - // }, - // { - // "tag": "credit" - // }, - // { - // "tag": "file format" - // }, - // { - // "tag": "research software" - // }, - // { - // "tag": "software citation" - // }, - // { - // "tag": "software sustainability" - // } - // ], - // "notes": [], - // "seeAlso": [] - // } - // ] - // }, - // { - // "type": "web", - // "defer": true, - // "url": "https://github.com/pulipulichen/PTS-Local-News-Dataset/tree/20250105-0131", - // "items": [ - // { - // "itemType": "dataset", - // "title": "PTS-Local-News-Dataset", - // "creators": [ - // { - // "firstName": "Yung-Ting", - // "lastName": "Chen", - // "creatorType": "author" - // } - // ], - // "date": "2025-01-04T17:28:41Z", - // "abstractNote": "A dataset containing local news from Taiwan Public Television Service.", - // "extra": "DOI: 10.5281/zenodo.14598063", - // "libraryCatalog": "GitHub", - // "DOI": "10.5281/zenodo.14598063", - // "rights": "MIT", - // "url": "https://github.com/pulipulichen/PTS-Local-News-Dataset", - // "versionNumber": "20250105-0131", - // "repositoryLocation": "GitHub", - // "attachments": [], - // "tags": [ - // { - // "tag": "dataset" - // }, - // { - // "tag": "news" - // }, - // { - // "tag": "PTS" - // } - // ], - // "notes": [], - // "seeAlso": [] - // } - // ] - // } -] +]; /** END TEST CASES **/ From 667e9931294b7f5b53d34e6e7a7f67b1a5362469 Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 18:39:25 +0800 Subject: [PATCH 39/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2018=E6=99=8239?= =?UTF-8?q?=E5=88=8625=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 422 +----------------------------------------------------- 1 file changed, 1 insertion(+), 421 deletions(-) diff --git a/GitHub.js b/GitHub.js index c76959e7d24..d910f338cf2 100644 --- a/GitHub.js +++ b/GitHub.js @@ -437,426 +437,6 @@ var testCases = [ "seeAlso": [] } ] - }, - { - "type": "web", - "url": "https://github.com/search?utf8=%E2%9C%93&q=topic%3Ahocr&type=repositories", - "defer": true, - "items": "multiple" - }, - { - "type": "web", - "url": "https://github.com/datacite/schema/tree/4.6.0", - "items": [ - { - "itemType": "computerProgram", - "title": "DataCite Schema Repository", - "creators": [ - { - "lastName": "datacite", - "creatorType": "programmer", - "fieldMode": 1 - } - ], - "date": "2024-12-05T18:31:38Z", - "abstractNote": "DataCite Metadata Schema Repository", - "company": "DataCite", - "extra": "original-date: 2011-04-13T07:08:41Z", - "libraryCatalog": "GitHub", - "programmingLanguage": "Ruby", - "url": "https://github.com/datacite/schema/tree/4.6.0", - "versionNumber": "4.6.0", - "place": "GitHub", - "attachments": [], - "tags": [], - "notes": [], - "seeAlso": [] - } - ] - }, - { - "type": "web", - "url": "https://github.com/datacite/schema/blob/4.6.0/.dockerignore", - "items": [ - { - "itemType": "computerProgram", - "title": ".dockerignore", - "creators": [ - { - "lastName": "datacite", - "creatorType": "programmer", - "fieldMode": 1 - } - ], - "date": "2024-12-05T18:31:38Z", - "abstractNote": "DataCite Metadata Schema Repository", - "company": "DataCite", - "extra": "original-date: 2011-04-13T07:08:41Z", - "libraryCatalog": "GitHub", - "programmingLanguage": "Ruby", - "url": "https://github.com/datacite/schema/blob/4.6.0/.dockerignore", - "versionNumber": "4.6.0", - "place": "GitHub", - "attachments": [], - "tags": [], - "notes": [], - "seeAlso": [] - } - ] - }, - { - "type": "web", - "url": "https://github.com/mittagessen/kraken/tree/4.1.2", - "items": [ - { - "itemType": "computerProgram", - "title": "The Kraken OCR system", - "creators": [ - { - "firstName": "Benjamin", - "lastName": "Kiessling", - "creatorType": "author" - } - ], - "date": "2022-04", - "abstractNote": "OCR engine for all the languages", - "extra": "original-date: 2015-05-19T09:24:38Z", - "libraryCatalog": "GitHub", - "programmingLanguage": "Python", - "versionNumber": "4.1.2", - "place": "GitHub", - "rights": "Apache-2.0", - "url": "https://kraken.re", - "attachments": [], - "tags": [ - { - "tag": "alto-xml" - }, - { - "tag": "handwritten-text-recognition" - }, - { - "tag": "hocr" - }, - { - "tag": "htr" - }, - { - "tag": "layout-analysis" - }, - { - "tag": "optical-character-recognition" - }, - { - "tag": "neural-networks" - }, - { - "tag": "ocr" - }, - { - "tag": "page-xml" - } - ], - "notes": [], - "seeAlso": [] - } - ] - }, - { - "type": "web", - "url": "https://github.com/aurimasv/z2csl/tree/5750900e907b6730ccd724e23444ccc79d15f3f3", - "items": [ - { - "itemType": "computerProgram", - "title": "z2csl - Zotero to CSL extension and mappings", - "creators": [ - { - "firstName": "Aurimas", - "lastName": "Vinckevicius", - "creatorType": "programmer" - } - ], - "date": "2022-07-14T16:14:40Z", - "abstractNote": "Zotero extension for creating Zotero to CSL item type and field mappings.", - "extra": "original-date: 2012-05-20T07:53:58Z", - "libraryCatalog": "GitHub", - "programmingLanguage": "JavaScript", - "versionNumber": "5750900e907b6730ccd724e23444ccc79d15f3f3", - "url": "https://github.com/aurimasv/z2csl/tree/5750900e907b6730ccd724e23444ccc79d15f3f3", - "place": "GitHub", - "attachments": [], - "tags": [], - "notes": [], - "seeAlso": [] - } - ] - }, - { - "type": "web", - "url": "https://github.com/zotero/translators/blob/eb4f39007e62d3d632448e184b1fd3671b3a1349/GitHub.js", - "items": [ - { - "itemType": "computerProgram", - "title": "GitHub.js", - "creators": [ - { - "lastName": "zotero", - "creatorType": "programmer", - "fieldMode": 1 - } - ], - "date": "2021-07-28T21:54:41Z", - "versionNumber": "eb4f39007e62d3d632448e184b1fd3671b3a1349", - "abstractNote": "Zotero Translators", - "company": "Zotero", - "extra": "original-date: 2011-07-03T17:40:38Z", - "libraryCatalog": "GitHub", - "programmingLanguage": "JavaScript", - "place": "GitHub", - "url": "https://github.com/zotero/translators/blob/eb4f39007e62d3d632448e184b1fd3671b3a1349/GitHub.js", - "attachments": [], - "tags": [], - "notes": [], - "seeAlso": [] - } - ] - }, - { - "type": "web", - "url": "https://github.com/citation-file-format/citation-file-format/tree/1.2.0", - "items": [ - { - "itemType": "computerProgram", - "title": "Citation File Format", - "creators": [ - { - "firstName": "Stephan", - "lastName": "Druskat", - "creatorType": "author" - }, - { - "firstName": "Jurriaan H.", - "lastName": "Spaaks", - "creatorType": "author" - }, - { - "firstName": "Neil", - "lastName": "Chue Hong", - "creatorType": "author" - }, - { - "firstName": "Robert", - "lastName": "Haines", - "creatorType": "author" - }, - { - "firstName": "James", - "lastName": "Baker", - "creatorType": "author" - }, - { - "firstName": "Spencer", - "lastName": "Bliven", - "creatorType": "author" - }, - { - "firstName": "Egon", - "lastName": "Willighagen", - "creatorType": "author" - }, - { - "firstName": "David", - "lastName": "Pérez-Suárez", - "creatorType": "author" - }, - { - "firstName": "Olexandr", - "lastName": "Konovalov", - "creatorType": "author" - } - ], - "date": "2021-08", - "abstractNote": "CITATION.cff files are plain text files with human- and machine-readable citation information for software. Code developers can include them in their repositories to let others know how to correctly cite their software. This is the specification for the Citation File Format.", - "extra": "DOI: 10.5281/zenodo.5171937", - "libraryCatalog": "GitHub", - "programmingLanguage": "Python", - "rights": "CC-BY-4.0", - "url": "https://github.com/citation-file-format/citation-file-format/tree/1.2.0", - "versionNumber": "1.2.0", - "place": "GitHub", - "attachments": [], - "tags": [ - { - "tag": "CFF" - }, - { - "tag": "YAML" - }, - { - "tag": "citation file format" - }, - - { - "tag": "citation files" - }, - { - "tag": "credit" - }, - { - "tag": "file format" - }, - { - "tag": "research software" - }, - { - "tag": "software citation" - }, - { - "tag": "software sustainability" - } - ], - "notes": [], - "seeAlso": [] - } - ] - }, - { - "type": "web", - "url": "https://github.com/citation-file-format/citation-file-format/blob/1.1.0/test/pytest.ini", - "items": [ - { - "itemType": "computerProgram", - "title": "pytest.ini", - "creators": [ - { - "firstName": "Stephan", - "lastName": "Druskat", - "creatorType": "author" - }, - { - "firstName": "Jurriaan H.", - "lastName": "Spaaks", - "creatorType": "author" - }, - { - "firstName": "Neil", - "lastName": "Chue Hong", - "creatorType": "author" - }, - { - "firstName": "Robert", - "lastName": "Haines", - "creatorType": "author" - }, - { - "firstName": "James", - "lastName": "Baker", - "creatorType": "author" - }, - { - "firstName": "Spencer", - "lastName": "Bliven", - "creatorType": "author" - }, - { - "firstName": "Egon", - "lastName": "Willighagen", - "creatorType": "author" - }, - { - "firstName": "David", - "lastName": "Pérez-Suárez", - "creatorType": "author" - }, - { - "firstName": "Olexandr", - "lastName": "Konovalov", - "creatorType": "author" - } - ], - "date": "2021-08", - "abstractNote": "CITATION.cff files are plain text files with human- and machine-readable citation information for software. Code developers can include them in their repositories to let others know how to correctly cite their software. This is the specification for the Citation File Format.", - "extra": "DOI: 10.5281/zenodo.5171937", - "libraryCatalog": "GitHub", - "programmingLanguage": "Python", - "rights": "CC-BY-4.0", - "url": "https://github.com/citation-file-format/citation-file-format/blob/1.1.0/test/pytest.ini", - "versionNumber": "1.1.0", - "place": "GitHub", - "attachments": [], - "tags": [ - { - "tag": "CFF" - }, - { - "tag": "YAML" - }, - { - "tag": "citation file format" - }, - - { - "tag": "citation files" - }, - { - "tag": "credit" - }, - { - "tag": "file format" - }, - { - "tag": "research software" - }, - { - "tag": "software citation" - }, - { - "tag": "software sustainability" - } - ], - "notes": [], - "seeAlso": [] - } - ] - }, - { - "type": "web", - "url": "https://github.com/pulipulichen/PTS-Local-News-Dataset/tree/20250105-0131", - "items": [ - { - "itemType": "dataset", - "title": "PTS-Local-News-Dataset", - "creators": [ - { - "firstName": "Yung-Ting", - "lastName": "Chen", - "creatorType": "author" - } - ], - "date": "2025-01-04T17:28:41Z", - "abstractNote": "A dataset containing local news from Taiwan Public Television Service.", - "extra": "DOI: 10.5281/zenodo.14598063", - "libraryCatalog": "GitHub", - "DOI": "10.5281/zenodo.14598063", - "rights": "MIT", - "url": "https://github.com/pulipulichen/PTS-Local-News-Dataset", - "versionNumber": "20250105-0131", - "attachments": [], - "tags": [ - { - "tag": "dataset" - }, - { - "tag": "news" - }, - { - "tag": "PTS" - } - ], - "notes": [], - "seeAlso": [] - } - ] } -]; +] /** END TEST CASES **/ From cd4d2924410d24c65e06541b4abb3396030403d5 Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 18:40:41 +0800 Subject: [PATCH 40/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2018=E6=99=8240?= =?UTF-8?q?=E5=88=8641=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 1 + 1 file changed, 1 insertion(+) diff --git a/GitHub.js b/GitHub.js index d910f338cf2..0e624739418 100644 --- a/GitHub.js +++ b/GitHub.js @@ -409,6 +409,7 @@ function extractKeywords(yamlContent) { var testCases = [ { "type": "web", + "defer": true, "url": "https://github.com/zotero/zotero/tree/0a6095322668908f243a536a4e43911d80f76b75", "items": [ { From 60781c80cb6e5a4ae5d42d846aa0932938a88890 Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 18:43:01 +0800 Subject: [PATCH 41/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2018=E6=99=8243?= =?UTF-8?q?=E5=88=8601=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/GitHub.js b/GitHub.js index 0e624739418..d3b323ac2d2 100644 --- a/GitHub.js +++ b/GitHub.js @@ -61,25 +61,27 @@ async function detectWeb(doc, url) { return false; } - return new Promise(function (resolve) { - ZU.doGet(`https://raw.githubusercontent.com/${path}/HEAD/CITATION.cff`, function (cffText, xhr) { - if (xhr.status !== 200) { - return resolve("computerProgram"); - } - try { - let type = searchFieldValue(cffText, "type"); - if (type && type === 'dataset') { - return resolve(type); - } - } - catch (e) { - console.error(`CITATION.cff format is invalid: - -${cffText}`); - } - return resolve("computerProgram"); - }, null, null, { 'X-Requested-With': 'XMLHttpRequest' }, false); - }); + return "computerProgram"; + +// return new Promise(function (resolve) { +// ZU.doGet(`https://raw.githubusercontent.com/${path}/HEAD/CITATION.cff`, function (cffText, xhr) { +// if (xhr.status !== 200) { +// return resolve("computerProgram"); +// } +// try { +// let type = searchFieldValue(cffText, "type"); +// if (type && type === 'dataset') { +// return resolve(type); +// } +// } +// catch (e) { +// console.error(`CITATION.cff format is invalid: + +// ${cffText}`); +// } +// return resolve("computerProgram"); +// }, null, null, { 'X-Requested-With': 'XMLHttpRequest' }, false); +// }); } From fa943abb921fd4a78e35cc9c99aa379a6f18666d Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 18:46:14 +0800 Subject: [PATCH 42/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2018=E6=99=8246?= =?UTF-8?q?=E5=88=8614=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GitHub.js b/GitHub.js index d3b323ac2d2..87d7dc0d7a7 100644 --- a/GitHub.js +++ b/GitHub.js @@ -33,7 +33,7 @@ const apiUrl = "https://api.github.com/"; -async function detectWeb(doc, url) { +function detectWeb(doc, url) { if (url.includes("/search?")) { var rows = doc.querySelectorAll('[data-testid="results-list"] .search-title a'); if (rows.length > 0) { From 80878ce9e99b4270cc43ee5139b1d92a4ff0cd98 Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 18:52:05 +0800 Subject: [PATCH 43/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2018=E6=99=8252?= =?UTF-8?q?=E5=88=8605=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 472 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 449 insertions(+), 23 deletions(-) diff --git a/GitHub.js b/GitHub.js index 87d7dc0d7a7..4b8a8d041d9 100644 --- a/GitHub.js +++ b/GitHub.js @@ -33,7 +33,7 @@ const apiUrl = "https://api.github.com/"; -function detectWeb(doc, url) { +async function detectWeb(doc, url) { if (url.includes("/search?")) { var rows = doc.querySelectorAll('[data-testid="results-list"] .search-title a'); if (rows.length > 0) { @@ -61,27 +61,25 @@ function detectWeb(doc, url) { return false; } - return "computerProgram"; - -// return new Promise(function (resolve) { -// ZU.doGet(`https://raw.githubusercontent.com/${path}/HEAD/CITATION.cff`, function (cffText, xhr) { -// if (xhr.status !== 200) { -// return resolve("computerProgram"); -// } -// try { -// let type = searchFieldValue(cffText, "type"); -// if (type && type === 'dataset') { -// return resolve(type); -// } -// } -// catch (e) { -// console.error(`CITATION.cff format is invalid: - -// ${cffText}`); -// } -// return resolve("computerProgram"); -// }, null, null, { 'X-Requested-With': 'XMLHttpRequest' }, false); -// }); + return new Promise(function (resolve) { + ZU.doGet(`https://raw.githubusercontent.com/${path}/HEAD/CITATION.cff`, function (cffText, xhr) { + if (xhr.status !== 200) { + return resolve("computerProgram"); + } + try { + let type = searchFieldValue(cffText, "type"); + if (type && type === 'dataset') { + return resolve(type); + } + } + catch (e) { + console.error(`CITATION.cff format is invalid: + +${cffText}`); + } + return resolve("computerProgram"); + }, null, null, { 'X-Requested-With': 'XMLHttpRequest' }, false); + }); } @@ -411,8 +409,8 @@ function extractKeywords(yamlContent) { var testCases = [ { "type": "web", - "defer": true, "url": "https://github.com/zotero/zotero/tree/0a6095322668908f243a536a4e43911d80f76b75", + "defer": true, "items": [ { "itemType": "computerProgram", @@ -440,6 +438,434 @@ var testCases = [ "seeAlso": [] } ] + }, + { + "type": "web", + "url": "https://github.com/search?utf8=%E2%9C%93&q=topic%3Ahocr&type=repositories", + "defer": true, + "items": "multiple" + }, + { + "type": "web", + "url": "https://github.com/datacite/schema/tree/4.6.0", + "defer": true, + "items": [ + { + "itemType": "computerProgram", + "title": "DataCite Schema Repository", + "creators": [ + { + "lastName": "datacite", + "creatorType": "programmer", + "fieldMode": 1 + } + ], + "date": "2024-12-05T18:31:38Z", + "abstractNote": "DataCite Metadata Schema Repository", + "company": "DataCite", + "extra": "original-date: 2011-04-13T07:08:41Z", + "libraryCatalog": "GitHub", + "programmingLanguage": "Ruby", + "url": "https://github.com/datacite/schema/tree/4.6.0", + "versionNumber": "4.6.0", + "place": "GitHub", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://github.com/datacite/schema/blob/4.6.0/.dockerignore", + "defer": true, + "items": [ + { + "itemType": "computerProgram", + "title": ".dockerignore", + "creators": [ + { + "lastName": "datacite", + "creatorType": "programmer", + "fieldMode": 1 + } + ], + "date": "2024-12-05T18:31:38Z", + "abstractNote": "DataCite Metadata Schema Repository", + "company": "DataCite", + "extra": "original-date: 2011-04-13T07:08:41Z", + "libraryCatalog": "GitHub", + "programmingLanguage": "Ruby", + "url": "https://github.com/datacite/schema/blob/4.6.0/.dockerignore", + "versionNumber": "4.6.0", + "place": "GitHub", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://github.com/mittagessen/kraken/tree/4.1.2", + "defer": true, + "items": [ + { + "itemType": "computerProgram", + "title": "The Kraken OCR system", + "creators": [ + { + "firstName": "Benjamin", + "lastName": "Kiessling", + "creatorType": "author" + } + ], + "date": "2022-04", + "abstractNote": "OCR engine for all the languages", + "extra": "original-date: 2015-05-19T09:24:38Z", + "libraryCatalog": "GitHub", + "programmingLanguage": "Python", + "versionNumber": "4.1.2", + "place": "GitHub", + "rights": "Apache-2.0", + "url": "https://kraken.re", + "attachments": [], + "tags": [ + { + "tag": "alto-xml" + }, + { + "tag": "handwritten-text-recognition" + }, + { + "tag": "hocr" + }, + { + "tag": "htr" + }, + { + "tag": "layout-analysis" + }, + { + "tag": "optical-character-recognition" + }, + { + "tag": "neural-networks" + }, + { + "tag": "ocr" + }, + { + "tag": "page-xml" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://github.com/aurimasv/z2csl/tree/5750900e907b6730ccd724e23444ccc79d15f3f3", + "defer": true, + "items": [ + { + "itemType": "computerProgram", + "title": "z2csl - Zotero to CSL extension and mappings", + "creators": [ + { + "firstName": "Aurimas", + "lastName": "Vinckevicius", + "creatorType": "programmer" + } + ], + "date": "2022-07-14T16:14:40Z", + "abstractNote": "Zotero extension for creating Zotero to CSL item type and field mappings.", + "extra": "original-date: 2012-05-20T07:53:58Z", + "libraryCatalog": "GitHub", + "programmingLanguage": "JavaScript", + "versionNumber": "5750900e907b6730ccd724e23444ccc79d15f3f3", + "url": "https://github.com/aurimasv/z2csl/tree/5750900e907b6730ccd724e23444ccc79d15f3f3", + "place": "GitHub", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://github.com/zotero/translators/blob/eb4f39007e62d3d632448e184b1fd3671b3a1349/GitHub.js", + "defer": true, + "items": [ + { + "itemType": "computerProgram", + "title": "GitHub.js", + "creators": [ + { + "lastName": "zotero", + "creatorType": "programmer", + "fieldMode": 1 + } + ], + "date": "2021-07-28T21:54:41Z", + "versionNumber": "eb4f39007e62d3d632448e184b1fd3671b3a1349", + "abstractNote": "Zotero Translators", + "company": "Zotero", + "extra": "original-date: 2011-07-03T17:40:38Z", + "libraryCatalog": "GitHub", + "programmingLanguage": "JavaScript", + "place": "GitHub", + "url": "https://github.com/zotero/translators/blob/eb4f39007e62d3d632448e184b1fd3671b3a1349/GitHub.js", + "attachments": [], + "tags": [], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://github.com/citation-file-format/citation-file-format/tree/1.2.0", + "defer": true, + "items": [ + { + "itemType": "computerProgram", + "title": "Citation File Format", + "creators": [ + { + "firstName": "Stephan", + "lastName": "Druskat", + "creatorType": "author" + }, + { + "firstName": "Jurriaan H.", + "lastName": "Spaaks", + "creatorType": "author" + }, + { + "firstName": "Neil", + "lastName": "Chue Hong", + "creatorType": "author" + }, + { + "firstName": "Robert", + "lastName": "Haines", + "creatorType": "author" + }, + { + "firstName": "James", + "lastName": "Baker", + "creatorType": "author" + }, + { + "firstName": "Spencer", + "lastName": "Bliven", + "creatorType": "author" + }, + { + "firstName": "Egon", + "lastName": "Willighagen", + "creatorType": "author" + }, + { + "firstName": "David", + "lastName": "Pérez-Suárez", + "creatorType": "author" + }, + { + "firstName": "Olexandr", + "lastName": "Konovalov", + "creatorType": "author" + } + ], + "date": "2021-08", + "abstractNote": "CITATION.cff files are plain text files with human- and machine-readable citation information for software. Code developers can include them in their repositories to let others know how to correctly cite their software. This is the specification for the Citation File Format.", + "extra": "DOI: 10.5281/zenodo.5171937", + "libraryCatalog": "GitHub", + "programmingLanguage": "Python", + "rights": "CC-BY-4.0", + "url": "https://github.com/citation-file-format/citation-file-format/tree/1.2.0", + "versionNumber": "1.2.0", + "place": "GitHub", + "attachments": [], + "tags": [ + { + "tag": "CFF" + }, + { + "tag": "YAML" + }, + { + "tag": "citation file format" + }, + + { + "tag": "citation files" + }, + { + "tag": "credit" + }, + { + "tag": "file format" + }, + { + "tag": "research software" + }, + { + "tag": "software citation" + }, + { + "tag": "software sustainability" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://github.com/citation-file-format/citation-file-format/blob/1.1.0/test/pytest.ini", + "defer": true, + "items": [ + { + "itemType": "computerProgram", + "title": "pytest.ini", + "creators": [ + { + "firstName": "Stephan", + "lastName": "Druskat", + "creatorType": "author" + }, + { + "firstName": "Jurriaan H.", + "lastName": "Spaaks", + "creatorType": "author" + }, + { + "firstName": "Neil", + "lastName": "Chue Hong", + "creatorType": "author" + }, + { + "firstName": "Robert", + "lastName": "Haines", + "creatorType": "author" + }, + { + "firstName": "James", + "lastName": "Baker", + "creatorType": "author" + }, + { + "firstName": "Spencer", + "lastName": "Bliven", + "creatorType": "author" + }, + { + "firstName": "Egon", + "lastName": "Willighagen", + "creatorType": "author" + }, + { + "firstName": "David", + "lastName": "Pérez-Suárez", + "creatorType": "author" + }, + { + "firstName": "Olexandr", + "lastName": "Konovalov", + "creatorType": "author" + } + ], + "date": "2021-08", + "abstractNote": "CITATION.cff files are plain text files with human- and machine-readable citation information for software. Code developers can include them in their repositories to let others know how to correctly cite their software. This is the specification for the Citation File Format.", + "extra": "DOI: 10.5281/zenodo.5171937", + "libraryCatalog": "GitHub", + "programmingLanguage": "Python", + "rights": "CC-BY-4.0", + "url": "https://github.com/citation-file-format/citation-file-format/blob/1.1.0/test/pytest.ini", + "versionNumber": "1.1.0", + "place": "GitHub", + "attachments": [], + "tags": [ + { + "tag": "CFF" + }, + { + "tag": "YAML" + }, + { + "tag": "citation file format" + }, + + { + "tag": "citation files" + }, + { + "tag": "credit" + }, + { + "tag": "file format" + }, + { + "tag": "research software" + }, + { + "tag": "software citation" + }, + { + "tag": "software sustainability" + } + ], + "notes": [], + "seeAlso": [] + } + ] + }, + { + "type": "web", + "url": "https://github.com/pulipulichen/PTS-Local-News-Dataset/tree/20250105-0131", + "defer": true, + "items": [ + { + "itemType": "dataset", + "title": "PTS-Local-News-Dataset", + "creators": [ + { + "firstName": "Yung-Ting", + "lastName": "Chen", + "creatorType": "author" + } + ], + "date": "2025-01-04T17:28:41Z", + "abstractNote": "A dataset containing local news from Taiwan Public Television Service.", + "extra": "DOI: 10.5281/zenodo.14598063", + "libraryCatalog": "GitHub", + "DOI": "10.5281/zenodo.14598063", + "rights": "MIT", + "url": "https://github.com/pulipulichen/PTS-Local-News-Dataset", + "versionNumber": "20250105-0131", + "attachments": [], + "tags": [ + { + "tag": "dataset" + }, + { + "tag": "news" + }, + { + "tag": "PTS" + } + ], + "notes": [], + "seeAlso": [] + } + ] } ] /** END TEST CASES **/ From 53c5455376007e4fce96356eae107a5a4313e973 Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 19:07:26 +0800 Subject: [PATCH 44/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2019=E6=99=8207?= =?UTF-8?q?=E5=88=8626=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/GitHub.js b/GitHub.js index 4b8a8d041d9..fb166e26522 100644 --- a/GitHub.js +++ b/GitHub.js @@ -411,6 +411,7 @@ var testCases = [ "type": "web", "url": "https://github.com/zotero/zotero/tree/0a6095322668908f243a536a4e43911d80f76b75", "defer": true, + "detectedItemType": false, "items": [ { "itemType": "computerProgram", @@ -443,12 +444,14 @@ var testCases = [ "type": "web", "url": "https://github.com/search?utf8=%E2%9C%93&q=topic%3Ahocr&type=repositories", "defer": true, + "detectedItemType": false, "items": "multiple" }, { "type": "web", "url": "https://github.com/datacite/schema/tree/4.6.0", "defer": true, + "detectedItemType": false, "items": [ { "itemType": "computerProgram", @@ -480,6 +483,7 @@ var testCases = [ "type": "web", "url": "https://github.com/datacite/schema/blob/4.6.0/.dockerignore", "defer": true, + "detectedItemType": false, "items": [ { "itemType": "computerProgram", @@ -511,6 +515,7 @@ var testCases = [ "type": "web", "url": "https://github.com/mittagessen/kraken/tree/4.1.2", "defer": true, + "detectedItemType": false, "items": [ { "itemType": "computerProgram", @@ -570,6 +575,7 @@ var testCases = [ "type": "web", "url": "https://github.com/aurimasv/z2csl/tree/5750900e907b6730ccd724e23444ccc79d15f3f3", "defer": true, + "detectedItemType": false, "items": [ { "itemType": "computerProgram", @@ -600,6 +606,7 @@ var testCases = [ "type": "web", "url": "https://github.com/zotero/translators/blob/eb4f39007e62d3d632448e184b1fd3671b3a1349/GitHub.js", "defer": true, + "detectedItemType": false, "items": [ { "itemType": "computerProgram", @@ -631,6 +638,7 @@ var testCases = [ "type": "web", "url": "https://github.com/citation-file-format/citation-file-format/tree/1.2.0", "defer": true, + "detectedItemType": false, "items": [ { "itemType": "computerProgram", @@ -731,6 +739,7 @@ var testCases = [ "type": "web", "url": "https://github.com/citation-file-format/citation-file-format/blob/1.1.0/test/pytest.ini", "defer": true, + "detectedItemType": false, "items": [ { "itemType": "computerProgram", @@ -831,6 +840,7 @@ var testCases = [ "type": "web", "url": "https://github.com/pulipulichen/PTS-Local-News-Dataset/tree/20250105-0131", "defer": true, + "detectedItemType": false, "items": [ { "itemType": "dataset", From c6704e75bf35d03d69e6e6ecae93b8076e63e3ec Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 19:11:24 +0800 Subject: [PATCH 45/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2019=E6=99=8211?= =?UTF-8?q?=E5=88=8624=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/GitHub.js b/GitHub.js index fb166e26522..2b637d4247c 100644 --- a/GitHub.js +++ b/GitHub.js @@ -483,7 +483,6 @@ var testCases = [ "type": "web", "url": "https://github.com/datacite/schema/blob/4.6.0/.dockerignore", "defer": true, - "detectedItemType": false, "items": [ { "itemType": "computerProgram", @@ -606,7 +605,6 @@ var testCases = [ "type": "web", "url": "https://github.com/zotero/translators/blob/eb4f39007e62d3d632448e184b1fd3671b3a1349/GitHub.js", "defer": true, - "detectedItemType": false, "items": [ { "itemType": "computerProgram", @@ -739,7 +737,6 @@ var testCases = [ "type": "web", "url": "https://github.com/citation-file-format/citation-file-format/blob/1.1.0/test/pytest.ini", "defer": true, - "detectedItemType": false, "items": [ { "itemType": "computerProgram", From 3c6acfaf76bdd2c118cdac238b4d1ee20799cac9 Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 19:16:27 +0800 Subject: [PATCH 46/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2019=E6=99=8216?= =?UTF-8?q?=E5=88=8627=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GitHub.js b/GitHub.js index 2b637d4247c..6fc655c6cdf 100644 --- a/GitHub.js +++ b/GitHub.js @@ -426,7 +426,7 @@ var testCases = [ "version": "0a6095322668908f243a536a4e43911d80f76b75", "date": "2024-12-06T09:38:01Z", "abstractNote": "Zotero is a free, easy-to-use tool to help you collect, organize, annotate, cite, and share your research sources.", - "company": "Zotero", + "company": "Zoteroaaaaa", "extra": "original-date: 2011-10-27T07:46:48Z", "libraryCatalog": "GitHub", "programmingLanguage": "JavaScript", From a27a8d8327282d3011d4b9ea5d0ce8c0d23ddc07 Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 20:23:04 +0800 Subject: [PATCH 47/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2020=E6=99=8223?= =?UTF-8?q?=E5=88=8604=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/GitHub.js b/GitHub.js index 6fc655c6cdf..c77ed9d2bf4 100644 --- a/GitHub.js +++ b/GitHub.js @@ -410,7 +410,6 @@ var testCases = [ { "type": "web", "url": "https://github.com/zotero/zotero/tree/0a6095322668908f243a536a4e43911d80f76b75", - "defer": true, "detectedItemType": false, "items": [ { @@ -426,7 +425,7 @@ var testCases = [ "version": "0a6095322668908f243a536a4e43911d80f76b75", "date": "2024-12-06T09:38:01Z", "abstractNote": "Zotero is a free, easy-to-use tool to help you collect, organize, annotate, cite, and share your research sources.", - "company": "Zoteroaaaaa", + "company": "Zotero", "extra": "original-date: 2011-10-27T07:46:48Z", "libraryCatalog": "GitHub", "programmingLanguage": "JavaScript", From fc446b380fc1a9aa143c8e723827ba88abcefa06 Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 22:51:19 +0800 Subject: [PATCH 48/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2022=E6=99=8251?= =?UTF-8?q?=E5=88=8619=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GitHub.js b/GitHub.js index c77ed9d2bf4..a23ba1253a6 100644 --- a/GitHub.js +++ b/GitHub.js @@ -425,7 +425,7 @@ var testCases = [ "version": "0a6095322668908f243a536a4e43911d80f76b75", "date": "2024-12-06T09:38:01Z", "abstractNote": "Zotero is a free, easy-to-use tool to help you collect, organize, annotate, cite, and share your research sources.", - "company": "Zotero", + "company": "ZoteroAAA", "extra": "original-date: 2011-10-27T07:46:48Z", "libraryCatalog": "GitHub", "programmingLanguage": "JavaScript", From 8885aacc1f8d5252beedca17ecf2adc970d329d6 Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 22:54:50 +0800 Subject: [PATCH 49/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2022=E6=99=8254?= =?UTF-8?q?=E5=88=8650=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 1 - 1 file changed, 1 deletion(-) diff --git a/GitHub.js b/GitHub.js index a23ba1253a6..55a589a24ab 100644 --- a/GitHub.js +++ b/GitHub.js @@ -410,7 +410,6 @@ var testCases = [ { "type": "web", "url": "https://github.com/zotero/zotero/tree/0a6095322668908f243a536a4e43911d80f76b75", - "detectedItemType": false, "items": [ { "itemType": "computerProgram", From 331fb7b76cd646f7cec0716813517c6e59865d7d Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 22:58:54 +0800 Subject: [PATCH 50/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2022=E6=99=8258?= =?UTF-8?q?=E5=88=8654=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 234 +++++++++++++++++------------------------------------- 1 file changed, 73 insertions(+), 161 deletions(-) diff --git a/GitHub.js b/GitHub.js index 55a589a24ab..bb6ca27d3fb 100644 --- a/GitHub.js +++ b/GitHub.js @@ -13,7 +13,7 @@ } /** - Copyright (c) 2017-2025 Martin Fenner, Philipp Zumstein, Yung-Ting Chen + Copyright (c) 2017-2021 Martin Fenner, Philipp Zumstein This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License @@ -33,10 +33,9 @@ const apiUrl = "https://api.github.com/"; -async function detectWeb(doc, url) { +function detectWeb(doc, url) { if (url.includes("/search?")) { - var rows = doc.querySelectorAll('[data-testid="results-list"] .search-title a'); - if (rows.length > 0) { + if (getSearchResults(doc, true)) { return "multiple"; } } @@ -47,39 +46,18 @@ async function detectWeb(doc, url) { } // `og:title` is messed up when browsing a file. - let ogURL = attr(doc, 'meta[property="og:url"]', 'content'); - if (ogURL.includes('/blob/') || url.startsWith(ogURL + '/blob/')) { + let ogTitle = attr(doc, 'meta[property="og:url"]', 'content'); + if (ogTitle.includes('/blob/') || url.startsWith(ogTitle + '/blob/')) { return "computerProgram"; } - let ogTitle = attr(doc, 'meta[property="og:title"]', 'content'); - let path = url.split('/').slice(3, 5).join('/'); - let repo = url.split('/').slice(4, 5)[0]; - if (!ogTitle.startsWith(path) && !ogTitle.startsWith(repo + '/')) { + if (!/^(GitHub - )?[^/\s]+\/[^/\s]+(: .*)?$/.test(attr(doc, 'meta[property="og:title"]', 'content')) && !/^(GitHub - )?[^/\s]+\/[^/\s]+( .*)?$/.test(attr(doc, 'meta[property="og:title"]', 'content'))) { // and anything without a repo name (abc/xyz) as its og:title. // deals with repo pages that we can't scrape, like GitHub Discussions. return false; } - return new Promise(function (resolve) { - ZU.doGet(`https://raw.githubusercontent.com/${path}/HEAD/CITATION.cff`, function (cffText, xhr) { - if (xhr.status !== 200) { - return resolve("computerProgram"); - } - try { - let type = searchFieldValue(cffText, "type"); - if (type && type === 'dataset') { - return resolve(type); - } - } - catch (e) { - console.error(`CITATION.cff format is invalid: - -${cffText}`); - } - return resolve("computerProgram"); - }, null, null, { 'X-Requested-With': 'XMLHttpRequest' }, false); - }); + return "computerProgram"; } @@ -99,8 +77,8 @@ function getSearchResults(doc, checkOnly) { } -async function doWeb(doc, url) { - if (await detectWeb(doc, url) == "multiple") { +function doWeb(doc, url) { + if (detectWeb(doc, url) == "multiple") { Zotero.selectItems(getSearchResults(doc, false), function (items) { if (!items) { return; @@ -162,14 +140,11 @@ function scrape(doc, url) { } let latestCommitLink = attr(doc, 'link[rel="canonical"]', 'href'); - if (!latestCommitLink && url.includes('/blob/') === false) { - latestCommitLink = attr(doc, '[data-testid="latest-commit-html"] a', 'href'); - } if (!latestCommitLink) { - latestCommitLink = attr(doc, '[data-testid="breadcrumbs-repo-link"]', 'href'); + latestCommitLink = attr(doc, '[data-testid="latest-commit-html"] a', 'href'); } let commitHash = false; - if (latestCommitLink.includes('/') && latestCommitLink.endsWith(githubRepository) === false) { + if (latestCommitLink.includes('/')) { commitHash = latestCommitLink.split('/').pop(); } @@ -198,6 +173,7 @@ function scrape(doc, url) { if (canonical) { item.url = canonical; } + ZU.doGet(apiUrl + "repos/" + githubRepository + "/commits/" + commitHash, function (result) { var commitData = JSON.parse(result); const commitTime = commitData.commit.author.date; // ISO 8601 format @@ -265,7 +241,6 @@ function completeWithBibTeX(item, bibtex, githubRepository, owner) { let tags = [...item.tags]; let title = item.title; let versionNumber = item.versionNumber; - let version = item.version; let url = item.url; Object.assign(item, bibItem); @@ -276,40 +251,35 @@ function completeWithBibTeX(item, bibtex, githubRepository, owner) { if (url.includes('/blob/')) { item.title = title; item.versionNumber = versionNumber; - item.version = version; + item.version = versionNumber; item.url = url; } ZU.doGet(`https://raw.githubusercontent.com/${path}/HEAD/CITATION.cff`, function (cffText) { - let cffVersion = searchFieldValue(cffText, "version"); - if (!item.versionNumber && cffVersion) { - item.versionNumber = cffVersion; + let yaml = parseYAML(cffText) + if (!item.versionNumber && yaml.version) { + item.versionNumber = yaml.version; } - let cffType = searchFieldValue(cffText, "type"); - if (cffType && cffType === 'dataset') { - item.itemType = cffType; + if (yaml.type && yaml.type === 'dataset') { + item.itemType = yaml.type; } - let cffAbstract = searchFieldValue(cffText, "abstract"); - if (cffAbstract) { - item.abstractNote = cffAbstract; + if (yaml.abstract) { + item.abstractNote = yaml.abstract; } - let cffURL = searchFieldValue(cffText, "url"); - if (cffURL && item.url.includes('/blob/') === false) { - item.url = cffURL; + if (yaml.url && item.url.includes('/blob/') === false) { + item.url = yaml.url; } - let cffRepository = searchFieldValue(cffText, "repository"); - if (cffRepository) { - item.place = cffRepository; + if (yaml.repository) { + item.place = yaml.place; } - let cffKeywords = extractKeywords(cffText); - if (cffKeywords && cffKeywords.length > 0) { + if (yaml.keywords.length > 0) { item.tags = []; - item.tags = item.tags.concat(cffKeywords); + item.tags = item.tags.concat(yaml.keywords); item.tags = [...new Set(item.tags)]; } @@ -363,46 +333,38 @@ function completeWithAPI(item, owner, githubRepository) { }); } -/** - * Searches for the value of a specified field in YAML content. - * - * @param {string} yamlContent - The YAML content as a string. - * @param {string} field - The field name to search for. - * @returns {string|null} - The value of the field if found, or null if not found. - */ -function searchFieldValue(yamlContent, field) { - const regex = new RegExp(`^${field}:\\s*(.+)`, 'm'); - const match = yamlContent.match(regex); - - let value = null; - if (match) { - value = match[1].trim(); - if (value.startsWith('"') && value.endsWith('"')) { - value = value.slice(1, -1); +function parseYAML(yamlText) { + const lines = yamlText.split('\n'); + const result = {}; + + for (let line of lines) { + // Trim whitespace and ignore empty lines or comments + line = line.trim(); + if (!line || line.startsWith('#')) { + continue; } - } - return value; -} -/** - * Extracts the keywords from YAML content. - * - * @param {string} yamlContent - The YAML content as a string. - * @returns {string[]|null} - An array of keywords if found, or null if not found. - */ -function extractKeywords(yamlContent) { - const regex = /keywords:\s*\n([\s\S]*?)(\n\w+:|$)/; // Matches the "keywords" field and its list - const match = yamlContent.match(regex); - - if (match && match[1]) { - return match[1] - .split('\n') // Split the content by lines - .map(keyword => keyword.trim()) // Remove extra spaces - .filter(keyword => keyword.startsWith('- ')) // Only include list items - .map(keyword => keyword.slice(2)); // Remove the "- " prefix + // Split key and value at the first colon + const [key, ...valueParts] = line.split(':'); + const value = valueParts.join(':').trim(); + + // Handle different value types + if (value.startsWith('"') && value.endsWith('"')) { + // Quoted string + result[key.trim()] = value.slice(1, -1); + } else if (value === 'true' || value === 'false') { + // Boolean + result[key.trim()] = value === 'true'; + } else if (!isNaN(value)) { + // Number + result[key.trim()] = parseFloat(value); + } else { + // Unquoted string + result[key.trim()] = value; + } } - return null; // Return null if "keywords" not found + return result; } /** BEGIN TEST CASES **/ @@ -424,7 +386,7 @@ var testCases = [ "version": "0a6095322668908f243a536a4e43911d80f76b75", "date": "2024-12-06T09:38:01Z", "abstractNote": "Zotero is a free, easy-to-use tool to help you collect, organize, annotate, cite, and share your research sources.", - "company": "ZoteroAAA", + "company": "Zotero", "extra": "original-date: 2011-10-27T07:46:48Z", "libraryCatalog": "GitHub", "programmingLanguage": "JavaScript", @@ -440,16 +402,12 @@ var testCases = [ }, { "type": "web", - "url": "https://github.com/search?utf8=%E2%9C%93&q=topic%3Ahocr&type=repositories", - "defer": true, - "detectedItemType": false, + "url": "https://github.com/search?utf8=%E2%9C%93&q=topic%3Ahocr&type=", "items": "multiple" }, { "type": "web", "url": "https://github.com/datacite/schema/tree/4.6.0", - "defer": true, - "detectedItemType": false, "items": [ { "itemType": "computerProgram", @@ -461,13 +419,13 @@ var testCases = [ "fieldMode": 1 } ], - "date": "2024-12-05T18:31:38Z", + "date": "2024-12-05T18:31:44Z", "abstractNote": "DataCite Metadata Schema Repository", "company": "DataCite", "extra": "original-date: 2011-04-13T07:08:41Z", "libraryCatalog": "GitHub", "programmingLanguage": "Ruby", - "url": "https://github.com/datacite/schema/tree/4.6.0", + "url": "https://github.com/datacite/schema/blob/4.6.0", "versionNumber": "4.6.0", "place": "GitHub", "attachments": [], @@ -480,7 +438,6 @@ var testCases = [ { "type": "web", "url": "https://github.com/datacite/schema/blob/4.6.0/.dockerignore", - "defer": true, "items": [ { "itemType": "computerProgram", @@ -492,13 +449,13 @@ var testCases = [ "fieldMode": 1 } ], - "date": "2024-12-05T18:31:38Z", + "date": "2016-08-23T16:42:17Z", "abstractNote": "DataCite Metadata Schema Repository", "company": "DataCite", "extra": "original-date: 2011-04-13T07:08:41Z", "libraryCatalog": "GitHub", "programmingLanguage": "Ruby", - "url": "https://github.com/datacite/schema/blob/4.6.0/.dockerignore", + "url": "https://github.com/datacite/schema/tree/4.6.0/.dockerignore", "versionNumber": "4.6.0", "place": "GitHub", "attachments": [], @@ -511,8 +468,6 @@ var testCases = [ { "type": "web", "url": "https://github.com/mittagessen/kraken/tree/4.1.2", - "defer": true, - "detectedItemType": false, "items": [ { "itemType": "computerProgram", @@ -571,8 +526,6 @@ var testCases = [ { "type": "web", "url": "https://github.com/aurimasv/z2csl/tree/5750900e907b6730ccd724e23444ccc79d15f3f3", - "defer": true, - "detectedItemType": false, "items": [ { "itemType": "computerProgram", @@ -584,7 +537,7 @@ var testCases = [ "creatorType": "programmer" } ], - "date": "2022-07-14T16:14:40Z", + "date": "2024-12-23T20:52:59Z", "abstractNote": "Zotero extension for creating Zotero to CSL item type and field mappings.", "extra": "original-date: 2012-05-20T07:53:58Z", "libraryCatalog": "GitHub", @@ -602,7 +555,6 @@ var testCases = [ { "type": "web", "url": "https://github.com/zotero/translators/blob/eb4f39007e62d3d632448e184b1fd3671b3a1349/GitHub.js", - "defer": true, "items": [ { "itemType": "computerProgram", @@ -614,7 +566,7 @@ var testCases = [ "fieldMode": 1 } ], - "date": "2021-07-28T21:54:41Z", + "date": "2021-07-29T04:53:43Z", "versionNumber": "eb4f39007e62d3d632448e184b1fd3671b3a1349", "abstractNote": "Zotero Translators", "company": "Zotero", @@ -633,8 +585,6 @@ var testCases = [ { "type": "web", "url": "https://github.com/citation-file-format/citation-file-format/tree/1.2.0", - "defer": true, - "detectedItemType": false, "items": [ { "itemType": "computerProgram", @@ -681,13 +631,13 @@ var testCases = [ "creatorType": "author" }, { - "firstName": "Olexandr", + "firstName": "Alexander", "lastName": "Konovalov", "creatorType": "author" } ], "date": "2021-08", - "abstractNote": "CITATION.cff files are plain text files with human- and machine-readable citation information for software. Code developers can include them in their repositories to let others know how to correctly cite their software. This is the specification for the Citation File Format.", + "abstractNote": "The Citation File Format lets you provide citation metadata for software or datasets in plaintext files that are easy to read by both humans and machines.", "extra": "DOI: 10.5281/zenodo.5171937", "libraryCatalog": "GitHub", "programmingLanguage": "Python", @@ -698,32 +648,28 @@ var testCases = [ "attachments": [], "tags": [ { - "tag": "CFF" - }, - { - "tag": "YAML" + "tag": "attribution" }, { - "tag": "citation file format" + "tag": "citation" }, - { - "tag": "citation files" + "tag": "citation-files" }, { "tag": "credit" }, { - "tag": "file format" + "tag": "format" }, { - "tag": "research software" + "tag": "research-software-engineering" }, { - "tag": "software citation" + "tag": "software-sustainability" }, { - "tag": "software sustainability" + "tag": "wssspe" } ], "notes": [], @@ -734,7 +680,6 @@ var testCases = [ { "type": "web", "url": "https://github.com/citation-file-format/citation-file-format/blob/1.1.0/test/pytest.ini", - "defer": true, "items": [ { "itemType": "computerProgram", @@ -787,7 +732,7 @@ var testCases = [ } ], "date": "2021-08", - "abstractNote": "CITATION.cff files are plain text files with human- and machine-readable citation information for software. Code developers can include them in their repositories to let others know how to correctly cite their software. This is the specification for the Citation File Format.", + "abstractNote": "The Citation File Format lets you provide citation metadata for software or datasets in plaintext files that are easy to read by both humans and machines.", "extra": "DOI: 10.5281/zenodo.5171937", "libraryCatalog": "GitHub", "programmingLanguage": "Python", @@ -796,36 +741,7 @@ var testCases = [ "versionNumber": "1.1.0", "place": "GitHub", "attachments": [], - "tags": [ - { - "tag": "CFF" - }, - { - "tag": "YAML" - }, - { - "tag": "citation file format" - }, - - { - "tag": "citation files" - }, - { - "tag": "credit" - }, - { - "tag": "file format" - }, - { - "tag": "research software" - }, - { - "tag": "software citation" - }, - { - "tag": "software sustainability" - } - ], + "tags": [], "notes": [], "seeAlso": [] } @@ -834,8 +750,6 @@ var testCases = [ { "type": "web", "url": "https://github.com/pulipulichen/PTS-Local-News-Dataset/tree/20250105-0131", - "defer": true, - "detectedItemType": false, "items": [ { "itemType": "dataset", @@ -851,8 +765,6 @@ var testCases = [ "abstractNote": "A dataset containing local news from Taiwan Public Television Service.", "extra": "DOI: 10.5281/zenodo.14598063", "libraryCatalog": "GitHub", - "DOI": "10.5281/zenodo.14598063", - "rights": "MIT", "url": "https://github.com/pulipulichen/PTS-Local-News-Dataset", "versionNumber": "20250105-0131", "attachments": [], From 32cb65c9a8b25a81ac4a3c588a5f4b145aa559a9 Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 23:00:28 +0800 Subject: [PATCH 51/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2023=E6=99=8200?= =?UTF-8?q?=E5=88=8628=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 233 +++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 161 insertions(+), 72 deletions(-) diff --git a/GitHub.js b/GitHub.js index bb6ca27d3fb..1acf1403884 100644 --- a/GitHub.js +++ b/GitHub.js @@ -13,7 +13,7 @@ } /** - Copyright (c) 2017-2021 Martin Fenner, Philipp Zumstein + Copyright (c) 2017-2025 Martin Fenner, Philipp Zumstein, Yung-Ting Chen This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License @@ -35,7 +35,8 @@ const apiUrl = "https://api.github.com/"; function detectWeb(doc, url) { if (url.includes("/search?")) { - if (getSearchResults(doc, true)) { + var rows = doc.querySelectorAll('[data-testid="results-list"] .search-title a'); + if (rows.length > 0) { return "multiple"; } } @@ -46,18 +47,39 @@ function detectWeb(doc, url) { } // `og:title` is messed up when browsing a file. - let ogTitle = attr(doc, 'meta[property="og:url"]', 'content'); - if (ogTitle.includes('/blob/') || url.startsWith(ogTitle + '/blob/')) { + let ogURL = attr(doc, 'meta[property="og:url"]', 'content'); + if (ogURL.includes('/blob/') || url.startsWith(ogURL + '/blob/')) { return "computerProgram"; } - if (!/^(GitHub - )?[^/\s]+\/[^/\s]+(: .*)?$/.test(attr(doc, 'meta[property="og:title"]', 'content')) && !/^(GitHub - )?[^/\s]+\/[^/\s]+( .*)?$/.test(attr(doc, 'meta[property="og:title"]', 'content'))) { + let ogTitle = attr(doc, 'meta[property="og:title"]', 'content'); + let path = url.split('/').slice(3, 5).join('/'); + let repo = url.split('/').slice(4, 5)[0]; + if (!ogTitle.startsWith(path) && !ogTitle.startsWith(repo + '/')) { // and anything without a repo name (abc/xyz) as its og:title. // deals with repo pages that we can't scrape, like GitHub Discussions. return false; } - return "computerProgram"; + return new Promise(function (resolve) { + ZU.doGet(`https://raw.githubusercontent.com/${path}/HEAD/CITATION.cff`, function (cffText, xhr) { + if (xhr.status !== 200) { + return resolve("computerProgram"); + } + try { + let type = searchFieldValue(cffText, "type"); + if (type && type === 'dataset') { + return resolve(type); + } + } + catch (e) { + console.error(`CITATION.cff format is invalid: + +${cffText}`); + } + return resolve("computerProgram"); + }, null, null, { 'X-Requested-With': 'XMLHttpRequest' }, false); + }); } @@ -77,8 +99,8 @@ function getSearchResults(doc, checkOnly) { } -function doWeb(doc, url) { - if (detectWeb(doc, url) == "multiple") { +async function doWeb(doc, url) { + if (await detectWeb(doc, url) == "multiple") { Zotero.selectItems(getSearchResults(doc, false), function (items) { if (!items) { return; @@ -140,11 +162,14 @@ function scrape(doc, url) { } let latestCommitLink = attr(doc, 'link[rel="canonical"]', 'href'); - if (!latestCommitLink) { + if (!latestCommitLink && url.includes('/blob/') === false) { latestCommitLink = attr(doc, '[data-testid="latest-commit-html"] a', 'href'); } + if (!latestCommitLink) { + latestCommitLink = attr(doc, '[data-testid="breadcrumbs-repo-link"]', 'href'); + } let commitHash = false; - if (latestCommitLink.includes('/')) { + if (latestCommitLink.includes('/') && latestCommitLink.endsWith(githubRepository) === false) { commitHash = latestCommitLink.split('/').pop(); } @@ -173,7 +198,6 @@ function scrape(doc, url) { if (canonical) { item.url = canonical; } - ZU.doGet(apiUrl + "repos/" + githubRepository + "/commits/" + commitHash, function (result) { var commitData = JSON.parse(result); const commitTime = commitData.commit.author.date; // ISO 8601 format @@ -241,6 +265,7 @@ function completeWithBibTeX(item, bibtex, githubRepository, owner) { let tags = [...item.tags]; let title = item.title; let versionNumber = item.versionNumber; + let version = item.version; let url = item.url; Object.assign(item, bibItem); @@ -251,35 +276,40 @@ function completeWithBibTeX(item, bibtex, githubRepository, owner) { if (url.includes('/blob/')) { item.title = title; item.versionNumber = versionNumber; - item.version = versionNumber; + item.version = version; item.url = url; } ZU.doGet(`https://raw.githubusercontent.com/${path}/HEAD/CITATION.cff`, function (cffText) { - let yaml = parseYAML(cffText) - if (!item.versionNumber && yaml.version) { - item.versionNumber = yaml.version; + let cffVersion = searchFieldValue(cffText, "version"); + if (!item.versionNumber && cffVersion) { + item.versionNumber = cffVersion; } - if (yaml.type && yaml.type === 'dataset') { - item.itemType = yaml.type; + let cffType = searchFieldValue(cffText, "type"); + if (cffType && cffType === 'dataset') { + item.itemType = cffType; } - if (yaml.abstract) { - item.abstractNote = yaml.abstract; + let cffAbstract = searchFieldValue(cffText, "abstract"); + if (cffAbstract) { + item.abstractNote = cffAbstract; } - if (yaml.url && item.url.includes('/blob/') === false) { - item.url = yaml.url; + let cffURL = searchFieldValue(cffText, "url"); + if (cffURL && item.url.includes('/blob/') === false) { + item.url = cffURL; } - if (yaml.repository) { - item.place = yaml.place; + let cffRepository = searchFieldValue(cffText, "repository"); + if (cffRepository) { + item.place = cffRepository; } - if (yaml.keywords.length > 0) { + let cffKeywords = extractKeywords(cffText); + if (cffKeywords && cffKeywords.length > 0) { item.tags = []; - item.tags = item.tags.concat(yaml.keywords); + item.tags = item.tags.concat(cffKeywords); item.tags = [...new Set(item.tags)]; } @@ -333,38 +363,46 @@ function completeWithAPI(item, owner, githubRepository) { }); } -function parseYAML(yamlText) { - const lines = yamlText.split('\n'); - const result = {}; - - for (let line of lines) { - // Trim whitespace and ignore empty lines or comments - line = line.trim(); - if (!line || line.startsWith('#')) { - continue; - } - - // Split key and value at the first colon - const [key, ...valueParts] = line.split(':'); - const value = valueParts.join(':').trim(); - - // Handle different value types +/** + * Searches for the value of a specified field in YAML content. + * + * @param {string} yamlContent - The YAML content as a string. + * @param {string} field - The field name to search for. + * @returns {string|null} - The value of the field if found, or null if not found. + */ +function searchFieldValue(yamlContent, field) { + const regex = new RegExp(`^${field}:\\s*(.+)`, 'm'); + const match = yamlContent.match(regex); + + let value = null; + if (match) { + value = match[1].trim(); if (value.startsWith('"') && value.endsWith('"')) { - // Quoted string - result[key.trim()] = value.slice(1, -1); - } else if (value === 'true' || value === 'false') { - // Boolean - result[key.trim()] = value === 'true'; - } else if (!isNaN(value)) { - // Number - result[key.trim()] = parseFloat(value); - } else { - // Unquoted string - result[key.trim()] = value; + value = value.slice(1, -1); } } + return value; +} + +/** + * Extracts the keywords from YAML content. + * + * @param {string} yamlContent - The YAML content as a string. + * @returns {string[]|null} - An array of keywords if found, or null if not found. + */ +function extractKeywords(yamlContent) { + const regex = /keywords:\s*\n([\s\S]*?)(\n\w+:|$)/; // Matches the "keywords" field and its list + const match = yamlContent.match(regex); + + if (match && match[1]) { + return match[1] + .split('\n') // Split the content by lines + .map(keyword => keyword.trim()) // Remove extra spaces + .filter(keyword => keyword.startsWith('- ')) // Only include list items + .map(keyword => keyword.slice(2)); // Remove the "- " prefix + } - return result; + return null; // Return null if "keywords" not found } /** BEGIN TEST CASES **/ @@ -372,6 +410,7 @@ var testCases = [ { "type": "web", "url": "https://github.com/zotero/zotero/tree/0a6095322668908f243a536a4e43911d80f76b75", + "detectedItemType": false, "items": [ { "itemType": "computerProgram", @@ -386,7 +425,7 @@ var testCases = [ "version": "0a6095322668908f243a536a4e43911d80f76b75", "date": "2024-12-06T09:38:01Z", "abstractNote": "Zotero is a free, easy-to-use tool to help you collect, organize, annotate, cite, and share your research sources.", - "company": "Zotero", + "company": "ZoteroAAA", "extra": "original-date: 2011-10-27T07:46:48Z", "libraryCatalog": "GitHub", "programmingLanguage": "JavaScript", @@ -402,12 +441,16 @@ var testCases = [ }, { "type": "web", - "url": "https://github.com/search?utf8=%E2%9C%93&q=topic%3Ahocr&type=", + "url": "https://github.com/search?utf8=%E2%9C%93&q=topic%3Ahocr&type=repositories", + "defer": true, + "detectedItemType": false, "items": "multiple" }, { "type": "web", "url": "https://github.com/datacite/schema/tree/4.6.0", + "defer": true, + "detectedItemType": false, "items": [ { "itemType": "computerProgram", @@ -419,13 +462,13 @@ var testCases = [ "fieldMode": 1 } ], - "date": "2024-12-05T18:31:44Z", + "date": "2024-12-05T18:31:38Z", "abstractNote": "DataCite Metadata Schema Repository", "company": "DataCite", "extra": "original-date: 2011-04-13T07:08:41Z", "libraryCatalog": "GitHub", "programmingLanguage": "Ruby", - "url": "https://github.com/datacite/schema/blob/4.6.0", + "url": "https://github.com/datacite/schema/tree/4.6.0", "versionNumber": "4.6.0", "place": "GitHub", "attachments": [], @@ -438,6 +481,7 @@ var testCases = [ { "type": "web", "url": "https://github.com/datacite/schema/blob/4.6.0/.dockerignore", + "defer": true, "items": [ { "itemType": "computerProgram", @@ -449,13 +493,13 @@ var testCases = [ "fieldMode": 1 } ], - "date": "2016-08-23T16:42:17Z", + "date": "2024-12-05T18:31:38Z", "abstractNote": "DataCite Metadata Schema Repository", "company": "DataCite", "extra": "original-date: 2011-04-13T07:08:41Z", "libraryCatalog": "GitHub", "programmingLanguage": "Ruby", - "url": "https://github.com/datacite/schema/tree/4.6.0/.dockerignore", + "url": "https://github.com/datacite/schema/blob/4.6.0/.dockerignore", "versionNumber": "4.6.0", "place": "GitHub", "attachments": [], @@ -468,6 +512,8 @@ var testCases = [ { "type": "web", "url": "https://github.com/mittagessen/kraken/tree/4.1.2", + "defer": true, + "detectedItemType": false, "items": [ { "itemType": "computerProgram", @@ -526,6 +572,8 @@ var testCases = [ { "type": "web", "url": "https://github.com/aurimasv/z2csl/tree/5750900e907b6730ccd724e23444ccc79d15f3f3", + "defer": true, + "detectedItemType": false, "items": [ { "itemType": "computerProgram", @@ -537,7 +585,7 @@ var testCases = [ "creatorType": "programmer" } ], - "date": "2024-12-23T20:52:59Z", + "date": "2022-07-14T16:14:40Z", "abstractNote": "Zotero extension for creating Zotero to CSL item type and field mappings.", "extra": "original-date: 2012-05-20T07:53:58Z", "libraryCatalog": "GitHub", @@ -555,6 +603,7 @@ var testCases = [ { "type": "web", "url": "https://github.com/zotero/translators/blob/eb4f39007e62d3d632448e184b1fd3671b3a1349/GitHub.js", + "defer": true, "items": [ { "itemType": "computerProgram", @@ -566,7 +615,7 @@ var testCases = [ "fieldMode": 1 } ], - "date": "2021-07-29T04:53:43Z", + "date": "2021-07-28T21:54:41Z", "versionNumber": "eb4f39007e62d3d632448e184b1fd3671b3a1349", "abstractNote": "Zotero Translators", "company": "Zotero", @@ -585,6 +634,8 @@ var testCases = [ { "type": "web", "url": "https://github.com/citation-file-format/citation-file-format/tree/1.2.0", + "defer": true, + "detectedItemType": false, "items": [ { "itemType": "computerProgram", @@ -631,13 +682,13 @@ var testCases = [ "creatorType": "author" }, { - "firstName": "Alexander", + "firstName": "Olexandr", "lastName": "Konovalov", "creatorType": "author" } ], "date": "2021-08", - "abstractNote": "The Citation File Format lets you provide citation metadata for software or datasets in plaintext files that are easy to read by both humans and machines.", + "abstractNote": "CITATION.cff files are plain text files with human- and machine-readable citation information for software. Code developers can include them in their repositories to let others know how to correctly cite their software. This is the specification for the Citation File Format.", "extra": "DOI: 10.5281/zenodo.5171937", "libraryCatalog": "GitHub", "programmingLanguage": "Python", @@ -648,28 +699,32 @@ var testCases = [ "attachments": [], "tags": [ { - "tag": "attribution" + "tag": "CFF" + }, + { + "tag": "YAML" }, { - "tag": "citation" + "tag": "citation file format" }, + { - "tag": "citation-files" + "tag": "citation files" }, { "tag": "credit" }, { - "tag": "format" + "tag": "file format" }, { - "tag": "research-software-engineering" + "tag": "research software" }, { - "tag": "software-sustainability" + "tag": "software citation" }, { - "tag": "wssspe" + "tag": "software sustainability" } ], "notes": [], @@ -680,6 +735,7 @@ var testCases = [ { "type": "web", "url": "https://github.com/citation-file-format/citation-file-format/blob/1.1.0/test/pytest.ini", + "defer": true, "items": [ { "itemType": "computerProgram", @@ -732,7 +788,7 @@ var testCases = [ } ], "date": "2021-08", - "abstractNote": "The Citation File Format lets you provide citation metadata for software or datasets in plaintext files that are easy to read by both humans and machines.", + "abstractNote": "CITATION.cff files are plain text files with human- and machine-readable citation information for software. Code developers can include them in their repositories to let others know how to correctly cite their software. This is the specification for the Citation File Format.", "extra": "DOI: 10.5281/zenodo.5171937", "libraryCatalog": "GitHub", "programmingLanguage": "Python", @@ -741,7 +797,36 @@ var testCases = [ "versionNumber": "1.1.0", "place": "GitHub", "attachments": [], - "tags": [], + "tags": [ + { + "tag": "CFF" + }, + { + "tag": "YAML" + }, + { + "tag": "citation file format" + }, + + { + "tag": "citation files" + }, + { + "tag": "credit" + }, + { + "tag": "file format" + }, + { + "tag": "research software" + }, + { + "tag": "software citation" + }, + { + "tag": "software sustainability" + } + ], "notes": [], "seeAlso": [] } @@ -750,6 +835,8 @@ var testCases = [ { "type": "web", "url": "https://github.com/pulipulichen/PTS-Local-News-Dataset/tree/20250105-0131", + "defer": true, + "detectedItemType": false, "items": [ { "itemType": "dataset", @@ -765,6 +852,8 @@ var testCases = [ "abstractNote": "A dataset containing local news from Taiwan Public Television Service.", "extra": "DOI: 10.5281/zenodo.14598063", "libraryCatalog": "GitHub", + "DOI": "10.5281/zenodo.14598063", + "rights": "MIT", "url": "https://github.com/pulipulichen/PTS-Local-News-Dataset", "versionNumber": "20250105-0131", "attachments": [], From 286b2241fb778f1a214b1c39b8825e18d4d6e956 Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 23:05:06 +0800 Subject: [PATCH 52/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2023=E6=99=8205?= =?UTF-8?q?=E5=88=8606=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/GitHub.js b/GitHub.js index 1acf1403884..961d34b4e58 100644 --- a/GitHub.js +++ b/GitHub.js @@ -410,7 +410,6 @@ var testCases = [ { "type": "web", "url": "https://github.com/zotero/zotero/tree/0a6095322668908f243a536a4e43911d80f76b75", - "detectedItemType": false, "items": [ { "itemType": "computerProgram", @@ -443,7 +442,6 @@ var testCases = [ "type": "web", "url": "https://github.com/search?utf8=%E2%9C%93&q=topic%3Ahocr&type=repositories", "defer": true, - "detectedItemType": false, "items": "multiple" }, { From e12b48fb636916eb2a1336105722d2aabc9a9706 Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 23:09:08 +0800 Subject: [PATCH 53/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2023=E6=99=8209?= =?UTF-8?q?=E5=88=8608=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 33 ++++++--------------------------- 1 file changed, 6 insertions(+), 27 deletions(-) diff --git a/GitHub.js b/GitHub.js index 961d34b4e58..4f165b092ce 100644 --- a/GitHub.js +++ b/GitHub.js @@ -33,10 +33,10 @@ const apiUrl = "https://api.github.com/"; + function detectWeb(doc, url) { if (url.includes("/search?")) { - var rows = doc.querySelectorAll('[data-testid="results-list"] .search-title a'); - if (rows.length > 0) { + if (getSearchResults(doc, true)) { return "multiple"; } } @@ -47,39 +47,18 @@ function detectWeb(doc, url) { } // `og:title` is messed up when browsing a file. - let ogURL = attr(doc, 'meta[property="og:url"]', 'content'); - if (ogURL.includes('/blob/') || url.startsWith(ogURL + '/blob/')) { + let ogTitle = attr(doc, 'meta[property="og:url"]', 'content'); + if (ogTitle.includes('/blob/') || url.startsWith(ogTitle + '/blob/')) { return "computerProgram"; } - let ogTitle = attr(doc, 'meta[property="og:title"]', 'content'); - let path = url.split('/').slice(3, 5).join('/'); - let repo = url.split('/').slice(4, 5)[0]; - if (!ogTitle.startsWith(path) && !ogTitle.startsWith(repo + '/')) { + if (!/^(GitHub - )?[^/\s]+\/[^/\s]+(: .*)?$/.test(attr(doc, 'meta[property="og:title"]', 'content')) && !/^(GitHub - )?[^/\s]+\/[^/\s]+( .*)?$/.test(attr(doc, 'meta[property="og:title"]', 'content'))) { // and anything without a repo name (abc/xyz) as its og:title. // deals with repo pages that we can't scrape, like GitHub Discussions. return false; } - return new Promise(function (resolve) { - ZU.doGet(`https://raw.githubusercontent.com/${path}/HEAD/CITATION.cff`, function (cffText, xhr) { - if (xhr.status !== 200) { - return resolve("computerProgram"); - } - try { - let type = searchFieldValue(cffText, "type"); - if (type && type === 'dataset') { - return resolve(type); - } - } - catch (e) { - console.error(`CITATION.cff format is invalid: - -${cffText}`); - } - return resolve("computerProgram"); - }, null, null, { 'X-Requested-With': 'XMLHttpRequest' }, false); - }); + return "computerProgram"; } From 794f5e5ff23ac9a54e7a24b52aa535112c693536 Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 23:12:46 +0800 Subject: [PATCH 54/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2023=E6=99=8212?= =?UTF-8?q?=E5=88=8646=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/GitHub.js b/GitHub.js index 4f165b092ce..1d3bdc5f7fd 100644 --- a/GitHub.js +++ b/GitHub.js @@ -33,7 +33,6 @@ const apiUrl = "https://api.github.com/"; - function detectWeb(doc, url) { if (url.includes("/search?")) { if (getSearchResults(doc, true)) { @@ -58,7 +57,25 @@ function detectWeb(doc, url) { return false; } - return "computerProgram"; + return new Promise(function (resolve) { + ZU.doGet(`https://raw.githubusercontent.com/${path}/HEAD/CITATION.cff`, function (cffText, xhr) { + if (xhr.status !== 200) { + return resolve("computerProgram"); + } + try { + let type = searchFieldValue(cffText, "type"); + if (type && type === 'dataset') { + return resolve(type); + } + } + catch (e) { + console.error(`CITATION.cff format is invalid: + +${cffText}`); + } + return resolve("computerProgram"); + }, null, null, { 'X-Requested-With': 'XMLHttpRequest' }, false); + }); } From ad2e2b63b89085b7e8f0127e1e9fad4ac4de0dc0 Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 23:16:15 +0800 Subject: [PATCH 55/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2023=E6=99=8216?= =?UTF-8?q?=E5=88=8615=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 1 + 1 file changed, 1 insertion(+) diff --git a/GitHub.js b/GitHub.js index 1d3bdc5f7fd..245e103bd1f 100644 --- a/GitHub.js +++ b/GitHub.js @@ -57,6 +57,7 @@ function detectWeb(doc, url) { return false; } + let path = url.split('/').slice(3, 5).join('/'); return new Promise(function (resolve) { ZU.doGet(`https://raw.githubusercontent.com/${path}/HEAD/CITATION.cff`, function (cffText, xhr) { if (xhr.status !== 200) { From aa5ab6bea19075e425a71f16ef9b38b18750ac36 Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 23:21:49 +0800 Subject: [PATCH 56/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2023=E6=99=8221?= =?UTF-8?q?=E5=88=8649=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/GitHub.js b/GitHub.js index 245e103bd1f..bc6c4ca5d69 100644 --- a/GitHub.js +++ b/GitHub.js @@ -34,8 +34,14 @@ const apiUrl = "https://api.github.com/"; function detectWeb(doc, url) { + // if (url.includes("/search?")) { + // if (getSearchResults(doc, true)) { + // return "multiple"; + // } + // } if (url.includes("/search?")) { - if (getSearchResults(doc, true)) { + var rows = doc.querySelectorAll('[data-testid="results-list"] .search-title a'); + if (rows.length > 0) { return "multiple"; } } @@ -46,8 +52,13 @@ function detectWeb(doc, url) { } // `og:title` is messed up when browsing a file. - let ogTitle = attr(doc, 'meta[property="og:url"]', 'content'); - if (ogTitle.includes('/blob/') || url.startsWith(ogTitle + '/blob/')) { + // let ogTitle = attr(doc, 'meta[property="og:url"]', 'content'); + // if (ogTitle.includes('/blob/') || url.startsWith(ogTitle + '/blob/')) { + // return "computerProgram"; + // } + // `og:title` is messed up when browsing a file. + let ogURL = attr(doc, 'meta[property="og:url"]', 'content'); + if (ogURL.includes('/blob/') || url.startsWith(ogURL + '/blob/')) { return "computerProgram"; } From 884f0a6a5eafd70485b67c8b5bd3eeb6ee8df844 Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 23:25:42 +0800 Subject: [PATCH 57/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2023=E6=99=8225?= =?UTF-8?q?=E5=88=8642=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/GitHub.js b/GitHub.js index bc6c4ca5d69..aa137d35bab 100644 --- a/GitHub.js +++ b/GitHub.js @@ -62,13 +62,23 @@ function detectWeb(doc, url) { return "computerProgram"; } - if (!/^(GitHub - )?[^/\s]+\/[^/\s]+(: .*)?$/.test(attr(doc, 'meta[property="og:title"]', 'content')) && !/^(GitHub - )?[^/\s]+\/[^/\s]+( .*)?$/.test(attr(doc, 'meta[property="og:title"]', 'content'))) { + // if (!/^(GitHub - )?[^/\s]+\/[^/\s]+(: .*)?$/.test(attr(doc, 'meta[property="og:title"]', 'content')) && !/^(GitHub - )?[^/\s]+\/[^/\s]+( .*)?$/.test(attr(doc, 'meta[property="og:title"]', 'content'))) { + // // and anything without a repo name (abc/xyz) as its og:title. + // // deals with repo pages that we can't scrape, like GitHub Discussions. + // return false; + // } + // let path = url.split('/').slice(3, 5).join('/'); + + let ogTitle = attr(doc, 'meta[property="og:title"]', 'content'); + let path = url.split('/').slice(3, 5).join('/'); + let repo = url.split('/').slice(4, 5)[0]; + if (!ogTitle.startsWith(path) && !ogTitle.startsWith(repo + '/')) { // and anything without a repo name (abc/xyz) as its og:title. // deals with repo pages that we can't scrape, like GitHub Discussions. + console.error(JSON.stringify({ogTitle, path, repo}, null, 2)); return false; } - let path = url.split('/').slice(3, 5).join('/'); return new Promise(function (resolve) { ZU.doGet(`https://raw.githubusercontent.com/${path}/HEAD/CITATION.cff`, function (cffText, xhr) { if (xhr.status !== 200) { From e723b56163b03437a588486d86f6aca1b530dd28 Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 23:28:17 +0800 Subject: [PATCH 58/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2023=E6=99=8228?= =?UTF-8?q?=E5=88=8617=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/GitHub.js b/GitHub.js index aa137d35bab..5c25fe6157a 100644 --- a/GitHub.js +++ b/GitHub.js @@ -70,6 +70,9 @@ function detectWeb(doc, url) { // let path = url.split('/').slice(3, 5).join('/'); let ogTitle = attr(doc, 'meta[property="og:title"]', 'content'); + if (ogTitle.startsWith('GitHub - ')) { + ogTitle = ogTitle.substring(9); + } let path = url.split('/').slice(3, 5).join('/'); let repo = url.split('/').slice(4, 5)[0]; if (!ogTitle.startsWith(path) && !ogTitle.startsWith(repo + '/')) { From a4bed4f7c688d0375b2f9261400972b8eeb548ef Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 23:32:28 +0800 Subject: [PATCH 59/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2023=E6=99=8232?= =?UTF-8?q?=E5=88=8628=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/GitHub.js b/GitHub.js index 5c25fe6157a..5b6a8c7780c 100644 --- a/GitHub.js +++ b/GitHub.js @@ -78,7 +78,6 @@ function detectWeb(doc, url) { if (!ogTitle.startsWith(path) && !ogTitle.startsWith(repo + '/')) { // and anything without a repo name (abc/xyz) as its og:title. // deals with repo pages that we can't scrape, like GitHub Discussions. - console.error(JSON.stringify({ogTitle, path, repo}, null, 2)); return false; } @@ -431,6 +430,7 @@ var testCases = [ { "type": "web", "url": "https://github.com/zotero/zotero/tree/0a6095322668908f243a536a4e43911d80f76b75", + "defer": true, "items": [ { "itemType": "computerProgram", @@ -445,7 +445,7 @@ var testCases = [ "version": "0a6095322668908f243a536a4e43911d80f76b75", "date": "2024-12-06T09:38:01Z", "abstractNote": "Zotero is a free, easy-to-use tool to help you collect, organize, annotate, cite, and share your research sources.", - "company": "ZoteroAAA", + "company": "Zotero", "extra": "original-date: 2011-10-27T07:46:48Z", "libraryCatalog": "GitHub", "programmingLanguage": "JavaScript", @@ -469,7 +469,6 @@ var testCases = [ "type": "web", "url": "https://github.com/datacite/schema/tree/4.6.0", "defer": true, - "detectedItemType": false, "items": [ { "itemType": "computerProgram", @@ -532,7 +531,6 @@ var testCases = [ "type": "web", "url": "https://github.com/mittagessen/kraken/tree/4.1.2", "defer": true, - "detectedItemType": false, "items": [ { "itemType": "computerProgram", @@ -592,7 +590,6 @@ var testCases = [ "type": "web", "url": "https://github.com/aurimasv/z2csl/tree/5750900e907b6730ccd724e23444ccc79d15f3f3", "defer": true, - "detectedItemType": false, "items": [ { "itemType": "computerProgram", @@ -654,7 +651,6 @@ var testCases = [ "type": "web", "url": "https://github.com/citation-file-format/citation-file-format/tree/1.2.0", "defer": true, - "detectedItemType": false, "items": [ { "itemType": "computerProgram", @@ -855,7 +851,6 @@ var testCases = [ "type": "web", "url": "https://github.com/pulipulichen/PTS-Local-News-Dataset/tree/20250105-0131", "defer": true, - "detectedItemType": false, "items": [ { "itemType": "dataset", From 69be698d05c1e32d4008f0c8066e9320127815f7 Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 23:36:57 +0800 Subject: [PATCH 60/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2023=E6=99=8236?= =?UTF-8?q?=E5=88=8657=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/GitHub.js b/GitHub.js index 5b6a8c7780c..506d89e9eaa 100644 --- a/GitHub.js +++ b/GitHub.js @@ -445,7 +445,7 @@ var testCases = [ "version": "0a6095322668908f243a536a4e43911d80f76b75", "date": "2024-12-06T09:38:01Z", "abstractNote": "Zotero is a free, easy-to-use tool to help you collect, organize, annotate, cite, and share your research sources.", - "company": "Zotero", + "company": "ZoteroAAA", "extra": "original-date: 2011-10-27T07:46:48Z", "libraryCatalog": "GitHub", "programmingLanguage": "JavaScript", @@ -870,6 +870,7 @@ var testCases = [ "rights": "MIT", "url": "https://github.com/pulipulichen/PTS-Local-News-Dataset", "versionNumber": "20250105-0131", + "repositoryLocation": "GitHub", "attachments": [], "tags": [ { From 4080ffcb6912fde45b612d8842f9acb1569cf972 Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Sun, 5 Jan 2025 23:41:10 +0800 Subject: [PATCH 61/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8805=E6=97=A5=20(=E9=80=B1=E6=97=A5)=2023=E6=99=8241?= =?UTF-8?q?=E5=88=8610=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/GitHub.js b/GitHub.js index 506d89e9eaa..083f8cd8bf1 100644 --- a/GitHub.js +++ b/GitHub.js @@ -445,7 +445,7 @@ var testCases = [ "version": "0a6095322668908f243a536a4e43911d80f76b75", "date": "2024-12-06T09:38:01Z", "abstractNote": "Zotero is a free, easy-to-use tool to help you collect, organize, annotate, cite, and share your research sources.", - "company": "ZoteroAAA", + "company": "Zotero", "extra": "original-date: 2011-10-27T07:46:48Z", "libraryCatalog": "GitHub", "programmingLanguage": "JavaScript", From 936cde2aa7b9557ab4b6ca60f3d1a622f1eaee01 Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Mon, 6 Jan 2025 07:57:33 +0800 Subject: [PATCH 62/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8806=E6=97=A5=20(=E9=80=B1=E4=B8=80)=2007=E6=99=8257?= =?UTF-8?q?=E5=88=8633=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/GitHub.js b/GitHub.js index 083f8cd8bf1..e0208018d94 100644 --- a/GitHub.js +++ b/GitHub.js @@ -465,6 +465,11 @@ var testCases = [ "defer": true, "items": "multiple" }, + { + "type": "web", + "url": "https://github.com/zotero/translators/pulls", + "items": false + }, { "type": "web", "url": "https://github.com/datacite/schema/tree/4.6.0", From 43c529d86eddaa1a24c74545a4ce970d08e0a01d Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Mon, 6 Jan 2025 08:03:40 +0800 Subject: [PATCH 63/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8806=E6=97=A5=20(=E9=80=B1=E4=B8=80)=2008=E6=99=8203?= =?UTF-8?q?=E5=88=8640=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/GitHub.js b/GitHub.js index e0208018d94..a2e4e091669 100644 --- a/GitHub.js +++ b/GitHub.js @@ -39,11 +39,17 @@ function detectWeb(doc, url) { // return "multiple"; // } // } + let ogTitle = attr(doc, 'meta[property="og:title"]', 'content'); + if (url.includes("/search?")) { var rows = doc.querySelectorAll('[data-testid="results-list"] .search-title a'); if (rows.length > 0) { return "multiple"; } + + if (ogTitle === 'Build software better, together') { + return "multiple"; + } } if (!doc.querySelector('meta[property="og:type"][content="object"]')) { @@ -69,7 +75,6 @@ function detectWeb(doc, url) { // } // let path = url.split('/').slice(3, 5).join('/'); - let ogTitle = attr(doc, 'meta[property="og:title"]', 'content'); if (ogTitle.startsWith('GitHub - ')) { ogTitle = ogTitle.substring(9); } @@ -465,11 +470,6 @@ var testCases = [ "defer": true, "items": "multiple" }, - { - "type": "web", - "url": "https://github.com/zotero/translators/pulls", - "items": false - }, { "type": "web", "url": "https://github.com/datacite/schema/tree/4.6.0", From 68801a01006fd13a0945397189a8cc9a4a1a45a4 Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Tue, 7 Jan 2025 00:50:02 +0800 Subject: [PATCH 64/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8807=E6=97=A5=20(=E9=80=B1=E4=BA=8C)=2000=E6=99=8250?= =?UTF-8?q?=E5=88=8602=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 1 + 1 file changed, 1 insertion(+) diff --git a/GitHub.js b/GitHub.js index a2e4e091669..cc2c9220230 100644 --- a/GitHub.js +++ b/GitHub.js @@ -465,6 +465,7 @@ var testCases = [ ] }, { + // Beware of reach rate limitations. "type": "web", "url": "https://github.com/search?utf8=%E2%9C%93&q=topic%3Ahocr&type=repositories", "defer": true, From fa8afb04865c5cd3255eebf8adb8c6cc35e6b24d Mon Sep 17 00:00:00 2001 From: thinkpad-l13-yoga Date: Tue, 7 Jan 2025 00:52:11 +0800 Subject: [PATCH 65/65] =?UTF-8?q?=E8=A5=BF=E5=85=832025=E5=B9=B401?= =?UTF-8?q?=E6=9C=8807=E6=97=A5=20(=E9=80=B1=E4=BA=8C)=2000=E6=99=8252?= =?UTF-8?q?=E5=88=8610=E7=A7=92=20CST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHub.js | 1 - 1 file changed, 1 deletion(-) diff --git a/GitHub.js b/GitHub.js index cc2c9220230..a2e4e091669 100644 --- a/GitHub.js +++ b/GitHub.js @@ -465,7 +465,6 @@ var testCases = [ ] }, { - // Beware of reach rate limitations. "type": "web", "url": "https://github.com/search?utf8=%E2%9C%93&q=topic%3Ahocr&type=repositories", "defer": true,