Git Product home page Git Product logo

northword / zotero-format-metadata Goto Github PK

View Code? Open in Web Editor NEW
374.0 3.0 5.0 14.23 MB

Linter for Zotero. A plugin for Zotero to format item metadata. Shortcut to set title rich text; set journal abbreviations, university places, and item languages, etc; detect duplicate items.

License: GNU Affero General Public License v3.0

HTML 4.11% JavaScript 0.02% TypeScript 95.73% Shell 0.01% Python 0.04% Fluent 0.09%
abbreviation journal zotero zotero-addon zotero-plugin linter metadata

zotero-format-metadata's Introduction

Linter for Zotero

zotero target version version download number
download number for 0.4.4 license Codacy Badge Using Zotero Plugin Template

This README is also available in: 🇨🇳 简体中文 | 🇬🇧 English

An addon for Zotero to format item metadata.


Features

Shortcut to set subscripts, bold and italic, etc

The rich text content in Zotero's reference list requires manual insertion of HTML tags (See 1), which is difficult for the common user. Although Zotero's documentation mentions that visual editing of rich text will be supported in future versions, years have passed without any progress on this issue, so this plugin provides a quick way to insert these HTML tags.

Shortcuts

Once the text is selected, press the following shortcut keys to quickly apply the corresponding style:

  • Supscript: Ctrl + Shift + +
  • Subscript: Ctrl + =
  • Bold: Ctrl + B
  • Italic: Ctrl + I
  • No case: Ctrl + N (Setting class="nocase" to prevent certain special names from being capitalized in CSL title cases mode, #17 )

BTW: These shortcuts are the same as the ones in Microsoft Word.

Set subscript via shoutcut

Toolbar

When editing the "Title" field, a toolbar pops up and can be closed automatically by clicking on the blank space when editing is complete. The toolbar can be closed completely in the preferences.

Set subscript via toolbar

Duplication check

Check for duplicate items when new items are added.

Item type check

When adding an item, if its item type is a web page and its URL contains the domain of the major scholarly publisher, prompt the user to ask if they have imported the wrong type of item.

Convert title from "heading Case" to "Sentence case"

The Zotero's documentation recommends storing titles in "sentence case" format, which will allow CSL to perform a "title case" transformation on them 2. Zotero 7 has a built-in function to convert titles to "sentence capitalization", and some special case detection is preset, and this plugin expands on that by adding recognition of proper nouns, such as chemical formulas.

Detailed test results are available at test/toSentenceCase.test.ts.

Look up the journal abbreviation according to the journal full name

The plugin has a built-in dataset of about 96,000 journal abbreviations (from JabRef and Woodward Library), and the plugin will first look up the journal abbreviations in the local dataset;

If none are available, the abbreviations are inferred from the ISSN List of Title Word Abbreviations (optional);

If still no abbreviations are found, the full name of the journal is substituted (optional).

Look up the place of the university according to its name

The plugin has a built-in list of universities in mainland China and their locations. For the thesis items, the location is filled in according to the university of the thesis, which is helpful to meet the requirement of GB/T 7714-2015 for the thesis to show the location 3.

Lookup the date, volume, issue, pages, etc according to identifier

Some items in the Zotero library may be added with incomplete information such as issue volume pages because the translator is not available, or the official publication is not in the journal at the time of record, etc. The plugin provides the ability to complete these fields based on the DOI.

For book, ISBN was use. Preprint will be revised to journal article.

Fill in the language of the item according to its title

The plugin determines the language of an item based on its title and fills in the "Language" field, which is important for CSL to perform bilingual layout of the bibliography (e.g., et al and 等 mixed). 4 .

By default, the plugin is restricted to recognize only Simplified Chinese and English. You can turn off the language restriction in the preferences or add ISO 639-1 codes for other common languages.

Others

  • Remove the URL prefix of DOI
  • Convert Date to ISO format
  • etc...

Tip

The above functions involving item field processing provide both an option to run them automatically and an item context menu for manual (and batch) triggering by the user.

See Features (in Chinese).

Install

  1. Go to the release page to download the latest .xpi file.
    • If you are in mainland China or cannot access GitHub easily, please download the plugin via the following mirror sites.
    • If you are using FireFox, right click on the link of the XPI file and select "Save As...".
  2. Then, in Zotero, click Tools -> Add-ons and drag the .xpi onto the Add-ons window. See how to install a Zotero addon.

Changelog

See CHANGELOG.md.

Todo

See Project #1 .

Contribution

See CONTRIBUTING.md.

Licence

GNU Affero General Public License v3.0

Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.

Alternatives

Rich Text HTML Tags

Some quicker actions are available:

Journal abbreviation

Both zotero-journalabbr and zotero-updateifsE plugins provide similar function.

Place

A quicker action is available: 填充城市

Acknowledgements

Using Zotero Plugin Template

The code of the following plug-ins was referenced during the development of this plug-in:

The following data sets were used:

Footnotes

  1. https://www.zotero.org/support/kb/rich_text_bibliography

  2. https://www.zotero.org/support/kb/sentence_casing

  3. Chinese GB/T 7714-2015: http://www.cessp.org.cn/a258.html

  4. https://github.com/redleafnew/Chinese-STD-GB-T-7714-related-csl#%E5%A6%82%E4%BD%95%E4%BD%BF%E7%94%A8

zotero-format-metadata's People

Contributors

dependabot[bot] avatar northword avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

zotero-format-metadata's Issues

[BUG] 富文本工具框已弹出但无法前台显示

Is there an existing issue for this?

  • I have searched the existing issues

Environment

  • OS: Windows 11
  • Zotero Version: 7 beta 38
  • Addon Version: 1.6.2

Describe the bug

改上标下标的窗口有显示打不开

Anything else?

No response

Calls for journal abbreviation errors | 期刊缩写错误征集

In English:

The journal abbreviation data built into the plugin comes from JabRef, and we would like to thank all the maintainers and contributors of the JabRef journal abbreviation repository.
The dataset is very large, and some errors are inevitable.
Please feedback any errors you find here, and we will send them upstream and change them as soon as possible, or you can give feedback directly to https://github.com/JabRef/abbrv.jabref.org.


In Chinese:

插件内置的期刊缩写数据来自 JabRef,谨在此向 JabRef 期刊缩写仓库的所有维护人员和贡献者表示感谢。
该数据集非常大,里面的不可避免地会出现一些错误,还请谅解。
请将发现的错误缩写反馈于此,我们反馈给上游并尽快更改,你也可以直接向上游反馈:https://github.com/JabRef/abbrv.jabref.org。

Todos

备份待办列表至此,移至 Project

  • 标题 HTML 标签
    • 快捷键应用上下标、粗体斜体等
    • 选中文本后弹出迷你菜单提供上下标按钮
      • 记忆工具条位置
      • #8
      • #9
    • #10
  • 期刊:刊名与缩写
    • #11
    • 根据期刊名填充期刊缩写
      • 本地术语表
      • #12
      • 提供 ISO 4 with dot, ISO 4 without dot, 和 JCR 缩写的偏好选项
      • 无缩写时通过 ISSN LTWA 推断缩写
      • 无缩写时分别是否以全称填充(英文已可以设置,中文缩写是什么?)
  • 期刊:DOI 格式化
  • 期刊:期卷页
    • 如果没有期卷页,根据 DOI 获取补全
  • 学位论文:地点
    • 根据学校名填充地点
  • 日期格式化为 ISO 格式
  • 语言
    • 通过语言识别库识别(通过 franc 识别标题的语言,转为 ISO 639-1 语言代码)
    • 设置常用语言偏好
    • 期刊与语言的映射(似乎识别标题已经满足需求,无需建立该映射)~~
    • 常见错误语言值直接映射为 ISO 值(总之都要识别,不做了)
    • ISO 639 语言代码 转 ISO 3166 国家区域代码(已添加 zh-CNen-US 的映射,其他语言待办)(咨询后决定不做 zotero-chinese/styles#160
    • #13
  • 添加时自动应用
  • #14

[Feature Request] Maintain letter case

Thank you for developing this add-on, I've been waiting for ages for a tool that can help to format metadata easily and quickly!

I have a suggestion for another formatting option:
In many citation styles, the title is formatted in Title Case, which is not suitable for species names (which also need to be italicized).
I found that this can be done by adding the following HTML tags: <i><span class="nocase">Genus species</span></i>.
Is it possible to add this as a formatting option (or define my custom shortcut to achieve this)?

Thanks again, Ido

[BUG] 如果指定一个空的期刊缩写“自定义数据文件”,在进行更新时会报错

Is there an existing issue for this?

  • I have searched the existing issues

Environment

- OS: Windows 11 22H2
- Zotero Version: 7.0.0 beta33
- Addon Version: v1.4.5

Describe the bug

如果指定一个空的期刊缩写“自定义数据文件”,在进行更新时会报错。

Anything else?

“自定义数据文件”如果支持csv格式,那么用户编辑起来可能会方便一些,但是软件性能不知道是否有影响。

功能增加:

“期刊”词首大写(这个也放在“标准格式化流程”)

功能改进:

“根据条目标题自动更新语言字段”能否支持自定义,如果识别为中文则填写为“zh”,如果识别为英文,则填写为“en”,用户的既有习惯可能和“ISO 639 Code”不一致,更激进一些,允许自定义一个ISO 639 Code和用户自定义缩写的对照表(类似期刊缩写“自定义数据文件”,但是意义可能不大)

[Feature Request] 网页条目通过 URL 重新获取字段

Describe the feature

related #19

当错误添加网页条目,条目 URL 包含学术出版商,通过 URL 强制更新条目:

  • 请求 URL,根据 HTML 检索 DOI,根据 DOI 强制更新字段 -> 需要再次修改根据 DOI 更新字段函数
  • 根据 URL 调用 translator -> 是否可行?

Additional context

No response

[Feature Request] 能否加入对作者字段「creators」的自动化处理,比如首字母大写

Describe the feature

作者你好,感谢你贡献的标准化元数据的插件,非常实用!!
在使用的过程中,我会经常发现有的期刊元数据识别后作者字段「creators」全是大写,无法和其他期刊统一。
因此,能否加入对作者字段「creators」的自动化处理,比如首字母大写?

我在网上找了一段java的代码,可以在zotero的JavaScript上运行,供您参考,谢谢!

//直接改全部itemType

var newFieldMode = 0; // 0: two-field, 1: one-field (with empty first name)
var s = new Zotero.Search();
s.libraryID = ZoteroPane.getSelectedLibraryID();
var journalName = 'journalArticle'; //需要提前将需要修改的项目添加标签
s.addCondition('itemType', 'is', journalName);
//s.addCondition('creator', 'is', oldName);
 
var ids = await s.search();
    if (!ids.length) {
    return "No items found";
}

await Zotero.DB.executeTransaction(async function () {
        for (let id of ids) {
            var item = await Zotero.Items.getAsync(id);
            var creators = item.getCreators();

            let newCreators = [];
            for (let creator of creators) {
                creator.firstName = titleCase(creator.firstName.trim());
                creator.lastName = titleCase(creator.lastName.trim());
                creator.fieldMode = newFieldMode;
                newCreators.push(creator);
                } 
            item.setCreators(newCreators);
            await item.save();
            }  

}); 
return ids.length + "个条目作者变为作者首字母大写。";


function titleCase(str) {    var newStr = str.split(" ");    for(var i = 0; i<newStr.length; i++){
        newStr[i] = newStr[i].slice(0,1).toUpperCase() + newStr[i].slice(1).toLowerCase();
    }    return newStr.join(" ");
}

Additional context

No response

[Feature Request] 出版物标题词首大写

Describe the feature

期刊名 词首大写

  • 仅对全大写的出版物标题处理,以减少误伤
  • 排除虚词
  • 排除出版社缩写等全大写词

可选建立社区维护豁免词的方式

Additional context

Ref: #52

[Feature Request] Get an accurate and comprehensive database of journal abbreviations

Describe the feature

当前使用 JabRef,虽然很多,但是其质量着实不佳,我多次尝试整理它,emmm...

需要寻找一个新的数据库,或找到一个更好的整理 JabRef 数据集的方式。

For JabRef

  • csv 格式校正
  • 期刊及其缩写的大小写需要准确,例如 ACS Catalysis in journal_abbreviations_webofscience-dots.csv
  • 期刊及其缩写的形式必须正确
  • 所有不以字母或数字开头的期刊予以删除,例如 $K$-Theory: https://mathoverflow.net/questions/136465/what-happened-to-online-articles-published-in-k-theory-springer-journal
  • 所有期刊全称与期刊缩写首字母不匹配的予以删除
    • 首词跳过:The, A, An, 数字, 数字字母混合
  • 校正除 abbrv.jabref.org/journals/journal_abbreviations_webofscience-dots.csv 外的期刊,更改为以先匹配到的为准,最后使用 abbrv.jabref.org/journals/journal_abbreviations_webofscience-dots.csv。
  • 同 csv 内不允许存在重复项
  • 跨文件重复的必须一致

New database

No content.

Additional context

No response

[BUG] tooltip of richTextToolBar not show

Is there an existing issue for this?

  • I have searched the existing issues

Environment

- OS: Windows 11 
- Zotero Version: 6.0.26
- Addon Version: 0.4.0

Describe the bug

tooltip of richTextToolBar not show, may an issue of Zotero 6 or Firefox 60.

Anything else?

No response

存在错误,请在控制台查看错误信息

Is there an existing issue for this?

  • I have searched the existing issues

Environment

  • OS: windows 11
  • Zotero Version: Zotero 7 beta.39
  • Addon Version: 1.6.2

Describe the bug

image
最近老是用不了,出现“存在错误,请在控制台查看错误信息”。

Anything else?

No response

[Feature Request] Title case and sentence case

option

  • batch convert title case to sentence case
  • convert on item added
  • 连字符或冒号后是否需要大写
  • fullowing rules, each
  • 已处理过的,不再处理
    • 通过添加标签
    • 通过识别是否含有富文本标签

是否有必要提供 batch sentence case to title case 选项

rules for converting title case to sentence case

split a string by space, for per word:

  • 虚词,使其小写

  • 全为小写,跳过

  • 有 1 个大写字母,且为首字母

    • 含有数字,保持
    • 为元素周期表元素之一,保持
    • 含有其他非字母非数字字符如 -, \, /, ·, + 保持
    • 含有富文本 HTML 标签
    • 以上全否:小写
  • 有 1 个大写字母,且不为首字母,保持

  • 有多个大写字母,保持

  • 处于 <span class="no case"> 中,保持

[Feature Request] 可否提供会议的缩写?

Describe the feature

非常感谢作者提供如此优秀的插件。
现在的缩写只有期刊的,能不能为会议也提供缩写呢?
不知道有没有专门的数据库提供会议名称的缩写,因此可不可以考虑内置一个缩写映射文件,接收pr,公共维护。

Additional context

No response

[Feature Request] 请问可否增加“双引号”和“单引号”,“单双书名号”互相转换的功能

Describe the feature

大佬请问可否增加“双引号”和“单引号”,“单双书名号”互相转换的功能呢?因为有的引注格式标题要求用“双引号”或者“双书名号”,所以文章标题本身的“双引号”或者“双书名号”就只能改为“单引号”或者“单书名号”。

Additional context

zotero-chinese/styles#202 csl似乎无法实现这一功能。

[Feature Request] 能否增加自定义期刊缩写?

Describe the feature

目前插件的期刊缩写功能无法实现自定义的功能,能否增加?
在网上找了zotero-journalabbr这个插件似乎已经实现了自定义期刊缩写的功能,但是无法在导入文献时自动更新,需要手动。
期待能加入todo list,辛苦!感谢!!

Additional context

No response

[BUG] 页码检索错误

Is there an existing issue for this?

  • I have searched the existing issues

Environment

- OS: Windows 11 22H2
- Zotero Version: 6.0.26
- Addon Version: 0.4.4

Describe the bug

在通过chrome插件直接导入论文的时候,发现zotero导入的page信息是正确的,但是过了一会儿之后,该插件会自动修正pages,修正之后的pages是错误的。
https://ieeexplore.ieee.org/abstract/document/9903546
修正前: 5800 - 5815
修正后:1-16

Anything else?

No response

[Feature Request] drop support for Zotero 6

Describe the feature

Remove Zotero 6 compatible code and remove support for Zotero 6 when the second version of Zotero 7 is officially released.

Additional context

No response

请问哪里能下载到自定义缩写json文件?

Is there an existing issue for this?

  • I have searched the existing issues

Environment

- OS:win10
- Zotero Version: beta 33
- Addon Version: 1.44
请问哪里能下载到自定义缩写json文件zotero-format-metadata-custom-abbr-data?

Describe the bug

请问哪里能下载到自定义缩写json文件zotero-format-metadata-custom-abbr-data?

Anything else?

请问哪里能下载到自定义缩写json文件zotero-format-metadata-custom-abbr-data?

[BUG] 生产模式下仍有多余控制台输出

Is there an existing issue for this?

  • I have searched the existing issues

Environment

- OS:Windows 11 22H2
- Zotero Version: 7-beta.36
- Addon Version: 1.4.6

Describe the bug

生产模式下,新建对话框,仍有控制台日志,且没有插件前缀。

疑似上游 toolkit bug 待排查。

Anything else?

No response

[BUG] convert to sentence case bug

Is there an existing issue for this?

  • I have searched the existing issues

Environment

- OS:
- Zotero Version:
- Addon Version: 0.4.0

Describe the bug

(N<sub>2</sub>O) were convert to (N<sub>2</sub>o), expected (N<sub>2</sub>O).

Anything else?

No response

[BUG] 标题大小写转换:化学元素后带逗号无法识别

Is there an existing issue for this?

  • I have searched the existing issues

Environment

- OS: Windows 11
- Zotero Version: 6.0.26
- Addon Version: 0.4.2

Describe the bug

# org
Taming the redox property of A<sub>0.5</sub>Co<sub>2.5</sub>O<sub>4</sub> (a = Mg, Ca, Sr, Ba) toward high catalytic activity for N<sub>2</sub>O decomposition

# current
Taming the redox property of A<sub>0.5</sub>Co<sub>2.5</sub>O<sub>4</sub> (a = mg, ca, sr, ba) toward high catalytic activity for N<sub>2</sub>O decomposition

# expected
Taming the redox property of A<sub>0.5</sub>Co<sub>2.5</sub>O<sub>4</sub> (a = Mg, Ca, Sr, Ba) toward high catalytic activity for N<sub>2</sub>O decomposition

Anything else?

No response

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.