Documentation ¶
Index ¶
- type Annotation
- type Author
- type Binary
- type Body
- type CharData
- type Cite
- type Contenter
- type Coverpage
- type CustomInfo
- type Date
- type Description
- type DocGenerationInstruction
- type DocumentInfo
- type EmptyLine
- type Epigraph
- type FictionBook
- type Genre
- type Image
- type InlineImage
- type Link
- type NamedStyleType
- type Node
- type NotesBody
- type OutPutDocument
- type P
- type Parser
- type PartShareInstruction
- type Poem
- type PublishInfo
- type Section
- type Sequence
- type ShareInstruction
- type ShareMode
- type Stanza
- type StyleLinkType
- type StyleType
- type Stylesheet
- type TD
- type TR
- type Table
- type TextField
- type Title
- type TitleInfo
- type XMLDate
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Annotation ¶
type Annotation struct { ID string `xml:"id,omitempty"` Lang string `xml:"http://www.w3.org/XML/1998/namespace lang,attr,omitempty"` // contains filtered or unexported fields }
Annotation https://github.com/gribuser/fb2/blob/14b5fcc6/FictionBook.xsd#L381 A cut-down version of "section" used in annotations
func (Annotation) GetContent ¶
func (c Annotation) GetContent() []Contenter
GetContent return content
func (Annotation) GetText ¶
func (c Annotation) GetText() []byte
GetText return nil All text in CharData type
func (*Annotation) UnmarshalXML ¶
func (a *Annotation) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML unmarshal xml to FictionBook struct
type Author ¶
type Author struct { FirstName *TextField `xml:"first-name,omitempty"` MiddleName *TextField `xml:"middle-name,omitempty"` LastName *TextField `xml:"last-name,omitempty"` Nickname *TextField `xml:"nickname,omitempty"` HomePages []string `xml:"home-page,omitempty"` Emails []string `xml:"email,omitempty"` ID string `xml:"id,omitempty"` // contains filtered or unexported fields }
Author https://github.com/gribuser/fb2/blob/14b5fcc6/FictionBook.xsd#L233 Information about a single author
func (*Author) GetXMLName ¶
func (*Author) SetXMLName ¶
func (*Author) UnmarshalXML ¶
UnmarshalXML unmarshal XML
type Binary ¶
type Binary struct { ID string `xml:"id,attr"` ContentType string `xml:"content-type,attr"` Value []byte `xml:",chardata"` // contains filtered or unexported fields }
Binary https://github.com/gribuser/fb2/blob/14b5fcc6/FictionBook.xsd#L217 Any binary data that is required for the presentation of this book in base64 format. Currently only images are used
func (*Binary) GetXMLName ¶
func (*Binary) SetXMLName ¶
func (*Binary) UnmarshalXML ¶
UnmarshalXML decode from base64
type Body ¶
type Body struct { // Image to be displayed at the top of this section Image *Image `xml:"image,omitempty"` // A fancy title for the entire book, should be used if the simple text version // in "description"; is not adequate, e.g. the book title has multiple paragraphs // and/or character styles Title *Title `xml:"title,omitempty"` // Epigraph(s) for the entire book, if any Epigraphs []*Epigraph `xml:"epigraph,omitempty"` Sections []*Section `xml:"section"` Lang string `xml:"http://www.w3.org/XML/1998/namespace lang,attr,omitempty"` // contains filtered or unexported fields }
Body https://github.com/gribuser/fb2/blob/14b5fcc6/FictionBook.xsd#L31 Main content of the book, multiple bodies are used for additional information, like footnotes, that do not appear in the main book flow (extended from this class). The first body is presented to the reader by default, and content in the other bodies should be accessible by hyperlinks.
func (*Body) GetXMLName ¶
func (*Body) SetXMLName ¶
func (*Body) UnmarshalXML ¶
UnmarshalXML unmarshal XML to Body
type CharData ¶
A CharData represents raw text
func (CharData) GetContent ¶
GetContent return nil, because CharData contains only raw text
func (CharData) GetXMLName ¶
GetXMLName return empty string for raw text
type Cite ¶
type Cite struct { ID string `xml:"id,omitempty"` Lang string `xml:"http://www.w3.org/XML/1998/namespace lang,attr,omitempty"` TextAuthor []*P `xml:"text-author,omitempty"` // contains filtered or unexported fields }
Cite https://github.com/gribuser/fb2/blob/14b5fcc6/FictionBook.xsd#L304 A citation with an optional citation author at the end
func (*Cite) UnmarshalXML ¶
UnmarshalXML unmarshal XML to Cite
type Coverpage ¶
type Coverpage struct { Image *InlineImage `xml:"image"` // contains filtered or unexported fields }
Coverpage https://github.com/gribuser/fb2/blob/14b5fcc6/FictionBook.xsd#L621
func (*Coverpage) GetXMLName ¶
func (*Coverpage) SetXMLName ¶
func (*Coverpage) UnmarshalXML ¶
UnmarshalXML unmarshal XML
type CustomInfo ¶
CustomInfo https://github.com/gribuser/fb2/blob/14b5fcc6/FictionBook.xsd#L191
func (*CustomInfo) GetXMLName ¶
func (*CustomInfo) SetXMLName ¶
func (*CustomInfo) UnmarshalXML ¶
func (ci *CustomInfo) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML unmarshal XML
type Date ¶
type Date struct { Value *XMLDate `xml:"value,attr,omitempty"` Lang string `xml:"http://www.w3.org/XML/1998/namespace lang,attr,omitempty"` StrValue string `xml:",chardata"` // contains filtered or unexported fields }
Date https://github.com/gribuser/fb2/blob/14b5fcc6/FictionBook.xsd#L262 A human readable date, maybe not exact, with an optional computer readable variant
func (*Date) GetXMLName ¶
func (*Date) SetXMLName ¶
func (*Date) UnmarshalXML ¶
UnmarshalXML unmarshal XML
type Description ¶
type Description struct { // Generic information about the book TitleInfo *TitleInfo `xml:"title-info"` // Generic information about the original book (for translations) SrcTitleInfo *TitleInfo `xml:"src-title-info,omitempty"` // Information about this particular (xml) document DocumentInfo *DocumentInfo `xml:"document-info"` // Information about some paper/outher published document, // that was used as a source of this xml document PublishInfo *PublishInfo `xml:"publish-info,omitempty"` // Any other information about the book/document // that didn't fit in the above groups CustomInfo []*CustomInfo `xml:"custom-info,omitempty"` // Describes, how the document should be presented to end-user, what parts // are free, what parts should be sold and what price should be used Output []*ShareInstruction `xml:"output,omitempty"` // contains filtered or unexported fields }
Description https://github.com/gribuser/fb2/blob/14b5fcc6/FictionBook.xsd#L90
func (*Description) GetXMLName ¶
func (*Description) SetXMLName ¶
func (*Description) UnmarshalXML ¶
func (d *Description) UnmarshalXML(dec *xml.Decoder, start xml.StartElement) error
UnmarshalXML unmarshal XML
type DocGenerationInstruction ¶
type DocGenerationInstruction string
DocGenerationInstruction https://github.com/gribuser/fb2/blob/14b5fcc6/FictionBook.xsd#L671 List of instructions to process sections (allow|deny|require)
type DocumentInfo ¶
type DocumentInfo struct { // Author(s) of this particular document Authors []*Author `xml:"author"` // Any software used in preparation of this document, in free format ProgramUsed *TextField `xml:"program-used"` // Date this document was created, same guidelines as in the <title-info> section apply Date *Date `xml:"date"` // Source URL if this document is a conversion of some other (online) document SrcURLs []string `xml:"src-url"` // Author of the original (online) document, if this is a conversion SrcOcr *TextField `xml:"src-ocr"` // this is a unique identifier for a document. this must not change ID string `xml:"id"` // Document version, in free format, should be incremented if the document is changed and re-released to the public Version float64 `xml:"version"` // Short description for all changes made to this document, like "Added missing chapter 6", in free form. History *Annotation `xml:"history"` // Owner of the fb2 document copyrights Publishers []*Author `xml:"publisher"` // contains filtered or unexported fields }
DocumentInfo https://github.com/gribuser/fb2/blob/14b5fcc6/FictionBook.xsd#L102
func (*DocumentInfo) GetXMLName ¶
func (*DocumentInfo) SetXMLName ¶
func (*DocumentInfo) UnmarshalXML ¶
func (di *DocumentInfo) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML unmarshal XML
type EmptyLine ¶
type EmptyLine struct { XMLName xml.Name `xml:"empty-line"` // contains filtered or unexported fields }
EmptyLine -- dummy struct for <empty-line/>
func (EmptyLine) GetContent ¶
func (e EmptyLine) GetContent() []Contenter
type Epigraph ¶
type Epigraph struct { ID string `xml:"id,omitempty"` TextAuthor []*P `xml:"text-author,omitempty"` // contains filtered or unexported fields }
Epigraph https://github.com/gribuser/fb2/blob/14b5fcc6/FictionBook.xsd#L366 An epigraph
func (Epigraph) GetText ¶
func (c Epigraph) GetText() []byte
GetText return nil All text in CharData type
func (*Epigraph) UnmarshalXML ¶
UnmarshalXML unmarshal XML to Epigraph
type FictionBook ¶
type FictionBook struct { Stylesheet []*Stylesheet Description *Description Body *Body NotesBody *NotesBody Binary []*Binary // contains filtered or unexported fields }
FictionBook describe book scheme based on https://github.com/gribuser/fb2/blob/14b5fcc6/FictionBook.xsd#L71
func (*FictionBook) GetXMLName ¶
func (*FictionBook) SetXMLName ¶
func (*FictionBook) UnmarshalXML ¶
func (f *FictionBook) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML unmarshal XML
type Genre ¶
type Genre struct { Match *int `xml:"match,attr,omitempty"` Genre string `xml:",chardata"` // contains filtered or unexported fields }
Genre https://github.com/gribuser/fb2/blob/14b5fcc6/FictionBook.xsd#L581
func (*Genre) GetXMLName ¶
func (*Genre) SetXMLName ¶
func (*Genre) UnmarshalXML ¶
UnmarshalXML unmarshal XML
type Image ¶
type Image struct { XlinkType string `xml:"http://www.w3.org/1999/xlink type,attr,omitempty"` XlinkHref string `xml:"http://www.w3.org/1999/xlink href,attr,omitempty"` Alt string `xml:"alt,attr,omitempty"` Title string `xml:"title,attr,omitempty"` ID string `xml:"id,attr,omitempty"` // contains filtered or unexported fields }
Image https://github.com/gribuser/fb2/blob/14b5fcc6/FictionBook.xsd#L283 An empty element with an image name as an attribute
func (Image) GetContent ¶
func (e Image) GetContent() []Contenter
type InlineImage ¶
type InlineImage struct { XlinkType string `xml:"http://www.w3.org/1999/xlink type,attr,omitempty"` XlinkHref string `xml:"http://www.w3.org/1999/xlink href,attr,omitempty"` Alt string `xml:"alt,attr,omitempty"` // contains filtered or unexported fields }
InlineImage https://github.com/gribuser/fb2/blob/14b5fcc6/FictionBook.xsd#L712 It's Contenter, but has no text or "child" content
func (InlineImage) GetContent ¶
func (e InlineImage) GetContent() []Contenter
func (*InlineImage) UnmarshalXML ¶
func (i *InlineImage) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML unmarshal XML to InlineImage
type Link ¶
type Link struct { StyleLinkType XlinkType string `xml:"http://www.w3.org/1999/xlink type,attr,omitempty"` XlinkHref string `xml:"http://www.w3.org/1999/xlink href,attr"` Type string `xml:"type,attr,omitempty"` }
Link https://github.com/gribuser/fb2/blob/14b5fcc6/FictionBook.xsd#L488 Generic hyperlinks. Cannot be nested. Footnotes should be implemented by links referring to additional bodies in the same document
func (*Link) UnmarshalXML ¶
UnmarshalXML unmarshal XML to Link
type NamedStyleType ¶
NamedStyleType https://github.com/gribuser/fb2/blob/14b5fcc6/FictionBook.xsd#L470 Markup
func (*NamedStyleType) UnmarshalXML ¶
func (s *NamedStyleType) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML unmarshal XML to NamedStyleType
type Node ¶
type Node interface { SetXMLName(xml.Name) GetXMLName() xml.Name // contains filtered or unexported methods }
Node define the basic interface for XML nodes
type NotesBody ¶
NotesBody https://github.com/gribuser/fb2/blob/14b5fcc6/FictionBook.xsd#L55 Body for footnotes, content is mostly similar to base type and may (!) be rendered in the pure environment "as is". Advanced reader should treat section[2]/section as endnotes, all other stuff as footnotes
func (*NotesBody) GetXMLName ¶
func (*NotesBody) SetXMLName ¶
func (*NotesBody) UnmarshalXML ¶
UnmarshalXML unmarshal XML to NotesBody
type OutPutDocument ¶
type OutPutDocument struct { Name string `xml:"name,attr"` Create DocGenerationInstruction `xml:"create,attr,omitempty"` Price float64 `xml:"price,attr,omitempty"` Parts []*PartShareInstruction `xml:"part,omitempty"` // contains filtered or unexported fields }
OutPutDocument https://github.com/gribuser/fb2/blob/14b5fcc6/FictionBook.xsd#L689 Selector for output documents. Defines, which rule to apply to any specific output documents
func (*OutPutDocument) GetXMLName ¶
func (*OutPutDocument) SetXMLName ¶
func (*OutPutDocument) UnmarshalXML ¶
func (od *OutPutDocument) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML unmarshal XML
type P ¶
type P struct { StyleType ID string `xml:"id,attr,omitempty"` Style string `xml:"style,attr,omitempty"` }
P https://github.com/gribuser/fb2/blob/14b5fcc6/FictionBook.xsd#L293 A basic paragraph, may include simple formatting inside
func (*P) UnmarshalXML ¶
UnmarshalXML unmarshal XML to P
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser parse xml document
type PartShareInstruction ¶
type PartShareInstruction struct { // contains filtered or unexported fields }
PartShareInstruction https://github.com/gribuser/fb2/blob/14b5fcc6/FictionBook.xsd#L681 Pointer to specific document section, explaining how to deal with it
func (*PartShareInstruction) GetXMLName ¶
func (*PartShareInstruction) SetXMLName ¶
func (*PartShareInstruction) UnmarshalXML ¶
func (psi *PartShareInstruction) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML unmarshal XML
type Poem ¶
type Poem struct { // Poem title XMLName xml.Name `xml:"poem"` Title *Title `xml:"title,omitempty"` // Poem epigraph(s), if any Epigraphs []*Epigraph `xml:"epigraph,omitempty"` // contains filtered or unexported fields }
Poem https://github.com/gribuser/fb2/blob/14b5fcc6/FictionBook.xsd#L321 A poem
func (*Poem) UnmarshalXML ¶
UnmarshalXML unmarshal XML to StyleType
type PublishInfo ¶
type PublishInfo struct { // Original (paper) book name BookName *TextField `xml:"book-name,omitempty"` // Original (paper) book publisher Publisher *TextField `xml:"publisher,omitempty"` // City where the original (paper) book was published City *TextField `xml:"city,omitempty"` // Year of the original (paper) publication Year string `xml:"year,omitempty"` ISBN *TextField `xml:"isbn,omitempty"` Sequences []*Sequence `xml:"sequence,omitempty"` // contains filtered or unexported fields }
PublishInfo https://github.com/gribuser/fb2/blob/14b5fcc6/FictionBook.xsd#L160
func (*PublishInfo) GetXMLName ¶
func (*PublishInfo) SetXMLName ¶
func (*PublishInfo) UnmarshalXML ¶
func (pi *PublishInfo) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML unmarshal XML
type Section ¶
type Section struct { // Section's title Title *Title `xml:"title,omitempty"` // Epigraph(s) for this section Epigraphs []*Epigraph `xml:"epigraph,omitempty"` // Image to be displayed at the top of this section Image *Image `xml:"image,omitempty"` // Annotation for this section, if any Annotation *Annotation `xml:"annotation,omitempty"` // or child Sections Sections []*Section `xml:"section,omitempty"` ID string `xml:"id,omitempty"` Lang string `xml:"http://www.w3.org/XML/1998/namespace lang,attr,omitempty"` // contains filtered or unexported fields }
Section https://github.com/gribuser/fb2/blob/14b5fcc6/FictionBook.xsd#L396 A basic block of a book, can contain more child sections or textual content
func (Section) GetText ¶
func (c Section) GetText() []byte
GetText return nil All text in CharData type
func (*Section) UnmarshalXML ¶
UnmarshalXML unmarshal XML to Section
type Sequence ¶
type Sequence struct { Sequences []*Sequence `xml:"sequence,omitempty"` Name string `xml:"name,attr"` Number int `xml:"number,attr"` // contains filtered or unexported fields }
Sequence https://github.com/gribuser/fb2/blob/14b5fcc6/FictionBook.xsd#L521 Book sequences
func (*Sequence) GetXMLName ¶
func (*Sequence) SetXMLName ¶
func (*Sequence) UnmarshalXML ¶
UnmarshalXML unmarshal XML
type ShareInstruction ¶
type ShareInstruction struct { // contains filtered or unexported fields }
ShareInstruction https://github.com/gribuser/fb2/blob/14b5fcc6/FictionBook.xsd#L649 In-document instruction for generating output free and payed documents
func (*ShareInstruction) GetXMLName ¶
func (*ShareInstruction) SetXMLName ¶
func (*ShareInstruction) UnmarshalXML ¶
func (si *ShareInstruction) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML unmarshal XML
type ShareMode ¶
type ShareMode string
ShareMode https://github.com/gribuser/fb2/blob/14b5fcc6/FictionBook.xsd#L662 Modes for document sharing (free|paid for now)
type Stanza ¶
type Stanza struct { Lang string `xml:"http://www.w3.org/XML/1998/namespace lang,attr,omitempty"` Title *Title `xml:"title,omitempty"` Subtitle *P `xml:"subtitle,omitempty"` // An individual line in a stanza V []*P `xml:"v"` // contains filtered or unexported fields }
Stanza https://github.com/gribuser/fb2/blob/14b5fcc6/FictionBook.xsd#L338 Each poem should have at least one stanza. Stanzas are usually separated with empty lines by user agents.
func (Stanza) GetContent ¶
GetContent for Contenter interface
func (Stanza) GetXMLName ¶
type StyleLinkType ¶
type StyleLinkType struct {
// contains filtered or unexported fields
}
StyleLinkType https://github.com/gribuser/fb2/blob/14b5fcc6/FictionBook.xsd#L506 Markup
func (*StyleLinkType) UnmarshalXML ¶
func (s *StyleLinkType) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML unmarshal XML to StyleType
type StyleType ¶
type StyleType struct { Lang string `xml:"http://www.w3.org/XML/1998/namespace lang,attr,omitempty"` // contains filtered or unexported fields }
StyleType https://github.com/gribuser/fb2/blob/14b5fcc6/FictionBook.xsd#L453 Markup
func (*StyleType) UnmarshalXML ¶
UnmarshalXML unmarshal XML to StyleType
type Stylesheet ¶
type Stylesheet struct { Type string `xml:"type,attr"` Value []byte `xml:",innerxml"` // contains filtered or unexported fields }
Stylesheet https://github.com/gribuser/fb2/blob/14b5fcc6/FictionBook.xsd#L77 This element contains an arbitrary stylesheet that is intepreted by a some processing programs, e.g. text/css stylesheets can be used by XSLT stylesheets to generate better looking html
func (*Stylesheet) GetXMLName ¶
func (*Stylesheet) SetXMLName ¶
func (*Stylesheet) UnmarshalXML ¶
func (s *Stylesheet) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error
UnmarshalXML unmarshal XML
type TD ¶
type TD struct { StyleType ID string `xml:"id,omitempty"` Style string `xml:"style,attr,omitempty"` Colspan int `xml:"colspan,attr,omitempty"` Rowspan int `xml:"rowspan,attr,omitempty"` Align string `xml:"align,attr,omitempty"` Valign string `xml:"valign,attr,omitempty"` }
TD https://github.com/gribuser/fb2/blob/14b5fcc6/FictionBook.xsd#L700
func (*TD) UnmarshalXML ¶
UnmarshalXML unmarshal XML to TD
type TR ¶
type TR struct { Align string `xml:"align,attr,omitempty"` // contains filtered or unexported fields }
TR https://github.com/gribuser/fb2/blob/14b5fcc6/FictionBook.xsd#L538
func (*TR) UnmarshalXML ¶
UnmarshalXML unmarshal XML to Table
type Table ¶
type Table struct { XMLName xml.Name `xml:"table"` TR []*TR `xml:"tr"` ID string `xml:"id,omitempty"` Style string `xml:"style,attr,omitempty"` // contains filtered or unexported fields }
Table https://github.com/gribuser/fb2/blob/14b5fcc6/FictionBook.xsd#L532 Basic html-like tables
func (*Table) GetContent ¶
GetContent for Contenter interface
func (Table) GetXMLName ¶
type TextField ¶
type TextField struct { Lang string `xml:"http://www.w3.org/XML/1998/namespace lang,attr,omitempty"` Value string `xml:",chardata"` // contains filtered or unexported fields }
TextField https://github.com/gribuser/fb2/blob/14b5fcc6/FictionBook.xsd#L255
func (*TextField) GetXMLName ¶
func (*TextField) SetXMLName ¶
func (*TextField) UnmarshalXML ¶
UnmarshalXML unmarshal XML to TextField
type Title ¶
type Title struct { Lang string `xml:"http://www.w3.org/XML/1998/namespace lang,attr,omitempty"` // contains filtered or unexported fields }
Title https://github.com/gribuser/fb2/blob/14b5fcc6/FictionBook.xsd#L273 A title, used in sections, poems and body elements
func (*Title) UnmarshalXML ¶
UnmarshalXML unmarshal XML to Title
type TitleInfo ¶
type TitleInfo struct { // Genre of this book, with the optional match percentage Genres []*Genre `xml:"genre"` // Author(s) of this book Authors []*Author `xml:"author"` //Book title BookTitle *TextField `xml:"book-title"` // Annotation for this book Annotation *Annotation `xml:"annotation"` // Any keywords for this book, intended for use in search engines Keywords *TextField `xml:"keywords"` // Date this book was written, can be not exact, e.g. 1863-1867. // If an optional attribute is present, then it should contain some // computer-readable date from the interval for use by search and indexingengines Date *Date `xml:"date"` // Any coverpage items, currently only images Coverpage *Coverpage `xml:"coverpage"` // Book's language Lang string `xml:"lang"` // Book's source language if this is a translation SrcLang string `xml:"src-lang,omitempty"` // Translators if this is a translation Translators []*Author `xml:"translator"` // Any sequences this book might be part of Sequences []*Sequence `xml:"sequence"` // contains filtered or unexported fields }
TitleInfo https://github.com/gribuser/fb2/blob/14b5fcc6/FictionBook.xsd#L570 Book (as a book opposite a document) description
func (*TitleInfo) GetXMLName ¶
func (*TitleInfo) SetXMLName ¶
func (*TitleInfo) UnmarshalXML ¶
UnmarshalXML unmarshal XML