Options
All
  • Public
  • Public/Protected
  • All
Menu

Wrapper around a single chapter. The main action is in the initialize method, which collects all the data and extracts additional data that are necessary elsewhere.

Hierarchy

  • Chapter

Index

Constructors

constructor

  • Parameters

    • args: ChapterConfiguration

      arguments needed to create the chapter’s OCF.

    • Default value first: boolean = false

      whether this is the first chapter in the book. Necessary, for example, to transfer the items listed in transfer_once for a book.

    Returns Chapter

Properties

Private _chapter_name

_chapter_name: string

Private _container

_container: JSZip

Private _date

_date: string

Private _editors

_editors: string[] = []

Private _first_chapter

_first_chapter: boolean = false

Private _identifier

_identifier: string

Private _manifest

_manifest: ManifestItem[] = []

Private _nav

_nav: string

Private _non_linear_spine_items

_non_linear_spine_items: string[] = []

Private _ocf

_ocf: OCF

Private _options

_options: Options

Private _title

_title: string

Private _url

_url: string

Private _wcag_conforms

_wcag_conforms: boolean = false

Accessors

chapter_name

  • get chapter_name(): string

date

  • get date(): string

editors

  • get editors(): string[]

first_chapter

  • get first_chapter(): boolean

identifier

  • get identifier(): string

name

  • get name(): string

nav

  • get nav(): string
  • The (HTML source) of the navigation file as a string.

    Returns string

non_linear_spine_items

  • get non_linear_spine_items(): string[]
  • The list of non-linear spine items as an array of strings (ie, the idref values), necessary to build the new OPF content.

    Returns string[]

opf_items

title

  • get title(): string

wcag_conforms

  • get wcag_conforms(): boolean

Methods

Private handle_cross_references

  • handle_cross_references(overview: string, target: Collection): string
  • Convert the Overview.xhtml file by converting the possible mutual references to other chapters

    Parameters

    Returns string

initialize

  • The real initialization must be done in a separate method and not in the constructor, because async actions are (heavily) involved...

    The method starts by running r2epub on the original arguments, and the uses the jszip methods (see the jszip documentation) to extract the content.

    The following items are extracted, and stored, from the chapter’s OCF:

    • The list of all the data items to be transferred, together with their media types (as a list of ManifestItem structures);
    • The list of editors;
    • The publication date;
    • The publication title;
    • The navigation file’s content (as a text).
    async

    Returns Promise<Chapter>

    • the value of this for an easier management on the caller side.

Private set_name

  • set_name(orig_name: string): string
  • Internal function: the name of the manifest item must be altered when stored in the final book to avoid clashes

    Parameters

    • orig_name: string

      the original name in the chapter

    Returns string

    • modified name

store_manifest_items

  • Store all the manifest items in the book, represented by its target OCF. This is based on the list collected in initialize.

    Parameters

    Returns void