Table of Contents

TEXT

This is the documentation of the TEXT module that implements a text manipulation api.

Use import text from "hop:text";

This returns the text elements as a JavaScript array or arrays.

Example

Assuming the file hop.bib

@Article{ serrano:icfp21,
  author = {Serrano, M.},
  title = {Of AOT Compilation Performance},
  journal = "Proceedings of the ACM on Programming Languages",
  year = "2021",
  month = aug,
  doi = "10.1145/3473575",
  download = "https://dl.acm.org/doi/10.1145/3473575"
}

The following Hop program

"use hopscript"

import { bibtexParseFileSync } from "hop:text";

console.log(bibtexParseFileSync("hop.bib"));

outputs

[ { id: 'serrano:icfp21',
    type: 'ARTICLE',
    author: [ [Object] ],
    title: 'Of AOT Compilation Performance',
    journal: 'Proceedings of the ACM on Programming Languages',
    year: '2021',
    month: 'Aug',
    doi: '10.1145/3473575',

Functions

bibtextParse(fd, [callback])

bibtextParseSync(fd)

The argument fd is a file descriptor. If provided the argument callback is a procedure of two arguments, a error code, and a value. If no callback is provided, the function returns a promise.

bibtextParseFile(file, [callback])

bibtextParseFileSync(fd)

The argument fd is a file descriptor. If provided the argument callback is a procedure of two arguments, a error code, and a value. If no callback is provided, the function returns a promise.

bibtextParseString(string, [encoding = 'ascii'])

Parse a bibtex content file and return an JavaScript array of entries.