kepub

package
v3.1.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 19, 2020 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package kepub provides functions for converting EPUBs to KEPUBs.

Index

Constants

This section is empty.

Variables

View Source
var Verbose = false // TODO: implement

Verbose controls whether this package writes verbose output (it is silent otherwise).

Functions

func FindOPF

func FindOPF(dir string) (string, error)

FindOPF finds the path to the first OPF package document in an unpacked EPUB.

func PackEPUB

func PackEPUB(dir, epub string) error

PackEPUB unpacks an EPUB to a file.

func UnpackEPUB

func UnpackEPUB(epub, dir string) error

UnpackEPUB unpacks an EPUB to a directory, which must be a nonexistent directory under an existing parent.

Types

type Converter

type Converter struct {
	// contains filtered or unexported fields
}

Converter converts EPUB2/EPUB3 books to KEPUB.

func NewConverter

func NewConverter() *Converter

NewConverter creates a new Converter. By default, no options are applied.

func NewConverterWithOptions

func NewConverterWithOptions(opts ...ConverterOption) *Converter

NewConverterWithOptions is like NewConverter, with options.

func (*Converter) Convert

func (c *Converter) Convert(dir string) error

Convert converts the dir as the root of an EPUB.

func (*Converter) ConvertEPUB

func (c *Converter) ConvertEPUB(epub, kepub string) error

ConvertEPUB converts an EPUB file.

func (*Converter) TransformContentDoc

func (c *Converter) TransformContentDoc(w io.Writer, r io.Reader) error

TransformContentDoc transforms an HTML4/HTML5/XHTML1.1 content document for a KEPUB.

func (*Converter) TransformContentDocFile

func (c *Converter) TransformContentDocFile(rws interface {
	io.ReadWriteSeeker
	Truncate(size int64) error
}) error

TransformContentDocFile is like TransformContentDoc, but works inplace.

func (*Converter) TransformOPF

func (c *Converter) TransformOPF(w io.Writer, r io.Reader) error

TransformOPF transforms the OPF document for a KEPUB.

func (*Converter) TransformOPFFile

func (c *Converter) TransformOPFFile(rws interface {
	io.ReadWriteSeeker
	Truncate(size int64) error
}) error

TransformOPFFile is like TransformOPF, but works inplace.

type ConverterOption

type ConverterOption func(*Converter)

ConverterOption configures a Converter.

func ConverterOptionAddCSS

func ConverterOptionAddCSS(css string) ConverterOption

ConverterOptionAddCSS adds CSS code to a book.

func ConverterOptionFindReplace

func ConverterOptionFindReplace(find, replace string) ConverterOption

ConverterOptionFindReplace replaces a raw string in the transformed HTML ( note that this reduces efficiency by requiring the HTML to be encoded into a temporary buffer before being written).

func ConverterOptionFullScreenFixes

func ConverterOptionFullScreenFixes() ConverterOption

ConverterOptionFullScreenFixes applies fullscreen fixes for firmwares older than 4.19.11911.

func ConverterOptionHyphenate

func ConverterOptionHyphenate(enabled bool) ConverterOption

ConverterOptionHyphenate enables or disables hyphenation. If not set, no specific state is enforced by kepubify.

func ConverterOptionSmartypants

func ConverterOptionSmartypants() ConverterOption

ConverterOptionSmartypants enables smart punctuation.

Directories

Path Synopsis
Command kobotest tests kepub span logic (only, not divs or other kepub stuff, which is pretty straightforward anyways) against other kepubs.
Command kobotest tests kepub span logic (only, not divs or other kepub stuff, which is pretty straightforward anyways) against other kepubs.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL