html

package
v0.0.0-...-807c8c2 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2023 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Render

func Render(tagName string, tagClose bool, attrs []Attr) template.HTML

func RenderText

func RenderText(tagName string, attrs []Attr, tagContent string) template.HTML

Types

type A

type A struct {
	Text           string             `json:"text"`
	Href           StringAttr         `json:"href"`
	HrefLang       StringAttr         `json:"hrefLang"`
	Type           StringAttr         `json:"type"`
	Rel            StringAttr         `json:"rel"`
	Ping           StringAttr         `json:"ping"`
	ReferrerPolicy ReferrerPolicyAttr `json:"referrerPolicy"`
}

func (A) Attributes

func (a A) Attributes() []Attr

func (A) Render

func (a A) Render() template.HTML

type Attr

type Attr struct {
	Name      string
	Value     string
	OmitValue bool
}

func (Attr) GoString

func (attr Attr) GoString() string

func (Attr) String

func (attr Attr) String() string

func (Attr) WriteTo

func (attr Attr) WriteTo(buf *bytes.Buffer)

type BoolAttr

type BoolAttr bool

func (BoolAttr) Append

func (value BoolAttr) Append(out []Attr, attrName string) []Attr

func (BoolAttr) AppendText

func (value BoolAttr) AppendText(out []Attr, attrName string, attrValue string) []Attr

func (BoolAttr) GoString

func (value BoolAttr) GoString() string

func (BoolAttr) MarshalJSON

func (value BoolAttr) MarshalJSON() ([]byte, error)

func (BoolAttr) MarshalText

func (value BoolAttr) MarshalText() ([]byte, error)

func (*BoolAttr) Parse

func (value *BoolAttr) Parse(input string) error

func (BoolAttr) String

func (value BoolAttr) String() string

func (*BoolAttr) UnmarshalJSON

func (value *BoolAttr) UnmarshalJSON(input []byte) error

func (*BoolAttr) UnmarshalText

func (value *BoolAttr) UnmarshalText(input []byte) error

type CrossOriginAttr

type CrossOriginAttr byte
const (
	CrossOrigin_None CrossOriginAttr = iota
	CrossOrigin_Anonymous
	CrossOrigin_UseCredentials
)

func (CrossOriginAttr) Append

func (enum CrossOriginAttr) Append(out []Attr, attrName string) []Attr

func (CrossOriginAttr) GoString

func (enum CrossOriginAttr) GoString() string

func (CrossOriginAttr) IsPresent

func (enum CrossOriginAttr) IsPresent() bool

func (CrossOriginAttr) IsValid

func (enum CrossOriginAttr) IsValid() bool

func (CrossOriginAttr) MarshalText

func (enum CrossOriginAttr) MarshalText() ([]byte, error)

func (*CrossOriginAttr) Parse

func (enum *CrossOriginAttr) Parse(input string) error

func (CrossOriginAttr) String

func (enum CrossOriginAttr) String() string

func (*CrossOriginAttr) UnmarshalText

func (enum *CrossOriginAttr) UnmarshalText(input []byte) error

type FetchPriorityAttr

type FetchPriorityAttr byte
const (
	FetchPriority_None FetchPriorityAttr = iota
	FetchPriority_High
	FetchPriority_Low
	FetchPriority_Auto
)

func (FetchPriorityAttr) Append

func (enum FetchPriorityAttr) Append(out []Attr, attrName string) []Attr

func (FetchPriorityAttr) GoString

func (enum FetchPriorityAttr) GoString() string

func (FetchPriorityAttr) IsPresent

func (enum FetchPriorityAttr) IsPresent() bool

func (FetchPriorityAttr) IsValid

func (enum FetchPriorityAttr) IsValid() bool

func (FetchPriorityAttr) MarshalText

func (enum FetchPriorityAttr) MarshalText() ([]byte, error)

func (*FetchPriorityAttr) Parse

