epub_cat: Pretty printing of EPUB text

View source: R/helpers.R

epub_catR Documentation

Pretty printing of EPUB text

Description

Print EPUB text to the console in a more readable format.

Usage

epub_cat(
  x,
  max_paragraphs = 10,
  skip = 0,
  paragraph_spacing = 1,
  paragraph_indent = 2,
  section_sep = "====",
  book_sep = "====\n===="
)

Arguments

x

a data frame returned by epub or a character string giving the EPUB filename(s).

max_paragraphs

integer, maximum number of paragraphs (non-empty lines) to cat to console.

skip

integer, number of paragraphs to skip.

paragraph_spacing

integer, number of empty lines between paragraphs.

paragraph_indent

integer, number of spaces to indent paragraphs.

section_sep

character, a string to indicate section breaks.

book_sep

character, separator shown between books when x has multiple rows (books).

Details

This function prints text from EPUB files to the console using cat. This is useful for quickly obtaining an overview of the book text parsed by epub that is easier to read that looking at strings in the table. max_paragraphs is set low by default to prevent accidentally printing entire books to the console. To print everything in x, set max_paragraphs = NULL.

Value

nothing is returned but a more readable format of the text content for books in x is printed to the console.

See Also

epub_head

Examples


file <- system.file("dracula.epub", package = "epubr")
d <- epub(file)
epub_cat(d, max_paragraphs = 2, skip = 147)


leonawicz/epubr documentation built on Sept. 15, 2023, 12:45 p.m.