citation-js using AGU style

node v18.11.0
version: 3.0.0
endpointsharetweet
This Runkit takes an AGU template and configures the CSL plugin within CitationJS to format a bibtex file using the AGU reference style guide.
AGU style XML:
const templateName = 'agu' const templateRes = await fetch('https://raw.githubusercontent.com/citation-style-language/styles/master/american-geophysical-union.csl') const template = await templateRes.text()
Sample Bibtex:
const request = await fetch('http://tug.ctan.org/tex-archive/macros/latex/contrib/aguplus/sample.bib') const bibsample = await request.text()
Configuring the plugin and output
const Cite = require('citation-js') const config = Cite.plugins.config.get('@csl') config.templates.add(templateName, template) const example = new Cite(bibsample, { style: 'bibtex' }); example.format('bibliography', { format: 'html', template: templateName, lang: 'en-US' })
Creating a merged citation
example.format('citation', { template: templateName, lang: 'en-US' })
Loading…

no comments

    sign in to comment