html_builder

package module
v0.0.0-...-79a589b Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2018 License: MIT Imports: 3 Imported by: 0

README

HTML builder for Go

Exmaple:

package main

import (
	"fmt"
	. "github.com/asmundstavdahl/html_builder"
)

func main() {
	topNode := Html(Attrs{},
		Body(Attrs{},
			Div(Attrs{"style": "background-color: lightblue;"},
				Text("Testing testing…"),
				Hr(),
				A(Attrs{"href": "https://github.com/asmundstavdahl/html_builder"},
					Img(Attrs{"src": "https://avatars2.githubusercontent.com/u/1936058?s=40&v=4"})),
				Br())))
	output := topNode.Html(
		HtmlConfig{
			Pretty:     true,
			IndentWith: "    "})

	fmt.Println(output)
}

/* $ go run usage_example.go
<html>
    <body>
        <div style="background-color: lightblue;">
            Testing testing…
            <hr/>
            <a href="https://github.com/asmundstavdahl/html_builder">
                <img src="https://avatars2.githubusercontent.com/u/1936058?s=40&v=4"></img>
            </a>
            <br/>
        </div>
    </body>
</html>
*/

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attrs

type Attrs map[string]string

func (Attrs) String

func (attrs Attrs) String() string

type Element

type Element struct {
	TagName    string
	Attributes Attrs
	Children   []Node
}

func (Element) Html

func (el Element) Html(conf HtmlConfig) string

type HtmlConfig

type HtmlConfig struct {
	Pretty      bool
	IndentWith  string
	IndentLevel int
}

type Node

type Node interface {
	Html(HtmlConfig) string
}

func A

func A(attributes Attrs, children ...Node) Node

func Abbr

func Abbr(attributes Attrs, children ...Node) Node

func Acronym

func Acronym(attributes Attrs, children ...Node) Node

func Address

func Address(attributes Attrs, children ...Node) Node

func Applet

func Applet(attributes Attrs, children ...Node) Node

func Area

func Area(attributes Attrs, children ...Node) Node

func Article

func Article(attributes Attrs, children ...Node) Node

func Aside

func Aside(attributes Attrs, children ...Node) Node

func Audio

func Audio(attributes Attrs, children ...Node) Node

func B

func B(attributes Attrs, children ...Node) Node

func Base

func Base(attributes Attrs, children ...Node) Node

func Basefont

func Basefont(attributes Attrs, children ...Node) Node

func Bdi

func Bdi(attributes Attrs, children ...Node) Node

func Bdo

func Bdo(attributes Attrs, children ...Node) Node

func Big

func Big(attributes Attrs, children ...Node) Node

func Blockquote

func Blockquote(attributes Attrs, children ...Node) Node

func Body

func Body(attributes Attrs, children ...Node) Node

func Br

func Br() Node

func Button

func Button(attributes Attrs, children ...Node) Node

func Canvas

func Canvas(attributes Attrs, children ...Node) Node

func Caption

func Caption(attributes Attrs, children ...Node) Node

func Center

func Center(attributes Attrs, children ...Node) Node

func Cite

func Cite(attributes Attrs, children ...Node) Node

func Code

func Code(attributes Attrs, children ...Node) Node

func Col

func Col(attributes Attrs, children ...Node) Node

func Colgroup

func Colgroup(attributes Attrs, children ...Node) Node

func Data

func Data(attributes Attrs, children ...Node) Node

func Datalist

func Datalist(attributes Attrs, children ...Node) Node

func Dd

func Dd(attributes Attrs, children ...Node) Node

func Del

func Del(attributes Attrs, children ...Node) Node

func Details

func Details(attributes Attrs, children ...Node) Node

func Dfn

func Dfn(attributes Attrs, children ...Node) Node

func Dialog

func Dialog(attributes Attrs, children ...Node) Node

func Dir

func Dir(attributes Attrs, children ...Node) Node

func Div

func Div(attributes Attrs, children ...Node) Node

func Dl

func Dl(attributes Attrs, children ...Node) Node

func Dt

func Dt(attributes Attrs, children ...Node) Node

func Em

func Em(attributes Attrs, children ...Node) Node

func Embed

func Embed(attributes Attrs, children ...Node) Node

func Fieldset

func Fieldset(attributes Attrs, children ...Node) Node

func Figcaption

func Figcaption(attributes Attrs, children ...Node) Node

func Figure

func Figure(attributes Attrs, children ...Node) Node

func Font

func Font(attributes Attrs, children ...Node) Node
func Footer(attributes Attrs, children ...Node) Node

func Form

func Form(attributes Attrs, children ...Node) Node

func Frame

func Frame(attributes Attrs, children ...Node) Node

func Frameset

func Frameset(attributes Attrs, children ...Node) Node

func H1

func H1(attributes Attrs, children ...Node) Node

func H2

func H2(attributes Attrs, children ...Node) Node

func H3

func H3(attributes Attrs, children ...Node) Node

func H4

