larsgw / citation.js

Citation.js converts formats like BibTeX, Wikidata JSON and ContentMine JSON to CSL-JSON to convert to other formats like APA, Vancouver and back to BibTeX.
https://citation.js.org/
MIT License
226 stars 30 forks source link

Option to make CSL use initial sorting #85

Closed larsgw closed 6 years ago

larsgw commented 7 years ago

With nosort.

larsgw commented 7 years ago

Possibly with a sort output option. Anyway, sort by label with some built-in sorting callback factories, i.e.:

const data = new Cite(..., ...)

const labelOrder = ['label2001a', ..., 'label2005u']
const sortCallback = Cite.sort.byLabel(labelOrder)

data.sort(sortCallback).get({
  nosort: true,
  ...
})

or

const data = new Cite(..., ...)

const labelOrder = ['label2001a', ..., 'label2005u']

data.get({
  sort: Cite.sort.byLabel(labelOrder),
  ...
})