func (enum *FetchPriorityAttr) Parse(input string) error

func (FetchPriorityAttr) String

func (enum FetchPriorityAttr) String() string

func (*FetchPriorityAttr) UnmarshalText

func (enum *FetchPriorityAttr) UnmarshalText(input []byte) error
type Link struct {
	Href           StringAttr         `json:"href"`
	HrefLang       StringAttr         `json:"hrefLang"`
	Type           StringAttr         `json:"type"`
	Rel            StringAttr         `json:"rel"`
	As             LinkAsAttr         `json:"as"`
	Title          StringAttr         `json:"title"`
	Media          StringAttr         `json:"media"`
	Sizes          SizesAttr          `json:"sizes"`
	ImageSizes     SizesAttr          `json:"imageSizes"`
	ImageSrcSet    StringAttr         `json:"imageSrcSet"`
	FetchPriority  FetchPriorityAttr  `json:"fetchPriority"`
	CrossOrigin    CrossOriginAttr    `json:"crossOrigin"`
	ReferrerPolicy ReferrerPolicyAttr `json:"referrerPolicy"`
	Integrity      StringAttr         `json:"integrity"`
	Blocking       BoolAttr           `json:"blocking"`
}

func (Link) Attributes

func (link Link) Attributes() []Attr

func (Link) Render

func (link Link) Render() template.HTML

type LinkAsAttr

type LinkAsAttr byte
const (
	LinkAs_None LinkAsAttr = iota
	LinkAs_Audio
	LinkAs_Document
	LinkAs_Embed
	LinkAs_Fetch
	LinkAs_Font
	LinkAs_Image
	LinkAs_Object
	LinkAs_Script
	LinkAs_Style
	LinkAs_Track
	LinkAs_Video
	LinkAs_Worker
)

func (LinkAsAttr) Append

func (enum LinkAsAttr) Append(out []Attr, attrName string) []Attr

func (LinkAsAttr) GoString

func (enum LinkAsAttr) GoString() string

func (LinkAsAttr) IsPresent

func (enum LinkAsAttr) IsPresent() bool

func (LinkAsAttr) IsValid

func (enum LinkAsAttr) IsValid() bool

func (LinkAsAttr) MarshalText

func (enum LinkAsAttr) MarshalText() ([]byte, error)

func (*LinkAsAttr) Parse

func (enum *LinkAsAttr) Parse(input string) error

func (LinkAsAttr) String

func (enum LinkAsAttr) String() string

func (*LinkAsAttr) UnmarshalText

func (enum *LinkAsAttr) UnmarshalText(input []byte) error

type Meta

type Meta struct {
	Type    MetaType   `json:"type"`
	Name    StringAttr `json:"name"`
	Content StringAttr `json:"content"`
	Media   StringAttr `json:"media"`
}

func (Meta) Attributes

func (meta Meta) Attributes() []Attr

func (Meta) Render

func (meta Meta) Render() template.HTML

type MetaType

type MetaType uint
const (
	Meta_None MetaType = iota
	Meta_HTTPEquiv
	Meta_Name
	Meta_ItemProp
)

func (MetaType) Append

func (enum MetaType) Append(out []Attr, name string) []Attr

func (MetaType) GoString

func (enum MetaType) GoString() string

func (MetaType) IsPresent

func (enum MetaType) IsPresent() bool

func (MetaType) IsValid

func (enum MetaType) IsValid() bool

func (MetaType) MarshalText

func (enum MetaType) MarshalText() ([]byte, error)

func (*MetaType) Parse

func (enum *MetaType) Parse(input string) error

func (MetaType) String

func (enum MetaType) String() string

func (*MetaType) UnmarshalText

func (enum *MetaType) UnmarshalText(input []byte) error

type ReferrerPolicyAttr

