New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

tvim-parser

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tvim-parser

> This package implements parsing of the tvim articles which have certain TeX structure.

latest
Source
npmnpm
Version
0.0.2
Version published
Maintainers
1
Created
Source

tvim-parser

This package implements parsing of the tvim articles which have certain TeX structure.

Install

$ npm install tvim-parser

Usage

The formats parameter is expected to be an array of objects as follows:

[
    {
        name: "tvim_ref", // Name of this type of article
        tag: "^\\\\tvimRef\n", // JS-compatible regex of the corresponding TeX tag
        fields: [ // array of fields to extract, in order they appear in the TeX file
            "main_author",
            "authors",
            // ...
        ]
    },
    // ...
]

The contents parameter is expected to be a string with contents of the TeX file to parse. TeX file must have the following structure to be parsed correctly:

\tvimRef
{Author 1}
{Author 1, Author 2, \textit{Author 3}}

i. e. there should be a tag, followed by a sequence of parameters, enclosed in curly braces. Example usage:

const path = require('path');
const fs = require('fs');
const tvimParser = require('tvim-parser');

let formats = JSON.parse(fs.readFileSync(path.resolve('./test/formats.example.json'), 'utf8'));
let contents = fs.readFileSync(path.resolve('./test/example.tex'), 'utf8');

let result = tvimParser(formats, contents);

The result variable is expected to have the following value:

result = {
    tvim_ref: [
        {
            main_author: "Author 1",
            authors: "Author 1, Author 2, \\textit{Author 3}",
            // ..
        },
        // ...
    ],
    // ...
}

License

MIT

FAQs

Package last updated on 04 Jul 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts