Skip to content

Commit

Permalink
fix(PubScholar.js): 修复作者信息前后可能出现的空格,优化网址匹配等
Browse files Browse the repository at this point in the history
  • Loading branch information
l0o0 authored Nov 8, 2023
1 parent ada2a9a commit 83ef8c5
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions PubScholar.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"translatorID": "58df4473-a324-4fb5-8a8f-25d1e1897c73",
"label": "PubScholar",
"creator": "l0o0",
"creator": "l0o0, jiaojiaodubai",
"target": "https?://pubscholar\\.cn/",
"minVersion": "5.0",
"maxVersion": "",
Expand Down Expand Up @@ -36,10 +36,10 @@
*/

const URLTypes = {
patents: 'patent',
articles: 'journalArticle',
literatures: 'journalArticle',
books: 'book'
'/patents/': 'patent',
'/articles/': 'journalArticle',
'/literatures/': 'journalArticle',
'/books/': 'book'
};

function getTypeFromUrl(url) {
Expand Down Expand Up @@ -74,7 +74,7 @@ function parseAuthors(s) {
if (s.match(/$/)) type = 'translator';
if (s.match(/$/)) type = 'editor';
if (s.match(/^: /)) type = 'inventor';
return sclean.split(/[,]/).map(c => ({ lastName: c.replace(/\s?\d+\s?$/, ''), creatorType: type }));
return sclean.split(/[,]/).map(c => ({ lastName: c.trim().replace(/\s?\d+\s?$/, ''), creatorType: type }));
}

function parseAuthorStr(s) {
Expand Down

0 comments on commit 83ef8c5

Please sign in to comment.