htmlDoc

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

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

Go to latest
Published: Mar 2, 2019 License: LGPL-3.0 Imports: 5 Imported by: 0

README

Build Status

htmlDoc

A wrapper around github.com/PuerkitoBio/goquery

Documentation

Overview

A wrapper around qoquery and a means to create markup structures

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAmpDocRenderer

func NewAmpDocRenderer(d *HtmlDoc) *ampDocRenderer

func NewAmpNodeRenderer

func NewAmpNodeRenderer(n *Node) nodeRenderer

func NewHtmlDocRenderer

func NewHtmlDocRenderer(d Doc) *htmlDocRenderer

func NewHtmlNodeRenderer

func NewHtmlNodeRenderer(n *Node) nodeRenderer

Types

type Doc

type Doc interface {
	// contains filtered or unexported methods
}

type HtmlDoc

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

HtmlDoc sort of wraps a goquery document and allows to add Nodes to the head and/or body of the document

func NewHtmlDoc

func NewHtmlDoc() *HtmlDoc

NewHtmlDoc createas a pointer to a new HtmlDoc and initializes it with an (almost) empty goquery.Document

func (*HtmlDoc) AddBodyNode

func (p *HtmlDoc) AddBodyNode(n *Node)

Add a Node which is going to end up in the body of the HTML Document

func (*HtmlDoc) AddHeadNode

func (p *HtmlDoc) AddHeadNode(n *Node)

Add a Node which is going to end up in the head of the HTML Document

func (*HtmlDoc) AddRootAttr

func (p *HtmlDoc) AddRootAttr(att ...string)

func (*HtmlDoc) Render

func (p *HtmlDoc) Render() string

Render renders the HtmlDoc as HTML, including all its nodes within the head and body part

func (*HtmlDoc) RenderAmp

func (p *HtmlDoc) RenderAmp() string

Render as AMP

func (*HtmlDoc) RenderBody

func (p *HtmlDoc) RenderBody() string

Render head nodes

func (*HtmlDoc) RenderHead

func (p *HtmlDoc) RenderHead() string

Render head nodes

type Node

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

The Node is a programmatic description of HTML dom nodes

func NewNode

func NewNode(tagName string, text string, attributes ...string) *Node

Create a new Node and takes its name, a possible text contained by the Node and a variadic list of attributes as parameters. The attributes are supposed to be name value pairs and thus their number need to be divisble by two.

func (*Node) AddChild

func (n *Node) AddChild(node *Node)

AddChild allow to add a child Node to the current Node

Jump to

Keyboard shortcuts

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