How to use the @citation-js/core.Cite function in @citation-js/core

To help you get started, we’ve selected a few @citation-js/core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wikicite / wcite / lib / util / cite.js View on Github external
get: (ids, options = {}) => {
    require('@citation-js/plugin-wikidata')
    const languages = options.languages || []
    if (languages[0]) {
      plugins.config.get('@wikidata').langs = languages
    }
    return (Cite(ids) || { get: () => [] }).get().map(tidyCsl)
  },
github wikicite / wcite / lib / util / cite.js View on Github external
format: (items, format, options = {}) => {
    if (format === 'ndjson') {
      return items.map(item => JSON.stringify(item)).join('\n')
    } else if (format === 'json') {
      return JSON.stringify(items, null, 2)
    }

    const cite = new Cite(items)

    if (format === 'bibtex' || format === 'bibtxt') {
      require('@citation-js/plugin-bibtex')
    } else {
      require('@citation-js/plugin-csl')

      options.format = format
      if (format === 'text') {
        options.prepend = item => `${item.id}: `
      } else if (format !== 'html') {
        throw new Error(`unknown citation format ${format}`)
      }

      format = 'bibliography'
    }
github larsgw / citation.js / index.js View on Github external
function Cite (data, opts) {
  if (!(this instanceof Cite)) {
    return new Cite(data, opts)
  }

  var self = new core.Cite(data, opts)
  this._options = self._options
  this.log = self.log
  this.data = self.data
}