html

package
v1.0.0-...-3fe6b38 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attribute

type Attribute map[string]interface{}

func (*Attribute) Get

func (a *Attribute) Get(name string) interface{}

func (*Attribute) Has

func (a *Attribute) Has(name string) bool

func (*Attribute) IsEmpty

func (a *Attribute) IsEmpty() bool

func (*Attribute) Markup

func (a *Attribute) Markup() (string, error)

func (*Attribute) Set

func (a *Attribute) Set(name string, value interface{})

type Attributer

type Attributer interface {
	Markuper

	IsEmpty() bool
	Has(name string) bool
	Get(name string) interface{}
	Set(name string, value interface{})
}

type Class

type Class []string

func (*Class) Add

func (c *Class) Add(cls string)

func (*Class) Clear

func (c *Class) Clear()

func (*Class) Has

func (c *Class) Has(cls string) bool

func (*Class) IsEmpty

func (c *Class) IsEmpty() bool

func (*Class) Markup

func (c *Class) Markup() (string, error)

func (*Class) Remove

func (c *Class) Remove(cls string)

type Classer

type Classer interface {
	Markuper

	IsEmpty() bool
	Has(cls string) bool
	Add(cls string)
	Remove(cls string)
	Clear()
}

type Element

type Element struct {
	Tag       string
	Short     bool
	Id        Id
	Class     Class
	Style     Style
	Attribute Attribute
	Inner     Markuper
}

func (*Element) Markup

func (el *Element) Markup() (string, error)

type ErrMarkupFailed

type ErrMarkupFailed struct {
	Tag    string
	Id     string
	Reason error
}

The error denotes the situation when Markup rendering failed. With the field Reason the error can form a cascade structure which contains the full path to the element which failed to produce markup.

func (ErrMarkupFailed) Error

func (err ErrMarkupFailed) Error() string

func (ErrMarkupFailed) Why

func (err ErrMarkupFailed) Why() error

type ErrRenderFailed

type ErrRenderFailed struct {
	Class  string
	Id     string
	Reason error
}

The error denotes the situation when Rendering failed. With the field Reason the error can form a cascade structure which contains the full path to the element which failed to produce markup.

func (ErrRenderFailed) Error

func (err ErrRenderFailed) Error() string

func (ErrRenderFailed) Why

func (err ErrRenderFailed) Why() error

type Html

type Html string

func (Html) Markup

func (h Html) Markup() (string, error)

type Id

type Id string

func (Id) IsEmpty

func (id Id) IsEmpty() bool

func (Id) Markup

func (id Id) Markup() (string, error)

func (Id) String

func (id Id) String() string

type Ider

type Ider interface {
	fmt.Stringer
	Markuper

	IsEmpty() bool
}

type Imposer

type Imposer interface {
	// Impose attributes to the HTML element el.
	Impose(el *Element)
}

Imposer applies attributes to HTML element. Attributes applied should be class, style, and other custom attributes except id and inner attributes and except tag name.

type Markuper

type Markuper interface {
	Markup() (markup string, err error)
}

type Multiple

type Multiple []Markuper

func (Multiple) Markup

func (m Multiple) Markup() (string, error)

type Overflow

type Overflow uint8
const (
	OverflowInheritX Overflow = 0
	OverflowVisibleX Overflow = 1
	OverflowHiddenX  Overflow = 2
	OverflowScrollX  Overflow = 3
	OverflowAutoX    Overflow = 4
)
const (
	OverflowInheritY Overflow = 0 << 3
	OverflowVisibleY Overflow = 1 << 3
	OverflowHiddenY  Overflow = 2 << 3
	OverflowScrollY  Overflow = 3 << 3
	OverflowAutoY    Overflow = 4 << 3
)
const (
	OverflowInheritXY Overflow = OverflowInheritX | OverflowInheritY
	OverflowVisibleXY Overflow = OverflowVisibleX | OverflowVisibleY
	OverflowHiddenXY  Overflow = OverflowHiddenX | OverflowHiddenY
	OverflowScrollXY  Overflow = OverflowScrollX | OverflowScrollY
	OverflowAutoXY    Overflow = OverflowAutoX | OverflowAutoY
)

func (Overflow) Impose

func (o Overflow) Impose(el *Element)

func (Overflow) X

func (o Overflow) X() Overflow

