xdoc

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Box

type Box struct {
	Styled
	XMLName xml.Name `xml:"box"`
	//Text    string   `xml:",chardata"`
	Instructions
}

type DescribeFormat

type DescribeFormat string
const (
	DescribeXML  DescribeFormat = "xml"
	DescribeJSON DescribeFormat = "json"
)

type DescribeItem

type DescribeItem struct {
	Name       string
	Value      interface{}
	StyleDiffs []Diff
	Items      []DescribeItem
}

type Description

type Description struct {
	Items []DescribeItem
	// contains filtered or unexported fields
}

func Describe

func Describe(doc *Document) *Description

func (*Description) Dump

func (d *Description) Dump(format DescribeFormat) string

type Diff

type Diff struct {
	Path string
	Org  interface{}
	Mod  interface{}
}

type Document

type Document struct {
	XMLName xml.Name     `xml:"document"`
	Meta    Meta         `xml:"meta"`
	Page    Page         `xml:"page"`
	Style   string       `xml:"style"`
	Header  Instructions `xml:"header"`
	Footer  Instructions `xml:"footer"`
	Body    Instructions `xml:"body"`
	// contains filtered or unexported fields
}

func Load

func Load(r io.Reader) (*Document, error)

func LoadFromFile

func LoadFromFile(file string) (*Document, error)

func (*Document) StyleClasses

func (doc *Document) StyleClasses() style.Classes

type Font

type Font struct {
	Styled
	XMLName xml.Name `xml:"font"`
}

type Grid

type Grid struct {
	Styled
	XMLName xml.Name    `xml:"grid"`
	Rows    []*GridRow  `xml:"rows>gr"`
	Parts   []*GridPart `xml:"parts>part"`
}

func (*Grid) UnmarshalXML

func (g *Grid) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

func (*Grid) Validate

func (g *Grid) Validate() error

type GridPart

type GridPart struct {
	Styled
	XMLName xml.Name `xml:"part"`
	Area    string   `xml:"area,attr"`
	Instructions
}

func (*GridPart) DecodeAttrs

func (p *GridPart) DecodeAttrs(attrs []xml.Attr) error

func (*GridPart) UnmarshalXML

func (p *GridPart) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type GridRow

type GridRow struct {
	Styled
	XMLName xml.Name `xml:"gr"`
	Areas   []string
}

func (*GridRow) UnmarshalXML

func (gr *GridRow) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type Image

type Image struct {
	Styled
	XMLName xml.Name `xml:"image"`
	Source  string   `xml:",chardata"`
}

type Instruction

type Instruction interface {
	DecodeAttrs(attrs []xml.Attr) error
	MutatedStyles(cs style.Classes, styles style.Styles) style.Styles
	MutatedStylesWithSelector(sel string, cs style.Classes, styles style.Styles) style.Styles
}

type Instructions

type Instructions struct {
	Styled
	ISS []Instruction
}

func (*Instructions) UnmarshalXML

func (is *Instructions) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type LineBreak

type LineBreak struct {
	NoStyles
	XMLName xml.Name `xml:"br"`
}

type LineFeed

type LineFeed struct {
	NoStyles
	XMLName xml.Name `xml:"lf"`
	Lines   float64  `xml:"lines,attr"`
}

type Margins

type Margins struct {
	XMLName xml.Name `xml:"margins"`
	Left    float64  `xml:"left"`
	Top     float64  `xml:"top"`
	Right   float64  `xml:"right"`
	Bottom  float64  `xml:"bottom"`
}

type Meta

type Meta struct {
	XMLName xml.Name `xml:"meta"`
	Author  string   `xml:"author"`
	Creator string   `xml:"creator"`
	Subject string   `xml:"subject"`
}

type NoStyles

type NoStyles struct{}

func (*NoStyles) DecodeAttrs

func (i *NoStyles) DecodeAttrs(attrs []xml.Attr) error

func (*NoStyles) MutatedStyles

func (i *NoStyles) MutatedStyles(cs style.Classes, styles style.Styles) style.Styles

func (*NoStyles) MutatedStylesWithSelector

func (i *NoStyles) MutatedStylesWithSelector(sel string, cs style.Classes, styles style.Styles) style.Styles

type Orientation

type Orientation string
const (
	OrientationPortrait  Orientation = "portrait"
	OrientationLandscape Orientation = "landscape"
)

type Page

type Page struct {
	XMLName     xml.Name    `xml:"page"`
	Orientation Orientation `xml:"orientation"`
	Format      PaperFormat `xml:"format"`
	Margins     Margins     `xml:"margins"`
}

type PageBreak added in v0.2.6

type PageBreak struct {
	NoStyles
	XMLName xml.Name `xml:"newpage"`
}

type PaperFormat

type PaperFormat string
const (
	FormatA3     PaperFormat = "a3"
	FormatA4     PaperFormat = "a4"
	FormatA5     PaperFormat = "a5"
	FormatLetter PaperFormat = "letter"
	FormatLegal  PaperFormat = "legal"
)

type Paragraph

type Paragraph struct {
	Styled
	XMLName xml.Name `xml:"p"`
	Text    string   `xml:",chardata"`
}

type Registry

type Registry struct {
	// contains filtered or unexported fields
}

func NewRegistry

func NewRegistry() *Registry

func (*Registry) DecodeInstruction

func (r *Registry) DecodeInstruction(d *xml.Decoder, start xml.StartElement) (Instruction, error)

func (*Registry) RegisterInstruction

func (r *Registry) RegisterInstruction(prototype Instruction) error

type SetX

type SetX struct {
	NoStyles
	XMLName xml.Name `xml:"setx"`
	X       float64  `xml:"x,attr"`
}

type SetY

type SetY struct {
	NoStyles
	XMLName xml.Name `xml:"sety"`
	Y       float64  `xml:"y,attr"`
}

type Styled

type Styled struct {
	Mutators []*style.Mutator
	Classes  []string
}

func (*Styled) DecodeAttrs

func (i *Styled) DecodeAttrs(attrs []xml.Attr) error

func (*Styled) MutatedStyles

func (i *Styled) MutatedStyles(cs style.Classes, styles style.Styles) style.Styles

func (*Styled) MutatedStylesWithSelector

func (i *Styled) MutatedStylesWithSelector(sel string, cs style.Classes, styles style.Styles) style.Styles

type Table

type Table struct {
	Styled
	XMLName      xml.Name    `xml:"table"`
	RepeatHeader int         `xml:"repeatheader,attr"`
	Rows         []*TableRow `xml:"tr"`
}

func (*Table) DecodeAttrs

func (t *Table) DecodeAttrs(attrs []xml.Attr) error

func (*Table) UnmarshalXML

func (tab *Table) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type TableCell

type TableCell struct {
	Styled
	XMLName xml.Name `xml:"td"`
	Instructions
	ColSpan int `xml:"colspan,attr"`
	RowSpan int `xml:"rowspan,attr"`
}

func (*TableCell) DecodeAttrs

func (c *TableCell) DecodeAttrs(attrs []xml.Attr) error

func (*TableCell) UnmarshalXML

func (cell *TableCell) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type TableRow

type TableRow struct {
	Styled
	XMLName xml.Name     `xml:"tr"`
	Cells   []*TableCell `xml:"td"`
}

func (*TableRow) UnmarshalXML

func (row *TableRow) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type Text

type Text struct {
	Styled
	XMLName xml.Name `xml:"text"`
	Instructions
}

type TextBlock

type TextBlock struct {
	NoStyles
	Text string
}

Jump to

Keyboard shortcuts

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