func H4(attributes Attrs, children ...Node) Node

func H5

func H5(attributes Attrs, children ...Node) Node

func H6

func H6(attributes Attrs, children ...Node) Node
func Head(attributes Attrs, children ...Node) Node
func Header(attributes Attrs, children ...Node) Node

func Hr

func Hr() Node

func Html

func Html(attributes Attrs, children ...Node) Node

func I

func I(attributes Attrs, children ...Node) Node

func Iframe

func Iframe(attributes Attrs, children ...Node) Node

func Img

func Img(attributes Attrs, children ...Node) Node

func Input

func Input(attributes Attrs, children ...Node) Node

func Ins

func Ins(attributes Attrs, children ...Node) Node

func Kbd

func Kbd(attributes Attrs, children ...Node) Node

func Label

func Label(attributes Attrs, children ...Node) Node

func Legend

func Legend(attributes Attrs, children ...Node) Node

func Li

func Li(attributes Attrs, children ...Node) Node
func Link(attributes Attrs, children ...Node) Node

func Main

func Main(attributes Attrs, children ...Node) Node

func Map

func Map(attributes Attrs, children ...Node) Node

func Mark

func Mark(attributes Attrs, children ...Node) Node

func Meta

func Meta(attributes Attrs, children ...Node) Node

func Meter

func Meter(attributes Attrs, children ...Node) Node
func Nav(attributes Attrs, children ...Node) Node

func Noframes

func Noframes(attributes Attrs, children ...Node) Node

func Noscript

func Noscript(attributes Attrs, children ...Node) Node

func Object

func Object(attributes Attrs, children ...Node) Node

func Ol

func Ol(attributes Attrs, children ...Node) Node

func Optgroup

func Optgroup(attributes Attrs, children ...Node) Node

func Option

func Option(attributes Attrs, children ...Node) Node

func Output

func Output(attributes Attrs, children ...Node) Node

func P

func P(attributes Attrs, children ...Node) Node

func Param

func Param(attributes Attrs, children ...Node) Node

func Picture

func Picture(attributes Attrs, children ...Node) Node

func Pre

func Pre(attributes Attrs, children ...Node) Node

func Progress

func Progress(attributes Attrs, children ...Node) Node

func Q

func Q(attributes Attrs, children ...Node) Node

func Rp

func Rp(attributes Attrs, children ...Node) Node

func Rt

func Rt(attributes Attrs, children ...Node) Node

func Ruby

func Ruby(attributes Attrs, children ...Node) Node

func S

func S(attributes Attrs, children ...Node) Node

func Samp

func Samp(attributes Attrs, children ...Node) Node

func Script

func Script(attributes Attrs, children ...Node) Node

func Section

func Section(attributes Attrs, children ...Node) Node

func Select

func Select(attributes Attrs, children ...Node) Node

func Small

func Small(attributes Attrs, children ...Node) Node

func Source

func Source(attributes Attrs, children ...Node) Node

func Span

func Span(attributes Attrs, children ...Node) Node

func Strike

func Strike(attributes Attrs, children ...Node) Node

func Strong

func Strong(attributes Attrs, children ...Node) Node

func Style

func Style(attributes Attrs, children ...Node) Node

func Sub

func Sub(attributes Attrs, children ...Node) Node

func Summary

func Summary(attributes Attrs, children ...Node) Node

func Sup

func Sup(attributes Attrs, children ...Node) Node

func Svg

func Svg(attributes Attrs, children ...Node) Node

func Table

func Table(attributes Attrs, children ...Node) Node

func Tbody

func Tbody(attributes Attrs, children ...Node) Node

func Td

func Td(attributes Attrs, children ...Node) Node

func Template

func Template(attributes Attrs, children ...Node) Node

func Text

func Text(text string) Node

func Textarea

func Textarea(attributes Attrs, children ...Node) Node

func Tfoot

func Tfoot(attributes Attrs, children ...Node) Node

func Th

func Th(attributes Attrs, children ...Node) Node

func Thead

func Thead(attributes Attrs, children ...Node) Node

func Time

func Time(attributes Attrs, children ...Node) Node

func Title

func Title(attributes Attrs, children ...Node) Node

func Tr

func Tr(attributes Attrs, children ...Node) Node

func Track

func Track(attributes Attrs, children ...Node) Node

func Tt

func Tt(attributes Attrs, children ...Node) Node

func U

func U(attributes Attrs, children ...Node) Node

func Ul

func Ul(attributes Attrs, children ...Node) Node

func Var

func Var(attributes Attrs, children ...Node) Node

func Video

func Video(attributes Attrs, children ...Node) Node

func Wbr

func Wbr(attributes Attrs, children ...Node) Node

type RawNode

type RawNode string

func (RawNode) Html

func (node RawNode) Html(conf HtmlConfig) string

type TextNode

type TextNode string

func (TextNode) Html

func (node TextNode) Html(conf HtmlConfig) string

Jump to

Keyboard shortcuts

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