Created
February 5, 2024 22:56
-
-
Save retorquere/b765166b9b280c08a25b13e94d3406ce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var CSL = require('citeproc') | |
var styleAsText = <contents of style.csl> | |
// Load your list of references | |
const references = { | |
item1: { | |
id: 'item1', | |
type: 'book', | |
title: 'Stuff', | |
}, | |
} | |
// Create a CSL engine | |
var sys = { | |
retrieveLocale: function (lang) { | |
const locale = <contents of locale xml file> | |
return locale | |
}, | |
retrieveItem: function (id) { | |
return references[id] | |
} | |
} | |
const citeproc = new CSL.Engine(sys, styleAsText) | |
// Specify the references to cite | |
citeproc.updateItems(Object.keys(references)) | |
// Generate the bibliography | |
var bib = citeproc.makeBibliography() | |
dump(bib[1].join('\n')) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment