nohtml

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

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

Go to latest
Published: Aug 16, 2020 License: MIT Imports: 9 Imported by: 0

README

nohtml

Golang package for interactive web-pages without any HTML

Documentation

Overview

Package nohtml provides functions to build web apps without HTML.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler(v interface{}) http.Handler

Handler returns a http.Handler which serves the provided object.

Types

type Context

type Context struct {
	// contains filtered or unexported fields
}

Context tracks a request context.

func New

func New(r *http.Request) *Context

New creates a context from a http request.

func (*Context) AppendHash

func (c *Context) AppendHash(hashElement string) *Context

AppendHash returns a new context with the provided hash element appended to it.

func (*Context) AppendPath

func (c *Context) AppendPath(pathElement string) *Context

AppendPath returns a new context with the provided path element appended to it.

func (*Context) Context

func (c *Context) Context() context.Context

Context returns the context.Context associated with the current request.

func (*Context) Element

func (c *Context) Element(tag string, children ...*html.Node) *html.Node

Element returns a html Element node with the provided tag and children.

func (*Context) HRef

func (c *Context) HRef() string

HRef returns a valid HREF for the current scope

func (*Context) Hash

func (c *Context) Hash() (string, *Context)

Hash returns the first element in the request hash and returns a sub-context (which has the rest of the hash).

func (c *Context) Link(label, href string) *html.Node

RenderLink returns an anchor node.

func (*Context) Path

func (c *Context) Path() (string, *Context)

Path returns the first element in the request path and returns a sub-context (which has the rest of the path).

func (*Context) Render

func (c *Context) Render(v interface{}, parent *html.Node)

Render renders any value, appending into the provided HTML node.

func (*Context) RenderNavContainer

func (c *Context) RenderNavContainer(parent *html.Node) (options, contents *html.Node)

RenderNavContainer renders a simple nav container with a sub container for options and contents.

func (*Context) Text

func (c *Context) Text(content string) *html.Node

Text returns a html Text node with the provided content.

Jump to

Keyboard shortcuts

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