1
0
Fork 0
mirror of https://github.com/imjasonh/html synced 2026-07-08 08:56:07 +00:00

Initial commit

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Jason Hall 2025-12-01 12:56:20 -05:00
commit 01c7432c71
72 changed files with 6192 additions and 0 deletions

91
generated_table.go Normal file
View file

@ -0,0 +1,91 @@
package html
// TableElement represents the <table> HTML element.
type TableElement[C HTMLContent] basicElement[C]
// Table creates a new <table> element.
func Table(children ...HTMLContent) *TableElement[HTMLContent] {
return &TableElement[HTMLContent]{
tagName: "table",
content: children,
}
}
// Render returns the HTML string representation.
func (e *TableElement[C]) Render() string {
return (*basicElement[C])(e).Render()
}
// Attr sets an arbitrary attribute as an escape hatch.
func (e *TableElement[C]) Attr(key, value string) *TableElement[C] {
e.attributes = append(e.attributes, Attribute{Key: key, Value: value})
return e
}
// Align sets the align attribute.
func (e *TableElement[C]) Align(v string) *TableElement[C] {
e.attributes = append(e.attributes, Attribute{Key: "align", Value: v})
return e
}
// Border sets the border attribute.
func (e *TableElement[C]) Border(v string) *TableElement[C] {
e.attributes = append(e.attributes, Attribute{Key: "border", Value: v})
return e
}
// Frame sets the frame attribute.
func (e *TableElement[C]) Frame(v string) *TableElement[C] {
e.attributes = append(e.attributes, Attribute{Key: "frame", Value: v})
return e
}
// Rows sets the rows attribute.
func (e *TableElement[C]) Rows(v string) *TableElement[C] {
e.attributes = append(e.attributes, Attribute{Key: "rows", Value: v})
return e
}
// Rules sets the rules attribute.
func (e *TableElement[C]) Rules(v string) *TableElement[C] {
e.attributes = append(e.attributes, Attribute{Key: "rules", Value: v})
return e
}
// Summary sets the summary attribute.
func (e *TableElement[C]) Summary(v string) *TableElement[C] {
e.attributes = append(e.attributes, Attribute{Key: "summary", Value: v})
return e
}
// TBodies sets the tBodies attribute.
func (e *TableElement[C]) TBodies(v string) *TableElement[C] {
e.attributes = append(e.attributes, Attribute{Key: "tBodies", Value: v})
return e
}
// Width sets the width attribute.
func (e *TableElement[C]) Width(v string) *TableElement[C] {
e.attributes = append(e.attributes, Attribute{Key: "width", Value: v})
return e
}