gen

package module
v0.0.0-...-f6c02ae Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2022 License: GPL-2.0 Imports: 2 Imported by: 0

README

HTMLgen!

A package to help you write WASM, or HTML inside of Golang!

Installation

Easily install with the following command:

go get github.com/Nigel2392/gen

Usage

Example of form submissions:
var body = g.Div()
var form = body.Form()
form.Method("POST").Action("")
form.Label("Name")
form.Input("text")                       // Type
form.Input("text", "name")               // Type, name and id
form.Input("submit", "submit", "Submit") // Type, name and display text
var _, rdy = form.WasmFormSubmit(func(data map[string]string) {
	println(fmt.Sprintf("Form submitted: %v", data))
})
// Generate the HTML inside of wasm, append it to and existing html element.
body.WasmGenerate(elems.ID_MAIN_CONTENT, rdy)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTML

type HTML struct {
	Head   *elems.Element
	Body   *elems.Element
	Buffer elems.Buffer
}

func NewHTML

func NewHTML(title string, buf ...elems.Buffer) *HTML

func (*HTML) Add

func (h *HTML) Add(e ...*elems.Element) *elems.Element

func (*HTML) AddHead

func (h *HTML) AddHead(e ...*elems.Element) *elems.Element

func (*HTML) HTML

func (h *HTML) HTML(templateData any, buffer ...elems.Buffer) string

Render to template.

func (*HTML) Release

func (h *HTML) Release()

func (*HTML) RenderBuffer

func (h *HTML) RenderBuffer(buffer elems.Buffer, templateData any) elems.Buffer

func (*HTML) Script

func (h *HTML) Script(src string, typ ...string) *elems.Element

func (*HTML) ScriptInline

func (h *HTML) ScriptInline(sourceCode string, typ ...string) *elems.Element

func (*HTML) ScriptOnLoad

func (h *HTML) ScriptOnLoad(sourceCode string, typ ...string) *elems.Element

func (*HTML) SetTitle

func (h *HTML) SetTitle(str string)

func (*HTML) String

func (h *HTML) String() string

func (*HTML) Style

func (h *HTML) Style(sourceCode string) *elems.Element

func (*HTML) StyleSheet

func (h *HTML) StyleSheet(href string, rel string) *elems.Element

Directories

Path Synopsis
Urls for normal build
Urls for normal build

Jump to

Keyboard shortcuts

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