outline

package
v0.0.0-...-3990c93 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2020 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package outline extracts information from html pages.

Index

Constants

This section is empty.

Variables

View Source
var Error = errors.New("malformed structure")

Functions

func ToText

func ToText(n *html.Node) string

Types

type Anchor

type Anchor struct {
	Title string
	// <a>label</a> or <a><img alt="label"/></a>
	Label string
	URL   *url.URL
	Rel   string
}

type Document

type Document struct {
	Type DocumentType

	Language    language.Tag
	Title       string
	Description string
	Author      string

	Nav []Anchor
}

type DocumentType

type DocumentType int

Document Kind

const (
	UnknownType DocumentType = iota
	ArticleType
	BlogIndexType
	FAQType
)

type Outline

type Outline struct {
	DocumentNode *html.Node
	HeadNode     *html.Node
	BodyNode     *html.Node
	NavNodes     []*html.Node
	MainNode     *html.Node
	ArticleNodes []*html.Node
	SidebarNode  *html.Node
	FooterNode   *html.Node
}

func Build

func Build(r io.Reader) (*Outline, error)

func (*Outline) Extract

func (o *Outline) Extract() *Document

Jump to

Keyboard shortcuts

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