Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_initProcessor () {
try {
// Load the engine with the current application language. As this citing
// is only for preview purposes, it should follow the language like the
// rest of the interface.
this._engine = new citeproc.Engine(this._sys, this._mainStyle, this._lang)
this._status = READY
this._loadIdHint()
} catch (e) {
console.error(e)
this._status = ERROR
}
}
constructor(style: string) {
const { instance } = Processor;
if (instance) {
if (instance.style !== style) {
instance.style = style;
instance.engine = new Engine(instance.sys, instance.style);
instance.engine.opt.development_extensions.wrap_url_and_doi = true;
}
return instance;
} else {
Processor.instance = this;
this.style = style;
this.engine = new Engine(this.sys, this.style);
this.engine.opt.development_extensions.wrap_url_and_doi = true;
}
}
/* eslint-enable @typescript-eslint/camelcase */
const fetchEngine = function (style, lang, template, retrieveItem, retrieveLocale) {
const engineHash = `${style}|${lang}`
let engine
if (engines.hasOwnProperty(engineHash)) {
engine = engines[engineHash]
engine.sys.retrieveItem = retrieveItem
} else {
engine = engines[engineHash] = new CSL.Engine({retrieveLocale, retrieveItem}, template, lang, true)
}
return engine
}