generated from windingwind/zotero-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: check preprint not journalArticle
closes: #137
- Loading branch information
Showing
11 changed files
with
69 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { getString } from "../../utils/locale"; | ||
import { progressWindow } from "../../utils/logger"; | ||
import { isStringMatchStringInArray } from "../../utils/str"; | ||
import { RuleBase, RuleBaseOptions } from "./rule-base"; | ||
|
||
// 当条目为 webpage ,且 url 为各期刊出版社时,警告 | ||
|
||
const publisherUrlKeyWords = ["arxiv.org", "biorxiv.org", "medrxiv.org", "chinaxiv.org"]; | ||
|
||
class NoPreprintJournalArticleOptions implements RuleBaseOptions {} | ||
|
||
export default class NoPreprintJournalArticle extends RuleBase<NoPreprintJournalArticleOptions> { | ||
constructor(options: NoPreprintJournalArticleOptions) { | ||
super(options); | ||
} | ||
|
||
apply(item: Zotero.Item): Zotero.Item | Promise<Zotero.Item> { | ||
if (item.itemType !== "journalArticle") return item; | ||
const url = item.getField("url"); | ||
if (typeof url == "string" && url !== "" && isStringMatchStringInArray(url, publisherUrlKeyWords)) { | ||
ztoolkit.log("The url of this journalArticle item is match with domin of preprint publisher."); | ||
// show alart todo: 对话框完善,通过 URL 获取 DOI 并通过 DOI 强制更新条目类别 | ||
progressWindow(getString("NoPreprintJournalArticle-warning"), "fail").startCloseTimer(100000); | ||
} | ||
return item; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters