Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "r2epub"

This may be the conversion of a single HTML file (possibly pre-processed through ReSpec) or a collection of several HTML files. The usage of the entry point is:

Usage: r2epub [options] [url]

Convert the file or collection configuration at [url] to EPUB 3.2

Options:

-V, --version               output the version number
-o, --output <fname>        output file name.
                            If missing, the short name of the document is used
-r, --respec                the source must be pre-processed by ReSpec
                            (default: false)
-s, --specStatus <type>     specification type
-d, --publishDate <date>    publication date
-l, --addSectionLinks       add section links with "§".
-m, --maxTocLevel <number>  maximum TOC level
-p, --package               [debug option] do not generate an EPUB file,
                            just print the package file content.
                            (default: false)
-t, --trace                 [debug option] print built in trace information while
                            processing. (default: false)
-h, --help                  display help for command

For the -d, -s, -l, or -m flags, see the ReSpec manual. If any of those flags is set, -r is implied (i.e., it is not necessary to set it explicitly).

This function is a wrapper around the convert function.

Usage examples:

Convert the HTML file (as generated by ReSpec) to an EPUB 3.2 file. The generated publication's name is short-name.epub, where short-name is set in the ReSpec configuration:

node r2epub.js https://www.example.org/doc.html

Convert the HTML ReSpec source to an EPUB 3.2 file. The source is converted on-the-fly by respec:

node r2epub.js -r https://www.example.org/index.html

Convert the HTML ReSpec source to an EPUB 3.2 file, setting its spec status to REC. The source is converted on-the-fly by respec, overwriting the specStatus entry in the configuration to REC:

node r2epub.js -r --specStatus REC https://www.example.org/index.html

Convert the documents listed in the JSON configuration file to generate a collection of several documents:

node r2epub.js https://www.example.org/collection.json

where the collection may be something like:

{
  "title": "Specification for Underwater Basket Weaving",
  "name": "weaving",
  "chapters": [
       {
          "url": "https://www.example.org/first.html"
       },
      {
          "url": "https://www.example.org/second.html",
          "respec": false,
          "config": {}
      },
      {
          "url": "https://www.example.org/third.html",
          "respec": true,
          "config": {
              "maxTocLevel" : 3
          }
      }
  ]
}

See also some example collection configurations files.

Index

Variables

Functions

Variables

program

program: any

Functions

cli

  • cli(): Promise<void>
  • CLI to the ReSpec to EPUB 3.2 conversion.

    It is a simple interpretation of the command line, a wrapper around create_epub, and the output of the generated content to local directory.

    This function is automatically started when this module is used from a command line.

    async

    Returns Promise<void>