Zotero utility code
转到文件
Dan Stillman 9e71e449b6 Update instructions for generating zoteroTypeSchemaData.js 2023-05-06 02:03:02 -04:00
.github/workflows Add GitHub Actions workflow 2022-05-02 11:50:50 -07:00
resource Update instructions for generating zoteroTypeSchemaData.js 2023-05-06 02:03:02 -04:00
test Update zoteroTypeSchemaData.js and citeProcJSExport.json 2023-04-20 04:35:21 -04:00
.gitignore Move tests from client (#9) 2022-04-28 17:42:01 -04:00
.gitmodules Move tests from client (#9) 2022-04-28 17:42:01 -04:00
COPYING Add COPYING 2021-07-26 10:36:10 +03:00
README.md Move tests from client (#9) 2022-04-28 17:42:01 -04:00
cachedTypes.js Tweak exports for use in web (#17) 2022-08-16 00:44:54 -04:00
date.js strToDate(): Fix month-parsing bugs after e4a8d2695c 2022-06-22 04:40:19 -04:00
openurl.js Remove OpenURL resolve() and discoverResolvers() 2021-08-13 06:04:24 -04:00
package-lock.json Move tests from client (#9) 2022-04-28 17:42:01 -04:00
package.json Move tests from client (#9) 2022-04-28 17:42:01 -04:00
schema.js Tweak exports for use in web (#17) 2022-08-16 00:44:54 -04:00
utilities.js Zotero.Utilities.varDump(): Set maxLevel for all Nodes/Windows (#22) 2023-03-17 21:58:47 -04:00
utilities_item.js Add function to map localized language names to ISO codes (#16) 2023-03-17 22:07:07 -04:00
xregexp-all.js Initial commit 2021-07-23 16:20:21 +03:00
xregexp-unicode-zotero.js Initial commit 2021-07-23 16:20:21 +03:00

README.md

Zotero Utilities

Zotero utility code common across various codebases such as the Zotero client, Zotero translation architecture and others.

Item utility functions require:

  • Calling Zotero.Schema.init(json) with the JSON from schema.json from Zotero schema repo
  • Calling Zotero.Date.init(json) with the JSON from resource/dateFormats.json
  • Loading resource/zoteroTypeSchemaData.js before cachedTypes.js or in Node.js running
      let CachedTypes = require('./cachedTypes')
      CachedTypes.setTypeSchema(require('./resource/zoteroTypeSchemaData'))
    
  • Implementing Zotero.localeCompare(); a simple implementation would be
      let collator = new Intl.Collator(['en-US'], {
        numeric: true,
        sensitivity: 'base'
      });
      Zotero.localeCompare = (a, b) => collator.compare(a, b);
    

Please bundle the Zotero schema file with your repository, do not load it remotely.

To run tests: npm i && npm test.