Skip to content

Monorepo for a suite of `unified`-compatible converters for converting between, from, and to .docx, JATS XML, LaTeX, and PDF

License

Notifications You must be signed in to change notification settings

TrialAndErrorOrg/parsers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JOTE Parsers

Monorepo for a suite of parsers used in the Journal of Trial and Error.

The goal is to automate the process of converting a manuscript from a word processor to a JATS XML file, which can then be used to generate a PDF and HTML version of the manuscript. Ideally this would allow authors to work in Word/Google Docs but still have the benefits of a modern publishing workflow.

The only current implementation is found at convert.centeroftrialanderror.com (very shodyy!).

Currently has 3 suites of parsers:

  • ooxast/reoff: Tools to parse, convert from, and create OOXML (.docx) XML. Currently only contains a parser and a converter to jats, plus some tools.
  • jats/rejour: Tools to parse, convert from, and create JATS XML. Currently contains a parser, stringifier, and a converter to texast, plus some tools.
  • texast/relatex: Tools to parse, convert from, and create LaTeX (DEPRECATED, use unified-latex instead). Only contains a way to generate LaTex from texast ASTs.

Additionally, there are a few other tools:

  • citations-: Tools to parse and convert citations.
  • ojs-: Things to operate on the OJS api
  • utils-: Various utilities

Finally, there are the processors, which are basically convenient wrappers around the parsers.

There is also an app directory, which contains a few apps that use the parsers, atm a really crappy frontend for converting from .docx.

See below for more info.

Dependency Graph

View an interactive dependency graph here Graph of this monorepo

Overview

Type definitions for crossref api responses

Convert crossref metadata to CSL

Try to resolve a list of CSL data with crossref metadata

Somewhat jank CSL-JSON to biblatex converter

Some typescript types for OJS api responses

Small tool that parses a string of text containing APA style in text citations, e.g. Jones (2020), and returns a rudimentary AST with the thing parsed.

Type definitions for jast (journal article/abstract syntax tree), a syntax for abstract syntax trees representing JATS XML, specifically the "Green" publishing tag set.

Transform a CSL list or object to a jast node.

Convert a jast citation syntax tree to list of csl objects.

Utility to convert a jast tree to a texast tree.

Transform HTML to Notion blocks

Plugin for rehype to turn HTML into Notion blocks

new default(«destructured»: object = {}): default;

Convert ojs data to relatex

Type definitions for ooxast (Open Office XML abstract syntax tree), a syntax for abstract syntax trees representing Open Office XML documents in the unist format.

Small ooxast utility which scans the text to identify the citation plugin used, either Mendely, Zotero, EndNote, Citavi, native word citations or none at all. It is used to feed into other things.

This package is ESM only. In Node.js (version 12.20+, 14.14+, 16.0+, 18.0+), install as

Get style from a w:p element.

Find and convert raw references to CSL-JSON using anystyle.

Find and convert raw references to CSL-JSON.

Find and convert raw references to CSL-JSON.

Return the properties of an ooxast node as a JSON object

Cleans all the rsid tags from an ooxast tree, and merges w:r elements if they only differ by rsid values.

Convert docx to html (Not working)

Util to convert ooxast syntax tree to jast syntax tree, allowing for .docx to JATS XML conversion.

Convert ooxast syntax tree to mdast syntax tree.

Convert ooxast syntax tree to unified-latex syntax tree.

processorsDocxToJats(): string;

DOCX to TeX converter

jatsToTex(jats: string): Promise;

docxToTex(input: Uint8Array, options: object = {}): Promise;

rejourFrontmatter(): Function;

Doesn't do anything atm

Really simple plugin for rejour that moves the abstract from the body to the front of a JATS document.

Parser for rejour that parses the JATS document to a jast tree.

Plugin for rejour that transforms a jast syntax tree into a texast syntax tree, allowing for conversion between JATS XML and LaTeX.

Plugin for rejour that stringifies a jast syntax tree to a JATS XML document.

Plugin for relatex that adds a preamble to a texast syntax tree.

Plugin for relatex that stringifies a texast syntax tree to a LaTeX file.

Reads a .docx file and stores its components in vfile format to be processed by other tools, like reoff-parse.

Plugin for reoff that parses citations in the form of @cite{key} and @cite[page]{key} using ooxast-util-parse-bib and ooxast-util-parse-text-cite.

Plugin for [reoff][reoff] to clean the ooxast tree.

Plugin for [reoff][reoff] to parse a .docx XML file into an ooxast AST. Ideally use docx-to-vfile to get to a parseable state.

Plugin for reoff which tries to find a bibliography in the document and parse it using ooxast-util-parse-bib.

Plugin for reoff which tries to find a bibliography in the document and parse it using ooxast-util-parse-bib.

Plugin for reoff that transforms an ooxast syntax tree into a jats syntax tree, i.e. converting .docx to JATS XML.

Plugin for reoff that takes an ooxast tree and turns it into a remark tree, allowing for .docx to .tex conversion

Plugin for reoff that takes an ooxast tree and turns it into a unified-latex tree, allowing for .docx to .tex conversion

DEPRECATED: Type definitions for texast (LaTeX abstract syntax tree), a syntax for abstract syntax trees representing LaTeX documents in the unist format.

Add a preamble to a texast syntax tree.

Convert a texast syntax tree to LaTeX.

Plugin for unified-latex that takes an unified-latex tree and turns it into LaTeX

tryCatchPromise(promise: Promise, errorHandler?: Function): Promise<[T | null, unknown | null]>;

This package is ESM only. In Node.js (version 12.20+, 14.14+, 16.0+, 18.0+), install as

This library was generated with Nx.

Port of hast-util-has-property for xast

Port of hast-util-is-element for xast

Port of (hast-util-select)[https://github.com/syntax-tree/hast-util-select] for use with xast nodes.

License

GPL-3.0+ © Thomas F. K. Jorna