package tag
import "git.sr.ht/~bouncepaw/mycomarkup/v5/genhtml/tag"
Package tag provides the data type for (X)HTML tags/DOM nodes.
Index ¶
- type Tag
- func NewClosed(name string) Tag
- func NewUnclosed(name string) Tag
- func NewWrapper() Tag
- func (t Tag) Lines() (res []lines.Line)
- func (t Tag) String() string
- func (t Tag) WithAttrs(attributes map[string]string) Tag
- func (t Tag) WithChildren(children ...Tag) Tag
- func (t Tag) WithContentsLines(lines ...lines.Line) Tag
- func (t Tag) WithContentsStrings(strs ...string) Tag
Types ¶
type Tag ¶
type Tag struct {
// contains filtered or unexported fields
}
Tag represents an HTML tag/DOM node.
func NewClosed ¶
NewClosed returns a new closed tag.
func NewUnclosed ¶
NewUnclosed returns a new unclosed tag.
func NewWrapper ¶
func NewWrapper() Tag
NewWrapper returns a new wrapper tag.
func (Tag) Lines ¶
Lines returns rendered lines of the tag.
func (Tag) String ¶
String returns a string representation of the tag.
func (Tag) WithAttrs ¶
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 ¶
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 ¶
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 ¶
WithContentsStrings is like WithContentsLines but it wraps strings into indented lines for you.
Source Files ¶
- Version
- v5.6.0 (latest)
- Published
- Nov 29, 2023
- Platform
- linux/amd64
- Imports
- 4 packages
- Last checked
- 1 week ago –
Tools for package owners.