Documentation ¶
Index ¶
- Variables
- func CompileTemplate(filename string) (*template.Template, error)
- func OverrideTemplate(filename string, content []byte)
- func RegisterShortcode(name string, handler ShortcodeHandler)
- func RetrieveTemplate(filename string) ([]byte, error)
- type Book
- func (e *Book) AddAsset(source, filename, mediaType string) error
- func (e *Book) AddChapterHTML(title string, body []string) error
- func (e *Book) AddChapterMD(title, body string) error
- func (e *Book) AddImage(source, filename string) error
- func (e *Book) AddImageFolder(source string) error
- func (e *Book) AddIntroductionHTML(title string, body []string) error
- func (e *Book) AddIntroductionMD(title string, body string) error
- func (e *Book) AddMDExtension(ext goldmark.Extender)
- func (e *Book) AddPostscriptHTML(title string, body []string) error
- func (e *Book) AddPostscriptMD(title, body string) error
- func (e *Book) Author() string
- func (e *Book) Description() string
- func (e *Book) Identifier() string
- func (e *Book) LookupAsset(assetFilename string) (string, bool)
- func (e *Book) LookupImage(imageFilename string) (string, bool)
- func (e *Book) Publisher() string
- func (e *Book) ReleaseDate() string
- func (e *Book) SetAuthor(author string)
- func (e *Book) SetCSS(source string) error
- func (e *Book) SetCover(source string) error
- func (e *Book) SetDescription(d string)
- func (e *Book) SetIdentifier(id string)
- func (e *Book) SetPublisher(pub string)
- func (e *Book) SetReleaseDate(t string)
- func (e *Book) SetTitle(t string)
- func (e *Book) Title() string
- func (e *Book) Write(filename string) error
- type FileRetrievalError
- type FilenameAlreadyUsedError
- type ShortcodeHandler
Constants ¶
This section is empty.
Variables ¶
var Debug = false
var ImageMediaTypes = map[string]string{
".png": "image/png",
".jpg": "image/jpeg",
".jpeg": "image/jpeg",
".svg": "image/svg+xml",
".webp": "image/webp",
".jxl": "image/jxl",
".gif": "image/gif",
".heif": "image/heif",
".avif": "image/avif",
}
Functions ¶
func CompileTemplate ¶ added in v1.0.0
func OverrideTemplate ¶ added in v1.0.0
OverrideTemplate will set a new template for the filename. Valid filenames are book.opf, chapter.xhtml, container.xml, cover.xhtml, main.css, toc.ncx, and toc.xhtml.
func RegisterShortcode ¶ added in v1.0.0
func RegisterShortcode(name string, handler ShortcodeHandler)
func RetrieveTemplate ¶ added in v1.0.0
RetrieveTemplate returns either the default template or an overridden template for the filename
Types ¶
type Book ¶ added in v1.0.0
Epub implements an EPUB file.
func (*Book) AddChapterHTML ¶ added in v1.0.0
func (*Book) AddChapterMD ¶ added in v1.0.0
func (*Book) AddImageFolder ¶ added in v1.0.0
func (*Book) AddIntroductionHTML ¶ added in v1.0.0
func (*Book) AddIntroductionMD ¶ added in v1.0.0
func (*Book) AddMDExtension ¶ added in v1.0.0
AddMDExtension adds another extension to goldmark. Note that the Table, Strikethrough, and Definition List extensions are already added.
func (*Book) AddPostscriptHTML ¶ added in v1.0.0
func (*Book) AddPostscriptMD ¶ added in v1.0.0
func (*Book) Description ¶ added in v1.0.0
func (*Book) Identifier ¶ added in v1.0.0
func (*Book) LookupAsset ¶ added in v1.0.0
func (*Book) LookupImage ¶ added in v1.0.0
func (*Book) ReleaseDate ¶ added in v1.0.0
func (*Book) SetCSS ¶ added in v1.0.0
SetCSS will set the CSS file for the book. It is not recommended to call this more than once for a book.
func (*Book) SetDescription ¶ added in v1.0.0
func (*Book) SetIdentifier ¶ added in v1.0.0
func (*Book) SetPublisher ¶ added in v1.0.0
func (*Book) SetReleaseDate ¶ added in v1.0.0
type FileRetrievalError ¶ added in v0.4.0
type FileRetrievalError struct { Source string // The source of the file whose retrieval failed Err error // The underlying error that was thrown }
FileRetrievalError is thrown by AddCSS, AddFont, AddImage, or Write if there was a problem retrieving the source file that was provided.
func (*FileRetrievalError) Error ¶ added in v0.4.0
func (e *FileRetrievalError) Error() string
type FilenameAlreadyUsedError ¶ added in v0.4.0
type FilenameAlreadyUsedError struct {
Filename string // Filename that caused the error
}
FilenameAlreadyUsedError is thrown by AddCSS, AddFont, AddImage, or AddSection if the same filename is used more than once.
func (*FilenameAlreadyUsedError) Error ¶ added in v0.4.0
func (e *FilenameAlreadyUsedError) Error() string