The set up is as follows:
- extract the Wikidata Q-codes (which creates references.qids)
- using Citation.js to format the reference as plain text
- number of the citations and create the bibliography
The first step uses a Groovy script, and the second a very short JavaScript script:
fs.readFile('references.qids', 'utf8',
async function (err, file) {
const data = Array.from(await Cite.async(file)).map(
item => item.id + '=' + Cite(item).format(
'bibliography', {template: 'vancouver'}
)
)
fs.writeFile('references.dat', data.join(''),
function() {}
)
})
The result looks like:
I have yet some things left to do, like add the DOI, and add some Markdown formatting. But the toolkit allows that but also is not urgent.
async function (err, file) {
const data = Array.from(await Cite.async(file)).map(
item => item.id + '=' + Cite(item).format(
'bibliography', {template: 'vancouver'}
)
)
fs.writeFile('references.dat', data.join(''),
function() {}
)
})
The result looks like:
I have yet some things left to do, like add the DOI, and add some Markdown formatting. But the toolkit allows that but also is not urgent.

No comments:
Post a Comment