Documentation
¶
Overview ¶
Package fb2parse contains tools for parsing fb2-files
Index ¶
- func GetContent(tokenName string, reader xml.TokenReader) (res string, err error)
- func NewDecoder(reader io.Reader) *xml.Decoder
- func SkipToken(tokenName string, reader xml.TokenReader) (err error)
- func Unmarshal(data []byte, v any) error
- type FB2Annotation
- type FB2Author
- type FB2Binary
- type FB2Body
- type FB2Cover
- type FB2CustomInfo
- type FB2Description
- type FB2DocInfo
- type FB2File
- type FB2Image
- type FB2Publisher
- type FB2Sequence
- type FB2TitleInfo
- type HandlingRule
- type TokenHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetContent ¶
func GetContent(tokenName string, reader xml.TokenReader) (res string, err error)
GetContent returns xml token inner content.
func NewDecoder ¶
NewDecoder creates decoder for fb2 xml data.
Types ¶
type FB2Annotation ¶
type FB2Annotation struct {
HTML string `xml:",innerxml"`
}
FB2Annotation struct of fb2 annotation. http://www.fictionbook.org/index.php/Элемент_annotation
func NewFB2Annotation ¶
func NewFB2Annotation(tokenName string, reader xml.TokenReader) (res FB2Annotation, err error)
NewFB2Annotation factory for FB2Annotation.
type FB2Author ¶
type FB2Author struct {
FirstName []string `xml:"first-name"`
MiddleName []string `xml:"middle-name"`
LastName []string `xml:"last-name"`
Nickname []string `xml:"nickname"`
HomePage []string `xml:"home-page"`
Email []string `xml:"email"`
ID []string `xml:"id"`
}
FB2Author struct of fb2 author. http://www.fictionbook.org/index.php/Элемент_author
func NewFB2Author ¶
func NewFB2Author(tokenName string, reader xml.TokenReader) (res FB2Author, err error)
NewFB2Author factory for FB2Author.
type FB2Binary ¶
type FB2Binary struct {
ContentType string `xml:"content-type,attr"`
ID string `xml:"id,attr"`
Data string `xml:",innerxml"`
}
FB2Binary struct of fb2 binary data. http://www.fictionbook.org/index.php/Элемент_binary
func NewFB2Binary ¶
func NewFB2Binary(token xml.StartElement, reader xml.TokenReader) (res FB2Binary, err error)
NewFB2Binary factory for FB2Binary.
type FB2Body ¶
type FB2Body struct {
HTML string `xml:",innerxml"`
}
FB2Body struct of fb2 body. http://www.fictionbook.org/index.php/Элемент_body
func NewFB2Body ¶
func NewFB2Body(tokenName string, reader xml.TokenReader) (res FB2Body, err error)
NewFB2Body factory for FB2Body.
type FB2Cover ¶
type FB2Cover struct {
Images []FB2Image `xml:"image"`
}
FB2Cover struct of fb2 cover page. http://www.fictionbook.org/index.php/Элемент_coverpage
func NewFB2Cover ¶
func NewFB2Cover(tokenName string, reader xml.TokenReader) (res FB2Cover, err error)
NewFB2Cover factory for FB2Cover.
type FB2CustomInfo ¶
FB2CustomInfo struct of fb2 custom info. http://www.fictionbook.org/index.php/Элемент_custom-info
func NewFB2CustomInfo ¶
func NewFB2CustomInfo(token xml.StartElement, reader xml.TokenReader) (res FB2CustomInfo, err error)
NewFB2CustomInfo factory for FB2CustomInfo.
type FB2Description ¶
type FB2Description struct {
TitleInfo []FB2TitleInfo `xml:"title-info"`
SrcTitleInfo []FB2TitleInfo `xml:"src-title-info"`
DocInfo []FB2DocInfo `xml:"document-info"`
PublishInfo []FB2Publisher `xml:"publish-info"`
CustomInfo []FB2CustomInfo `xml:"custom-info"`
}
FB2Description struct of fb2 description. http://www.fictionbook.org/index.php/Элемент_description
func NewFB2Description ¶
func NewFB2Description( tokenName string, reader xml.TokenReader, rules []HandlingRule, ) (res FB2Description, err error)
NewFB2Description factory for FB2Description.
type FB2DocInfo ¶
type FB2DocInfo struct {
Authors []FB2Author `xml:"author"`
SrcURL []string `xml:"src-url"`
ID []string `xml:"id"`
Version []string `xml:"version"`
Publishers []FB2Author `xml:"publisher"`
}
FB2DocInfo struct of fb2 document info. http://www.fictionbook.org/index.php/Элемент_document-info
func NewFB2DocInfo ¶
func NewFB2DocInfo( tokenName string, reader xml.TokenReader, rules []HandlingRule, ) (res FB2DocInfo, err error)
NewFB2DocInfo factory for NewFB2DocInfo.
type FB2File ¶
type FB2File struct {
Description []FB2Description `xml:"description"`
// Body []FB2Body `xml:"body"`
Binary []FB2Binary `xml:"binary"`
}
FB2File struct of fb2 file. http://www.fictionbook.org/index.php/Элемент_FictionBook http://www.fictionbook.org/index.php/Описание_формата_FB2_от_Sclex
func NewFB2File ¶
func NewFB2File(doc *xml.Decoder, rules ...HandlingRule) (res FB2File, err error)
NewFB2File factory for FB2File.
type FB2Image ¶
type FB2Image struct {
Type string `xml:"type,attr"`
Href string `xml:"href,attr"`
Alt string `xml:"alt,attr"`
Title string `xml:"title,attr"`
ID string `xml:"id,attr"`
}
FB2Image struct of fb2 image. http://www.fictionbook.org/index.php/Элемент_image
func NewFB2Image ¶
func NewFB2Image(token xml.StartElement) (res FB2Image, err error)
NewFB2Image factory for FB2Image.
type FB2Publisher ¶
type FB2Publisher struct {
BookAuthor []string `xml:"book-author"`
BookName []string `xml:"book-name"`
Publisher []string `xml:"publisher"`
City []string `xml:"city"`
Year []string `xml:"year"`
ISBN []string `xml:"isbn"`
Sequence []FB2Sequence `xml:"sequence"`
}
FB2Publisher struct of fb2 publisher info. http://www.fictionbook.org/index.php/Элемент_publish-info
func NewFB2Publisher ¶
func NewFB2Publisher( tokenName string, reader xml.TokenReader, rules []HandlingRule, ) (res FB2Publisher, err error)
NewFB2Publisher factory for FB2Publisher.
type FB2Sequence ¶
FB2Sequence struct of fb2 sequence info. http://www.fictionbook.org/index.php/Элемент_sequence
func NewFB2Sequence ¶
func NewFB2Sequence(token xml.StartElement) (res FB2Sequence, err error)
NewFB2Sequence factory for FB2Sequence.
type FB2TitleInfo ¶
type FB2TitleInfo struct {
Genre []string `xml:"genre"`
Author []FB2Author `xml:"author"`
BookTitle []string `xml:"book-title"`
Annotation []FB2Annotation `xml:"annotation"`
Keywords []string `xml:"keywords"`
Date []string `xml:"date"`
Coverpage []FB2Cover `xml:"coverpage"`
Lang []string `xml:"lang"`
SrcLang []string `xml:"src-lang"`
Translator []FB2Author `xml:"translator"`
Sequence []FB2Sequence `xml:"sequence"`
}
FB2TitleInfo struct of fb2 title info. http://www.fictionbook.org/index.php/Элемент_title-info
func NewFB2TitleInfo ¶
func NewFB2TitleInfo( tokenName string, reader xml.TokenReader, rules []HandlingRule, ) (res FB2TitleInfo, err error)
NewFB2TitleInfo factory for FB2TitleInfo.
type HandlingRule ¶ added in v0.10.0
type HandlingRule func(next TokenHandler) TokenHandler
HandlingRule middleware for TokenHandler.
type TokenHandler ¶ added in v0.10.0
type TokenHandler func(section interface{}, node xml.StartElement, r xml.TokenReader) error
TokenHandler handler for fb2 tokens.