epubcheck

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2023 License: BSD-2-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package epubcheck provides basic bindings to run and interpret `epubcheck` tool. Features are compatible with epubcheck v4 and correspond to a subset of https://github.com/w3c/epubcheck/tree/main/docs and https://www.w3.org/publishing/epubcheck/docs/messages/

Index

Constants

View Source
const (
	// Executable contains the path to EPUBcheck binary.
	Executable = "epubcheck"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Location

type Location struct {
	Path   string
	Line   int
	Column int
}

Location contains a description of where a Message is associated to.

type Message

type Message struct {
	ID         string
	Severity   string
	Message    string
	Suggestion string
	Locations  []Location
}

Message represents an EPUBcheck report message.

func (Message) String

func (msg Message) String() string

String provides a text representation of a Message.

type Report

type Report struct {
	Messages []*Message
}

Report represents an EPUBcheck's report.

func Run

func Run(path string, options ...string) (*Report, error)

Run executes EPUBcheck on the given EPUB. Additional options are added to EPUBcheck command line. By default, Run uses "--json -" command line to capture EPUBcheck report, therefore any additional command line argument that is not consistent with it shall be avoided.

func (Report) FilterMessagesByID

func (r Report) FilterMessagesByID(pattern string) *Report

FilterMessagesByID filters a Report to keep only Messages whose ID match the given glob pattern.

func (Report) FilterMessagesBySeverity

func (r Report) FilterMessagesBySeverity(pattern string) *Report

FilterMessagesBySeverity filters a Report to keep only Messages whose Severity match the given glob pattern.

Jump to

Keyboard shortcuts

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