parser

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2020 License: MIT Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ElementToPath

func ElementToPath(elem *Element, log *util.HfdLog) (path.Path, error)

convert this element to a path

func InitContext

func InitContext()

Types

type DefaultDocumentParser

type DefaultDocumentParser struct {
}

func NewDocumentParser

func NewDocumentParser() DefaultDocumentParser

func (DefaultDocumentParser) LoadBytes

func (p DefaultDocumentParser) LoadBytes(filename string) ([]byte, error)

func (DefaultDocumentParser) Parse

func (p DefaultDocumentParser) Parse(bytes []byte, logger *util.HfdLog) (*dom.Document, error)

type Element

type Element struct {
	Name       string
	Attributes *dynmap.DynMap // map[string]string
	Children   []*Element
	Content    string
}

Element is a representation of an SVG element.

func DecodeFirst

func DecodeFirst(decoder *xml.Decoder) (*Element, error)

DecodeFirst creates the first element from the decoder.

func NewElement

func NewElement(token xml.StartElement) *Element

NewElement creates element from decoder token.

func Parse

func Parse(source io.Reader, validate bool) (*Element, error)

Parse creates an Element instance from an SVG input.

func (*Element) Compare

func (e *Element) Compare(o *Element) bool

Compare compares two elements.

func (*Element) Decode

func (e *Element) Decode(decoder *xml.Decoder) error

Decode decodes the child elements of element.

type SVGNormalizer added in v1.0.1

type SVGNormalizer struct {
	SegmentOperators path.SegmentOperators
}

func (SVGNormalizer) SVGNormalize added in v1.0.1

func (sn SVGNormalizer) SVGNormalize(xml string, logger *util.HfdLog) (string, error)

parses the svg, and normalizes it and returns a new svg

type SVGParser

type SVGParser struct {
}

func (SVGParser) ParseSVG

func (s SVGParser) ParseSVG(xml string, logger *util.HfdLog) (path.Path, error)

parses an SVG file for any Path Elements and joining them together

Jump to

Keyboard shortcuts

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