package tag

import "git.sr.ht/~bouncepaw/mycomarkup/v5/genhtml/tag"

Package tag provides the data type for (X)HTML tags/DOM nodes.

Index

Types

type Tag

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

Tag represents an HTML tag/DOM node.

func NewClosed

func NewClosed(name string) Tag

NewClosed returns a new closed tag.

func NewUnclosed

func NewUnclosed(name string) Tag

NewUnclosed returns a new unclosed tag.

func NewWrapper

func NewWrapper() Tag

NewWrapper returns a new wrapper tag.

func (Tag) Lines

func (t Tag) Lines() (res []lines.Line)

Lines returns rendered lines of the tag.

func (Tag) String

func (t Tag) String() string

String returns a string representation of the tag.

func (Tag) WithAttrs

func (t Tag) WithAttrs(attributes map[string]string) Tag

WithAttrs return the tag but with the given attributes. Previous attributes of the tag are discarded.

This is a no-op for wrapper tags.

func (Tag) WithChildren

func (t Tag) WithChildren(children ...Tag) Tag

WithChildren returns the tag but with the given children. Previous children of the tag are discarded.

This is a no-op for unclosed tags.

func (Tag) WithContentsLines

func (t Tag) WithContentsLines(lines ...lines.Line) Tag

WithContentsLines returns the tag but with the given lines of contents.

Contents is like children, but just text, not tags.

This is a no-op for unclosed tags.

func (Tag) WithContentsStrings

func (t Tag) WithContentsStrings(strs ...string) Tag

WithContentsStrings is like WithContentsLines but it wraps strings into indented lines for you.

Source Files

tag.go

Version
v5.6.0 (latest)
Published
Nov 29, 2023
Platform
linux/amd64
Imports
4 packages
Last checked
1 week ago

Tools for package owners.