@citation-js/plugin-refer
v0.2.0
Published
Citation.js plugin for the refer file format
Downloads
17
Maintainers
Readme
@citation-js/plugin-refer
This plugin adds support for the reference file format used by refer.
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)