css

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2020 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package css implements the minimal CSS syntax for allowing CSS properties to be defined via the standard flag package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dimension

type Dimension struct {
	Value Number
	Unit  Unit
}

Dimension represents a CSS number with unit.

func (*Dimension) Scan

func (d *Dimension) Scan(state fmt.ScanState, verb rune) error

Scan implements the Scanner interface.

func (*Dimension) Set

func (d *Dimension) Set(s string) error

Set implements the Value interface.

func (Dimension) String

func (d Dimension) String() string

String implements the Stringer interface.

type Font

type Font struct {
	Family     string
	Size       Dimension
	LineHeight Dimension
}

Font represents a CSS font. Only family, size and line height are supported, and they must all be provided. Font family must always be quoted.

func (*Font) Set

func (f *Font) Set(s string) error

Set implements the Value interface.

func (Font) String

func (f Font) String() string

String implements the Stringer interface.

type Number

type Number float64

Number represents a CSS number. Only real numbers are supported.

func (*Number) Set

func (n *Number) Set(s string) error

Set implements the Value interface.

func (Number) String

func (n Number) String() string

String implements the Stringer interface.

type PageMargin

type PageMargin struct {
	Top    Dimension
	Right  Dimension
	Bottom Dimension
	Left   Dimension
}

PageMargin represents CSS page margins.

func (*PageMargin) Set

func (p *PageMargin) Set(s string) error

Set implements the Value interface.

func (PageMargin) String

func (p PageMargin) String() string

String implements the Stringer interface.

type PageSize

type PageSize string

PageSize represents a CSS page size. Only A4 and letter page sizes are supported. The page orientation is portrait and can not be changed.

const (
	A4     PageSize = "A4"
	Letter PageSize = "letter"
)

Supported page sizes.

func (*PageSize) Set

func (p *PageSize) Set(s string) error

Set implements the Value interface.

func (PageSize) String

func (p PageSize) String() string

String implements the Stringer interface.

type Unit

type Unit string

Unit represents the unit of a CSS quantity. Only absolute length units are supported, excluding pixels and quarter-millimeters.

const (
	NoUnit     Unit = ""
	Point      Unit = "pt"
	Pica       Unit = "pc"
	Inch       Unit = "inch"
	Millimeter Unit = "mm"
	Centimeter Unit = "cm"
)

Supported units.

func (*Unit) Set

func (u *Unit) Set(s string) error

Set implements the Value interface.

func (Unit) String

func (u Unit) String() string

String implements the Stringer interface.

Jump to

Keyboard shortcuts

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