Documentation ¶
Index ¶
- func Send(w http.ResponseWriter, statusCode int, s string) (int, error)
- func SendStringer(w http.ResponseWriter, statusCode int, s Stringer) (int, error)
- type Element
- type Fragment
- type Modifier
- func AddChild(s ...Stringer) Modifier
- func SetAttr(newAttr [2]string) Modifier
- func SetAttrs(newAttrs ...[2]string) Modifier
- func SetTag(t string) Modifier
- func Style(d ...cssg.Decl) Modifier
- func WithString(s string) Modifier
- func WithText(lines ...string) Modifier
- func Wrap(s ...Stringer) Modifier
- type String
- type Stringer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Send ¶ added in v0.1.6
Send writes a HTML string to the given response writer. It sets the content-type header to "text/html; charset=utf-8" and writes the given status code.
func SendStringer ¶ added in v0.1.6
SendStringer renders and writes a Stringer to the given response writer. It sets the content-type header to "text/html; charset=utf-8" and writes the given status code.
Types ¶
type Element ¶ added in v0.1.6
type Element struct {
// contains filtered or unexported fields
}
Element represents a HTML element with a tag and optional attribute and inner HTML. Use Create to instanciate an element.
func (*Element) HTMLString ¶ added in v0.1.6
HTMLString returns a valid HTML representation of this element.
type Fragment ¶ added in v0.0.16
type Fragment []Stringer
Fragment represents a group of HTMLStringers. This can be several HTML sibling elements.
func NewFragment ¶ added in v0.0.16
NewFragment returns a fragment made of the given HTMLStringers.
func (Fragment) HTMLString ¶ added in v0.0.16
HTMLString returns the concatenated underyling HTMLStringers.
type Modifier ¶ added in v0.1.6
type Modifier func(*Element)
Modifier performs a mutation on an element. Eg. Changing its internal state (for ex: adding an attribute)
func WithString ¶ added in v0.1.6
type String ¶ added in v0.1.6
type String string
String represents a literal HTML string.
func Text ¶ added in v0.1.6
Text returns an Stringer that returns given strings with <br> tags in between them.
func (String) HTMLString ¶ added in v0.1.6
HTMLString returns the underlying string without modification.