func (Overflow) Y

func (o Overflow) Y() Overflow

type Position

type Position uint8
const (
	PositionInherit Position = iota
	PositionAbsolute
	PositionFixed
	PositionRelative
	PositionStatic
)

func (Position) Impose

func (p Position) Impose(el *Element)

func (Position) IsAbsolute

func (p Position) IsAbsolute() bool

func (Position) IsFixed

func (p Position) IsFixed() bool

func (Position) IsInherit

func (p Position) IsInherit() bool

func (Position) IsRelative

func (p Position) IsRelative() bool

func (Position) IsStatic

func (p Position) IsStatic() bool

type Rect

type Rect struct {
	Top    int
	Bottom int
	Height int
	Left   int
	Right  int
	Width  int
	// contains filtered or unexported fields
}

func (*Rect) BottomUnit

func (rect *Rect) BottomUnit() Unit

func (*Rect) HasAny

func (rect *Rect) HasAny() bool

func (*Rect) HasBottom

func (rect *Rect) HasBottom() bool

func (*Rect) HasHeight

func (rect *Rect) HasHeight() bool

func (*Rect) HasLeft

func (rect *Rect) HasLeft() bool

func (*Rect) HasRight

func (rect *Rect) HasRight() bool

func (*Rect) HasTop

func (rect *Rect) HasTop() bool

func (*Rect) HasWidth

func (rect *Rect) HasWidth() bool

func (*Rect) HeightUnit

func (rect *Rect) HeightUnit() Unit

func (*Rect) Impose

func (rect *Rect) Impose(el *Element)

func (*Rect) LeftUnit

func (rect *Rect) LeftUnit() Unit

func (*Rect) RightUnit

func (rect *Rect) RightUnit() Unit

func (*Rect) SetBottom

func (rect *Rect) SetBottom(bottom int, unit Unit) *Rect

func (*Rect) SetHeight

func (rect *Rect) SetHeight(height int, unit Unit) *Rect

func (*Rect) SetLeft

func (rect *Rect) SetLeft(left int, unit Unit) *Rect

func (*Rect) SetRight

func (rect *Rect) SetRight(right int, unit Unit) *Rect

func (*Rect) SetTop

func (rect *Rect) SetTop(top int, unit Unit) *Rect

func (*Rect) SetWidth

func (rect *Rect) SetWidth(width int, unit Unit) *Rect

func (*Rect) TopUnit

func (rect *Rect) TopUnit() Unit

func (*Rect) WidthUnit

func (rect *Rect) WidthUnit() Unit

func (Rect) WithBottom

func (rect Rect) WithBottom(bottom int, unit Unit) Rect

func (Rect) WithHeight

func (rect Rect) WithHeight(height int, unit Unit) Rect

func (Rect) WithLeft

func (rect Rect) WithLeft(left int, unit Unit) Rect

func (Rect) WithRight

func (rect Rect) WithRight(right int, unit Unit) Rect

func (Rect) WithTop

func (rect Rect) WithTop(top int, unit Unit) Rect

func (Rect) WithWidth

func (rect Rect) WithWidth(width int, unit Unit) Rect

type Renderer

type Renderer interface {
	// Render content into HTML Element.
	Render(parent *Element, viewport Rect) (el *Element, err error)
}

type Style

type Style map[string]string

func (*Style) Has

func (s *Style) Has(attr string) bool

func (*Style) IsEmpty

func (s *Style) IsEmpty() bool

func (*Style) Markup

func (s *Style) Markup() (string, error)

func (*Style) Set

func (s *Style) Set(attr, style string)

func (*Style) Setf

func (s *Style) Setf(attr, styleFormat string, args ...interface{})

type Styler

type Styler interface {
	Markuper

	IsEmpty() bool
	Has(attr string) bool
	Set(attr, style string)
	Setf(attr, styleFormat string, args ...interface{})
}

type Text

type Text string

func (Text) Markup

func (t Text) Markup() (string, error)

type Unit

type Unit uint8

The unit of position or dimension.

const (
	Pixel Unit = iota
	Percentage
	Factor
)

func (Unit) Format

func (u Unit) Format(n int) string

Format number with unit sign in CSS terms.

type Void

type Void struct{}

func (Void) Markup

func (Void) Markup() (string, error)

Jump to

Keyboard shortcuts

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