type ReferrerPolicyAttr byte
const (
	ReferrerPolicy_None ReferrerPolicyAttr = iota
	ReferrerPolicy_NoReferrer
	ReferrerPolicy_NoReferrerWhenDowngrade
	ReferrerPolicy_Origin
	ReferrerPolicy_OriginWhenCrossOrigin
	ReferrerPolicy_SameOrigin
	ReferrerPolicy_StrictOrigin
	ReferrerPolicy_StrictOriginWhenCrossOrigin
	ReferrerPolicy_UnsafeURL
)

func (ReferrerPolicyAttr) Append

func (enum ReferrerPolicyAttr) Append(out []Attr, attrName string) []Attr

func (ReferrerPolicyAttr) GoString

func (enum ReferrerPolicyAttr) GoString() string

func (ReferrerPolicyAttr) IsPresent

func (enum ReferrerPolicyAttr) IsPresent() bool

func (ReferrerPolicyAttr) IsValid

func (enum ReferrerPolicyAttr) IsValid() bool

func (ReferrerPolicyAttr) MarshalText

func (enum ReferrerPolicyAttr) MarshalText() ([]byte, error)

func (*ReferrerPolicyAttr) Parse

func (enum *ReferrerPolicyAttr) Parse(input string) error

func (ReferrerPolicyAttr) String

func (enum ReferrerPolicyAttr) String() string

func (*ReferrerPolicyAttr) UnmarshalText

func (enum *ReferrerPolicyAttr) UnmarshalText(input []byte) error

type Script

type Script struct {
	Src            StringAttr         `json:"src"`
	Type           StringAttr         `json:"type"`
	FetchPriority  FetchPriorityAttr  `json:"fetchPriority"`
	CrossOrigin    CrossOriginAttr    `json:"crossOrigin"`
	ReferrerPolicy ReferrerPolicyAttr `json:"referrerPolicy"`
	Nonce          StringAttr         `json:"nonce"`
	Integrity      StringAttr         `json:"integrity"`
	Blocking       BoolAttr           `json:"blocking"`
	Async          BoolAttr           `json:"async"`
	Defer          BoolAttr           `json:"defer"`
	NoModule       BoolAttr           `json:"noModule"`
}

func (Script) Attributes

func (script Script) Attributes() []Attr

func (Script) Render

func (script Script) Render() template.HTML

type SizesAttr

type SizesAttr []string

func (SizesAttr) Append

func (value SizesAttr) Append(out []Attr, attrName string) []Attr

func (SizesAttr) GoString

func (value SizesAttr) GoString() string

func (SizesAttr) IsPresent

func (value SizesAttr) IsPresent() bool

func (SizesAttr) IsValid

func (value SizesAttr) IsValid() bool

func (SizesAttr) MarshalJSON

func (value SizesAttr) MarshalJSON() ([]byte, error)

func (SizesAttr) MarshalText

func (value SizesAttr) MarshalText() ([]byte, error)

func (*SizesAttr) Parse

func (value *SizesAttr) Parse(input string) error

func (SizesAttr) String

func (value SizesAttr) String() string

func (*SizesAttr) UnmarshalJSON

func (value *SizesAttr) UnmarshalJSON(input []byte) error

func (*SizesAttr) UnmarshalText

func (value *SizesAttr) UnmarshalText(input []byte) error

type StringAttr

type StringAttr string

func (StringAttr) Append

func (value StringAttr) Append(out []Attr, attrName string, isMandatory bool) []Attr

func (StringAttr) GoString

func (value StringAttr) GoString() string

func (StringAttr) IsPresent

func (value StringAttr) IsPresent() bool

func (StringAttr) MarshalText

func (value StringAttr) MarshalText() ([]byte, error)

func (*StringAttr) Parse

func (value *StringAttr) Parse(input string) error

func (StringAttr) String

func (value StringAttr) String() string

func (*StringAttr) UnmarshalText

func (value *StringAttr) UnmarshalText(input []byte) error

Jump to

Keyboard shortcuts

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