htmldoc

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2016 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AttrPresent added in v0.1.1

func AttrPresent(attrs []html.Attribute, key string) bool

func ExtractAttrs added in v0.1.1

func ExtractAttrs(attrs []html.Attribute, keys []string) map[string]string

func GetId added in v0.1.1

func GetId(attrs []html.Attribute) string

func URLStripQueryString

func URLStripQueryString(urlStr string) string

Types

type Document

type Document struct {
	FilePath  string // Relative to the shell session
	SitePath  string // Relative to the site root
	Directory string

	NodesOfInterest []*html.Node
	State           DocumentState
	// contains filtered or unexported fields
}

func (*Document) Init added in v0.1.1

func (doc *Document) Init()

func (*Document) IsHashValid added in v0.1.1

func (doc *Document) IsHashValid(hash string) bool

func (*Document) Parse

func (doc *Document) Parse()

type DocumentState

type DocumentState struct {
	FaviconPresent bool
}

Used by checks that depend on the document being parsed

type DocumentStore added in v0.1.1

type DocumentStore struct {
	BasePath          string               // Path, relative to cwd, the site is located in
	IgnorePatterns    []interface{}        // Regexes of directories to ignore
	Documents         []*Document          // All of the documents, used to iterate over
	DocumentPathMap   map[string]*Document // Maps slash separated paths to documents
	DocumentExtension string               // File extension to look for
	DirectoryIndex    string               // What file is the index of the directory
}

func NewDocumentStore added in v0.1.1

func NewDocumentStore() DocumentStore

func (*DocumentStore) AddDocument added in v0.1.1

func (dS *DocumentStore) AddDocument(doc *Document)

func (*DocumentStore) Discover added in v0.1.1

func (dS *DocumentStore) Discover()

func (*DocumentStore) ResolvePath added in v0.1.1

func (dS *DocumentStore) ResolvePath(refPath string) (*Document, bool)

func (*DocumentStore) ResolveRef added in v0.1.1

func (dS *DocumentStore) ResolveRef(ref *Reference) (*Document, bool)

type Reference

type Reference struct {
	Document *Document
	Node     *html.Node
	Path     string
	URL      *url.URL
}

func NewReference

func NewReference(document *Document, node *html.Node, path string) *Reference

func (*Reference) IsInternalAbsolute

func (ref *Reference) IsInternalAbsolute() bool

func (*Reference) RefSitePath added in v0.1.1

func (ref *Reference) RefSitePath() string

func (*Reference) Scheme

func (ref *Reference) Scheme() string

func (*Reference) URLString

func (ref *Reference) URLString() string

Jump to

Keyboard shortcuts

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