Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FmtDuration ¶
FmtDuration formats a duration as "Xd Yh Zm" or "Yh Zm" if less than 24 hours
func ParseAuthorList ¶
ParseAuthorList splits s by '&', ',', and ';', trims each part, and returns non-empty names. Used for both EPUB creator lists and PDF author strings.
func SanitizeDescription ¶
SanitizeDescription returns sanitized HTML for use in Metadata.Description. If raw is empty or only whitespace, returns "". If raw contains no HTML (strict sanitize unchanged), wraps newline-separated paragraphs in <p>. Otherwise sanitizes with a policy that allows allowedDescriptionElements.
Types ¶
type EpubReader ¶
type EpubReader struct {
GetMetadataFromFile func(path string) (*epub.Information, error)
GetPackageFromFile func(path string) (*epub.PackageDocument, error)
}
func NewEpubReader ¶
func NewEpubReader() EpubReader
type Metadata ¶
type Metadata struct {
Title string
Authors []string
Illustrators []string
Description template.HTML
Language string
Publication precisiondate.PrecisionDate
Words float64
Series string
SeriesIndex float64
Pages float64
Format string
Subjects []string
Illustrations int
}
func BuildEpubMetadataFields ¶
func BuildEpubMetadataFields(meta *epub.Information, filename string) (Metadata, error)
BuildEpubMetadataFields maps pirmd/epub Information into Metadata (title, authors, dates, etc.). It does not open the EPUB: Illustrations and Words are left at zero unless set elsewhere. EpubReader.Metadata uses this then fills illustrations and word count from the package/zip.