Citation.js tutorial for adding styles

node v10.24.1
version: 1.0.0
endpointsharetweet
https://github.com/larsgw/citation.js/issues/204
const Cite = require('citation-js@0.5.0-alpha.7') const styleName = 'mla' const styleConfig = Cite.plugins.config.get('@csl') const styleData = Cite.util.fetchFile('https://zotero.org/styles/' + styleName) styleConfig.templates.add(styleName, styleData) styleConfig.templates.list()
const toFormat = Cite([ { type: 'book', title: 'Aesthetics of Interaction in Digital Art', author: [ { given: 'Katja', family: 'Kwastek', } ], // Note for 'issued': the order of the outer two brackets changed, from // [ { date-parts: [] } ] to { date-parts: [ [] ] } issued: { 'date-parts': [['2013']] }, // The publisher would be split into 'publisher' and 'publisher-place'. Unfortunately, // CSL-JSON has no way of specifying whether the place is a city etc publisher: 'MIT Press', 'publisher-place': 'Cambridge, MA, USA' } ])
toFormat.get({ type: 'html', style: 'citation-mla' })
toFormat.format('bibliography', { format: 'html', template: 'mla' })
Loading…

no comments

    sign in to comment