How to use astrocite-ris - 2 common examples

To help you get started, we’ve selected a few astrocite-ris 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 dsifford / academic-bloggers-toolkit / src / js / _legacy / dialogs / import / index.tsx View on Github external
parseFile = (content: string, fileExtension: string): void => {
        let payload: CSL.Data[];
        try {
            switch (fileExtension) {
                case '.ris':
                    payload = parseRis(content);
                    break;
                case '.bib':
                case '.bibtex':
                    payload = parseBibtex(content);
                    break;
                default:
                    throw new Error('Invalid FileType');
            }
        } catch (e) {
            this.setErrorMessage(ImportDialog.errors.filetype_error);
            this.setFile();
            this.setPayload([]);
            return;
        }

        if (payload.length === 0) {
github dsifford / academic-bloggers-toolkit / src / js / utils / file.ts View on Github external
export async function readReferencesFile(file: File): Promise {
    const extension = file.name
        .substring(file.name.lastIndexOf('.'))
        .toLowerCase();
    const content = await readFile(file);
    switch (extension) {
        case '.ris':
            return parseRis(content);
        case '.bib':
        case '.bibtex':
            return parseBibtex(content);
        default:
            throw new Error(`Invalid file extension: ${extension}`);
    }
}

astrocite-ris

Parser and AST for converting RIS to CSL JSON

MIT
Latest version published 4 years ago

Package Health Score

55 / 100
Full package analysis

Popular astrocite-ris functions