@citation-js/plugin-refer

0.2.0 • Public • Published

@citation-js/plugin-refer

This plugin adds support for the reference file format used by refer.

NPM version Codecov NPM total downloads License

Install

npm install @citation-js/plugin-refer

Use

Install the plugin by require-ing it:

require('@citation-js/plugin-refer')
const { Cite } = require('@citation-js/core')

// ...

Formats

Input

@refer/file

A text file in the refer format.

const data = Cite(`%A Lars G. Willighagen
%J PeerJ Computer Science
%E Silvio Peroni
%V 5
%D 2019 august 12
%P e214
%T Citation.js: a format-independent, modular bibliography tool for the browser and command line
`)

data.format('data', { format: 'object' }) // returns:
{
  author: [{ family: 'Willighagen', given: 'Lars G.' }],
  editor: [{ family: 'Peroni', given: 'Silvio' }],
  page: 'e214',
  volume: '5',
  'container-title': 'PeerJ Computer Science',
  title: 'Citation.js: a format-independent, modular bibliography tool for the browser and command line',
  issued: { 'date-parts': [[2019, 8, 12]] },
  type: 'article-journal'
}

Output

refer

data.format('refer', { format: 'text', lineEnding: '\n' })

Options:

  • format (string): 'text' (default; for plain text file) or 'object' (for array of objects)
  • lineEnding (string): e.g. '\n' (default) or '\r\n' (note that refer might not pick up on the latter)

Package Sidebar

Install

npm i @citation-js/plugin-refer

Weekly Downloads

12

Version

0.2.0

License

MIT

Unpacked Size

15.6 kB

Total Files

7

Last publish

Collaborators

  • larsgw