html

package
v0.0.0-...-a1a65ea Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2014 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// BR creates <br/>
	BR = view.String("<br/>")

	// HR creates <hr/>
	HR = view.String("<hr/>")

	// DIVClearBoth creates <div style='clear:both'></div>
	DIVClearBoth = view.String("<div style='clear:both'></div>")
)
View Source
var CloseTag interface{}

Functions

func ABBR

func ABBR(longTitle, abbreviation string) view.View

ABBR creates <abbr title="longTitle">abbreviation</abbr>

func A_name

func A_name(name string) view.String

A_name creates a named anchor

func B

func B(content ...interface{}) view.View

B creates <b>content</b>

func CODE

func CODE(content ...interface{}) view.View

CODE creates <code>content</code>

func DEL

func DEL(content ...interface{}) view.View

DEL creates <del>content</del>

func DFN

func DFN(content ...interface{}) view.View

DFN creates <dfn>content</dfn>

func EM

func EM(content ...interface{}) view.View

EM creates <em>content</em>

func Element

func Element(tag string, args ...interface{}) view.View

func Escape

func Escape(text string) view.String

Escape HTML-escapes a string.

func H1

func H1(content ...interface{}) view.View

H1 creates <h1>content</h1>

func H2

func H2(content ...interface{}) view.View

H2 creates <h2>content</h2>

func H3

func H3(content ...interface{}) view.View

H3 creates <h3>content</h3>

func H4

func H4(content ...interface{}) view.View

H4 creates <h4>content</h4>

func H5

func H5(content ...interface{}) view.View

H5 creates <h5>content</h5>

func H6

func H6(content ...interface{}) view.View

H6 creates <h6>content</h6>

func I

func I(content ...interface{}) view.View

I creates <i>content</i>

func LABEL

func LABEL(label interface{}, target ViewWithID) view.Views

LABEL creates a Label for target and returns it together with target.

func P

func P(content ...interface{}) view.View

P creates <p>content</p>

func PRE

func PRE(content ...interface{}) view.View

PRE creates <pre>content</pre>

func Q

func Q(content ...interface{}) view.View

Q creates <q>content</q>

func RSSLink(title string, url view.URL) view.View

RSSLink creates <link rel='alternate' type='application/rss+xml' title='title' href='url'>

func SCRIPT

func SCRIPT(javascript string) view.String

SCRIPT creates <script>javascript</script>

func SECTION

func SECTION(class string, content ...interface{}) view.View

SECTION creates <sections class="class">content</section>

func STRONG

func STRONG(content ...interface{}) view.View

STRONG creates <strong>content</strong>

func STYLE

func STYLE(css string) view.String

STYLE creates <style>css</style>

func ScriptLink(url string) view.String

ScriptLink creates <script src='url'></script>

func UniqueID

func UniqueID() string

func WriteAttrib

func WriteAttrib(writer io.Writer, name, value interface{})

Types

type Canvas

type Canvas struct {
	ID     string
	Class  string
	Width  int
	Height int
}

func CANVAS

func CANVAS(class string, width, height int) *Canvas

CANVAS creates <canvas class="class" width="width" height="height"></canvas>

func (*Canvas) Render

func (canvas *Canvas) Render(ctx *view.Context) (err error)

type Div

type Div struct {
	ID      string
	Class   string
	Style   string
	OnClick string
	Content view.View
}

Div represents a HTML div element.

func DIV

func DIV(class string, content ...interface{}) *Div

DIV creates <div class="class">content</div>

func (*Div) GetID

func (div *Div) GetID() string

func (*Div) Render

func (div *Div) Render(ctx *view.Context) (err error)

func (*Div) SetID

func (div *Div) SetID(id string)

type DummyImage

type DummyImage struct {
	ID              string
	Class           string
	Width           int
	Height          int
	BackgroundColor string
	ForegroundColor string
	Text            string
}

DummyImage represents a HTML img element with src utilizing http://dummyimage.com.

func NewDummyImage

func NewDummyImage(width, height int) *DummyImage

func (*DummyImage) Render

func (self *DummyImage) Render(ctx *view.Context) (err error)

type Image

type Image struct {
	view.URL
	ID      string
	Class   string
	Width   int
	Height  int
	Title   string
	OnClick string
}

func IMG

func IMG(url string, dimensions ...int) *Image

IMG creates a HTML img element for an URL with optional width and height. The first int of dimensions is width, the second one height.

func (*Image) GetID

func (img *Image) GetID() string

func (*Image) Render

func (img *Image) Render(ctx *view.Context) (err error)

func (*Image) SetID

func (img *Image) SetID(id string)
type Link struct {
	view.URL
	UseLinkTag bool
	ID         string
	Class      string
	Title      string
	Rel        string
	NewWindow  bool
	OnClick    string
	// Name       string
	Content view.View
}

Link represents an HTML <a> or <link> element depending on UseLinkTag.

func A

func A(url view.URL, content ...interface{}) *Link

A creates <a href="url">content</a>

func A_blank

func A_blank(url view.URL, content ...interface{}) *Link

A_blank creates <a href="url" target="_blank">content</a>

func A_blank_nofollow

func A_blank_nofollow(url view.URL, content ...interface{}) *Link

A_blank_nofollow creates <a href="url" target="_blank" rel="nofollow">content</a>

func A_nofollow

func A_nofollow(url view.URL, content ...interface{}) *Link

A_nofollow creates <a href="url" rel="nofollow">content</a>

func StylesheetLink(url view.URL) *Link

StylesheetLink creates <link rel='stylesheet' href='url'>

func (*Link) GetID

func (link *Link) GetID() string

func (*Link) Render

func (link *Link) Render(ctx *view.Context) (err error)

func (*Link) SetID

func (link *Link) SetID(id string)

type List

type List struct {
	ID          string
	Class       string
	Style       string
	Ordered     bool
	OrderOffset uint
	Items       []view.View
}

func OL

func OL(items ...interface{}) *List

OL is a shortcut to create an ordered list by wrapping items as HTML views. NewView will be called for every passed item.

Example:

OL("red", "green", "blue")
OL(A(url1, "First Link"), A(url2, "Second Link"))

func UL

func UL(items ...interface{}) *List

UL is a shortcut to create an unordered list by wrapping items as HTML views. NewView will be called for every passed item.

Example:

UL("red", "green", "blue")
UL(A(url1, "First Link"), A(url2, "Second Link"))

func (*List) GetID

func (list *List) GetID() string

func (*List) Render

func (list *List) Render(ctx *view.Context) (err error)

func (*List) SetID

func (list *List) SetID(id string)

type Page

type Page struct {
	Content view.View
}

func (*Page) Render

func (page *Page) Render(ctx *view.Context) (err error)

type Span

type Span struct {
	ID      string
	Class   string
	Style   string
	OnClick string
	Content view.View
}

Span represents a HTML span element.

func SPAN

func SPAN(class string, content ...interface{}) *Span

SPAN creates <span class="class">content</span>

func (*Span) GetID

func (span *Span) GetID() string

func (*Span) Render

func (span *Span) Render(ctx *view.Context) (err error)

func (*Span) SetID

func (span *Span) SetID(id string)

type ViewWithID

type ViewWithID interface {
	view.View
	GetID() string
	SetID(string)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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