reader

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindChapterIndexByTitle

func FindChapterIndexByTitle(r Reader, title string) int

func RestoreFromAnchor

func RestoreFromAnchor(r Reader, anchor ProgressAnchor)

Types

type EpubReader

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

func NewEpubReader

func NewEpubReader() *EpubReader

func (*EpubReader) BookTitle

func (epub *EpubReader) BookTitle() string

func (*EpubReader) Current

func (r *EpubReader) Current() string

func (*EpubReader) CurrentChapterIndex

func (epub *EpubReader) CurrentChapterIndex() int

func (*EpubReader) CurrentChapterTitle

func (epub *EpubReader) CurrentChapterTitle() string

func (*EpubReader) CurrentPos

func (r *EpubReader) CurrentPos() int

func (*EpubReader) CurrentView

func (r *EpubReader) CurrentView(lines int) string

func (*EpubReader) First

func (r *EpubReader) First() string

func (*EpubReader) GetProgress

func (epub *EpubReader) GetProgress() string

func (*EpubReader) GetTOC

func (epub *EpubReader) GetTOC() string

func (*EpubReader) GetTOCWithSelection

func (epub *EpubReader) GetTOCWithSelection(selected, pageSize int) string

func (*EpubReader) Goto

func (r *EpubReader) Goto(pos int) string

func (*EpubReader) GotoChapter

func (epub *EpubReader) GotoChapter(index int) string

func (*EpubReader) Last

func (r *EpubReader) Last() string

func (*EpubReader) Load

func (epub *EpubReader) Load(filePath string) error

func (*EpubReader) Next

func (r *EpubReader) Next() string

func (*EpubReader) NextChapter

func (epub *EpubReader) NextChapter() string

func (*EpubReader) Prev

func (r *EpubReader) Prev() string

func (*EpubReader) PrevChapter

func (epub *EpubReader) PrevChapter() string

func (*EpubReader) Reflow

func (epub *EpubReader) Reflow(width int)

func (*EpubReader) Search

func (r *EpubReader) Search(query string, start int, forward bool) (int, bool)

func (*EpubReader) Total

func (r *EpubReader) Total() int

type ProgressAnchor

type ProgressAnchor struct {
	Pos           int
	ChapterIndex  int
	ChapterOffset float64
	OverallRatio  float64
}

func AnchorFromReader

func AnchorFromReader(r Reader) ProgressAnchor

type Reader

type Reader interface {
	Load(path string) error
	Reflow(width int)
	BookTitle() string
	Current() string
	CurrentView(lines int) string
	Total() int
	Search(query string, start int, forward bool) (int, bool)
	Next() string
	Prev() string
	First() string
	Last() string
	CurrentPos() int
	Goto(pos int) string
	GetProgress() string
	CurrentChapterTitle() string
	CurrentChapterIndex() int
	NextChapter() string
	PrevChapter() string
	GetTOC() string
	GetTOCWithSelection(selected, pageSize int) string
	GotoChapter(index int) string
}

func ReaderFromSnapshot

func ReaderFromSnapshot(snapshot Snapshot, width int) (Reader, error)

type Snapshot

type Snapshot struct {
	Kind          string   `json:"kind"`
	Title         string   `json:"title,omitempty"`
	RawText       string   `json:"raw_text,omitempty"`
	ChapterText   []string `json:"chapter_text,omitempty"`
	ChapterTitles []string `json:"chapter_titles,omitempty"`
}

func SnapshotFromReader

func SnapshotFromReader(r Reader) (*Snapshot, bool)

type TxtReader

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

func NewTxtReader

func NewTxtReader() *TxtReader

func (*TxtReader) BookTitle

func (txt *TxtReader) BookTitle() string

func (*TxtReader) Current

func (r *TxtReader) Current() string

func (*TxtReader) CurrentChapterIndex

func (txt *TxtReader) CurrentChapterIndex() int

func (*TxtReader) CurrentChapterTitle

func (txt *TxtReader) CurrentChapterTitle() string

func (*TxtReader) CurrentPos

func (r *TxtReader) CurrentPos() int

func (*TxtReader) CurrentView

func (r *TxtReader) CurrentView(lines int) string

func (*TxtReader) First

func (r *TxtReader) First() string

func (*TxtReader) GetProgress

func (r *TxtReader) GetProgress() string

func (*TxtReader) GetTOC

func (txt *TxtReader) GetTOC() string

func (*TxtReader) GetTOCWithSelection

func (txt *TxtReader) GetTOCWithSelection(selected, pageSize int) string

func (*TxtReader) Goto

func (r *TxtReader) Goto(pos int) string

func (*TxtReader) GotoChapter

func (txt *TxtReader) GotoChapter(index int) string

func (*TxtReader) Last

func (r *TxtReader) Last() string

func (*TxtReader) Load

func (txt *TxtReader) Load(path string) error

func (*TxtReader) Next

func (r *TxtReader) Next() string

func (*TxtReader) NextChapter

func (txt *TxtReader) NextChapter() string

func (*TxtReader) Prev

func (r *TxtReader) Prev() string

func (*TxtReader) PrevChapter

func (txt *TxtReader) PrevChapter() string

func (*TxtReader) Reflow

func (txt *TxtReader) Reflow(width int)

func (*TxtReader) Search

func (r *TxtReader) Search(query string, start int, forward bool) (int, bool)

func (*TxtReader) Total

func (r *TxtReader) Total() int

Jump to

Keyboard shortcuts

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