Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "clib/convert"

This is the core entry point for the management of collections. It is a layer on top of the “core” r2epub functionality, i.e., the creation of an EPUB 3 instance for an individual HTML document.

The general approach for the creation of collection is as follows:

  1. Each individual document reference (a.k.a. “chapters”) are generated by the core layer of r2epub. The resulting OCF contents are collected in a separate array of Chapter class instances
  2. A new OCF instance is created for the collection; the resources from each chapter are copied into this one, modifying the file names of the chapter on the fly. This means each charter is copied into its own subdirectory
  3. A new OPF file is created, collecting the relevant entries of the chapters’ respective OPF files, modifying the names on the fly
  4. A new navigation file is created, collecting and merging the navigation content of each individual chapter.
  5. A collection specific cover page is created.

See create_epub for further details.

Index

Functions

create_epub

  • create_epub(config_url: string, print_package?: boolean): Promise<OCF>
  • Creation of an OCF instance for the final book.

    The main processing steps are:

    1. Convert the user JSON configuration to the internal data structure (see get_book_configuration) and collect the data for the output target (see generate_book_data);
    2. Create (and store in the target’s OCF) the package file (see create_opf);
    3. Create (and store in the target’s OCF) the title page (see create_title_page);
    4. Create (and store in the target’s OCF) the navigation file for the whole book (see create_nav_page);
    5. Collect, from each Chapter the real content from the chapter’s OCF and copy it to the target’s OCF (with modified file path values).
    async

    Parameters

    • config_url: string

      the user supplied data, i.e., the result of JSON parsing of the input argument

    • Default value print_package: boolean = false

      whether the package stops at the creation of an EPUB content and displays the content of the OPF file itself (for debugging)

    Returns Promise<OCF>

    a Promise holding the final OCF content.

Const generate_book_data