Clone and edit this document
Runkit
Runkit
home page
user forum
new notebook
clone notebook
download notebook
support & documentation
log in
sign up
new notebook
help & feedback
clone this notebook
download this notebook
Sign In
Sign Up
citation-js using AGU style
node v18.11.0
version:
3.0.0
endpoint
share
tweet
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