svg

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2015 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package svg minifies SVG1.1 following the specifications at http://www.w3.org/TR/SVG11/.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Minify

func Minify(m minify.Minifier, _ string, w io.Writer, r io.Reader) error

Minify minifies SVG data, it reads from r and writes to w.

Example
m := minify.New()
m.AddFunc("image/svg+xml", Minify)
m.AddFunc("text/css", css.Minify)

if err := m.Minify("image/svg+xml", os.Stdout, os.Stdin); err != nil {
	fmt.Println("minify.Minify:", err)
}
Output:

Types

type Token added in v1.1.0

type Token struct {
	xml.TokenType
	Hash    svg.Hash
	Data    []byte
	AttrVal []byte
	// contains filtered or unexported fields
}

Token is a single token unit with an attribute value (if given) and hash of the data.

type TokenBuffer added in v1.1.0

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

TokenBuffer is a buffer that allows for token look-ahead.

func NewTokenBuffer added in v1.1.0

func NewTokenBuffer(l *xml.Lexer) *TokenBuffer

NewTokenBuffer returns a new TokenBuffer.

func (*TokenBuffer) Peek added in v1.1.0

func (z *TokenBuffer) Peek(pos int) *Token

Peek returns the ith element and possibly does an allocation. Peeking past an error will panic.

func (*TokenBuffer) Shift added in v1.1.0

func (z *TokenBuffer) Shift() *Token

Shift returns the first element and advances position.

Jump to

Keyboard shortcuts

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