expr

package
v0.0.0-...-775479d Latest Latest
Warning

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

Go to latest
Published: May 5, 2018 License: BSD-2-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	A          = ElementChecker(atom.A)
	Abbr       = ElementChecker(atom.Abbr)
	Address    = ElementChecker(atom.Address)
	Area       = ElementChecker(atom.Area)
	Article    = ElementChecker(atom.Article)
	Aside      = ElementChecker(atom.Aside)
	Audio      = ElementChecker(atom.Audio)
	B          = ElementChecker(atom.B)
	Base       = ElementChecker(atom.Base)
	Bdi        = ElementChecker(atom.Bdi)
	Bdo        = ElementChecker(atom.Bdo)
	Blockquote = ElementChecker(atom.Blockquote)
	Body       = ElementChecker(atom.Body)
	Br         = ElementChecker(atom.Br)
	Button     = ElementChecker(atom.Button)
	Canvas     = ElementChecker(atom.Canvas)
	Caption    = ElementChecker(atom.Caption)
	Cite       = ElementChecker(atom.Cite)
	Code       = ElementChecker(atom.Code)
	Col        = ElementChecker(atom.Col)
	Colgroup   = ElementChecker(atom.Colgroup)
	Data       = ElementChecker(atom.Data)
	Datalist   = ElementChecker(atom.Datalist)
	Dd         = ElementChecker(atom.Dd)
	Del        = ElementChecker(atom.Del)
	Details    = ElementChecker(atom.Details)
	Dfn        = ElementChecker(atom.Dfn)
	Dialog     = ElementChecker(atom.Dialog)
	Div        = ElementChecker(atom.Div)
	Dl         = ElementChecker(atom.Dl)
	Dt         = ElementChecker(atom.Dt)
	Em         = ElementChecker(atom.Em)
	Embed      = ElementChecker(atom.Embed)
	Fieldset   = ElementChecker(atom.Fieldset)
	Figcaption = ElementChecker(atom.Figcaption)
	Figure     = ElementChecker(atom.Figure)
	Footer     = ElementChecker(atom.Footer)
	Form       = ElementChecker(atom.Form)
	H1         = ElementChecker(atom.H1)
	H2         = ElementChecker(atom.H2)
	H3         = ElementChecker(atom.H3)
	H4         = ElementChecker(atom.H4)
	H5         = ElementChecker(atom.H5)
	H6         = ElementChecker(atom.H6)
	Head       = ElementChecker(atom.Head)
	Header     = ElementChecker(atom.Header)
	Hgroup     = ElementChecker(atom.Hgroup)
	Hr         = ElementChecker(atom.Hr)
	Html       = ElementChecker(atom.Html)
	I          = ElementChecker(atom.I)
	Iframe     = ElementChecker(atom.Iframe)
	Img        = ElementChecker(atom.Img)
	Input      = ElementChecker(atom.Input)
	Ins        = ElementChecker(atom.Ins)
	Kbd        = ElementChecker(atom.Kbd)
	Label      = ElementChecker(atom.Label)
	Legend     = ElementChecker(atom.Legend)
	Li         = ElementChecker(atom.Li)
	Link       = ElementChecker(atom.Link)
	Map        = ElementChecker(atom.Map)
	Mark       = ElementChecker(atom.Mark)
	Menu       = ElementChecker(atom.Menu)
	Meta       = ElementChecker(atom.Meta)
	Meter      = ElementChecker(atom.Meter)
	Nav        = ElementChecker(atom.Nav)
	Noscript   = ElementChecker(atom.Noscript)
	Object     = ElementChecker(atom.Object)
	Ol         = ElementChecker(atom.Ol)
	Optgroup   = ElementChecker(atom.Optgroup)
	Option     = ElementChecker(atom.Option)
	Output     = ElementChecker(atom.Output)
	P          = ElementChecker(atom.P)
	Param      = ElementChecker(atom.Param)
	Pre        = ElementChecker(atom.Pre)
	Progress   = ElementChecker(atom.Progress)
	Q          = ElementChecker(atom.Q)
	Rp         = ElementChecker(atom.Rp)
	Rt         = ElementChecker(atom.Rt)
	Ruby       = ElementChecker(atom.Ruby)
	S          = ElementChecker(atom.S)
	Samp       = ElementChecker(atom.Samp)
	Script     = ElementChecker(atom.Script)
	Section    = ElementChecker(atom.Section)
	Select     = ElementChecker(atom.Select)
	Small      = ElementChecker(atom.Small)
	Source     = ElementChecker(atom.Source)
	Span       = ElementChecker(atom.Span)
	Strong     = ElementChecker(atom.Strong)
	Style      = ElementChecker(atom.Style)
	Sub        = ElementChecker(atom.Sub)
	Summary    = ElementChecker(atom.Summary)
	Sup        = ElementChecker(atom.Sup)
	Table      = ElementChecker(atom.Table)
	Tbody      = ElementChecker(atom.Tbody)
	Td         = ElementChecker(atom.Td)
	Textarea   = ElementChecker(atom.Textarea)
	Tfoot      = ElementChecker(atom.Tfoot)
	Th         = ElementChecker(atom.Th)
	Thead      = ElementChecker(atom.Thead)
	Time       = ElementChecker(atom.Time)
	Title      = ElementChecker(atom.Title)
	Tr         = ElementChecker(atom.Tr)
	Track      = ElementChecker(atom.Track)
	U          = ElementChecker(atom.U)
	Ul         = ElementChecker(atom.Ul)
	Var        = ElementChecker(atom.Var)
	Video      = ElementChecker(atom.Video)
	Wbr        = ElementChecker(atom.Wbr)
)
View Source
var (
	Abbr_               = AttrChecker("abbr")
	Accept              = AttrChecker("accept")
	AcceptCharset       = SeperatedAttrChecker("accept-charset", ' ')
	Accesskey           = SeperatedAttrChecker("accesskey", ' ')
	Action              = AttrChecker("action")
	Allowfullscreen     = AttrChecker("allowfullscreen")
	Allowpaymentrequest = AttrChecker("allowpaymentrequest")
	Allowusermedia      = AttrChecker("allowusermedia")
	Alt                 = AttrChecker("alt")
	As                  = AttrChecker("as")
	Async               = AttrChecker("async")
	Autocomplete        = AttrChecker("autocomplete")
	Autofocus           = AttrChecker("autofocus")
	Autoplay            = AttrChecker("autoplay")
	Charset             = AttrChecker("charset")
	Checked             = AttrChecker("checked")
	Cite_               = AttrChecker("cite")
	Class               = SeperatedAttrChecker("class", ' ')
	Color               = AttrChecker("color")
	Cols                = AttrChecker("cols")
	Colspan             = AttrChecker("colspan")
	Content             = AttrChecker("content")
	Contenteditable     = AttrChecker("contenteditable")
	Controls            = AttrChecker("controls")
	Coords              = AttrChecker("coords")
	Crossorigin         = AttrChecker("crossorigin")
	Data_               = AttrChecker("data")
	Datetime            = AttrChecker("datetime")
	Default             = AttrChecker("default")
	Defer               = AttrChecker("defer")
	Dir                 = AttrChecker("dir")
	Dirname             = AttrChecker("dirname")
	Disabled            = AttrChecker("disabled")
	Download            = AttrChecker("download")
	Draggable           = AttrChecker("draggable")
	Enctype             = AttrChecker("enctype")
	For                 = AttrChecker("for")
	Form_               = AttrChecker("form")
	Formaction          = AttrChecker("formaction")
	Formenctype         = AttrChecker("formenctype")
	Formmethod          = AttrChecker("formmethod")
	Formnovalidate      = AttrChecker("formnovalidate")
	Formtarget          = AttrChecker("formtarget")
	Headers             = SeperatedAttrChecker("headers", ' ')
	Height              = AttrChecker("height")
	Hidden              = AttrChecker("hidden")
	High                = AttrChecker("high")
	Href                = AttrChecker("href")
	Hreflang            = AttrChecker("hreflang")
	HttpEquiv           = AttrChecker("http-equiv")
	Id                  = AttrChecker("id")
	Inputmode           = AttrChecker("inputmode")
	Integrity           = AttrChecker("integrity")
	Is                  = AttrChecker("is")
	Ismap               = AttrChecker("ismap")
	Itemid              = AttrChecker("itemid")
	Itemprop            = SeperatedAttrChecker("itemprop", ' ')
	Itemref             = SeperatedAttrChecker("itemref", ' ')
	Itemscope           = AttrChecker("itemscope")
	Itemtype            = SeperatedAttrChecker("itemtype", ' ')
	Kind                = AttrChecker("kind")
	Label_              = AttrChecker("label")
	Lang                = AttrChecker("lang")
	List                = AttrChecker("list")
	Loop                = AttrChecker("loop")
	Low                 = AttrChecker("low")
	Manifest            = AttrChecker("manifest")
	Max                 = AttrChecker("max")
	Maxlength           = AttrChecker("maxlength")
	Media               = AttrChecker("media")
	Method              = AttrChecker("method")
	Min                 = AttrChecker("min")
	Minlength           = AttrChecker("minlength")
	Multiple            = AttrChecker("multiple")
	Muted               = AttrChecker("muted")
	Name                = AttrChecker("name")
	Nomodule            = AttrChecker("nomodule")
	Nonce               = AttrChecker("nonce")
	Novalidate          = AttrChecker("novalidate")
	Open                = AttrChecker("open")
	Optimum             = AttrChecker("optimum")
	Pattern             = AttrChecker("pattern")
	Ping                = SeperatedAttrChecker("ping", ' ')
	Placeholder         = AttrChecker("placeholder")
	Playsinline         = AttrChecker("playsinline")
	Poster              = AttrChecker("poster")
	Preload             = AttrChecker("preload")
	Readonly            = AttrChecker("readonly")
	Referrerpolicy      = AttrChecker("referrerpolicy")
	Rel                 = SeperatedAttrChecker("rel", ' ')
	Required            = AttrChecker("required")
	Reversed            = AttrChecker("reversed")
	Rows                = AttrChecker("rows")
	Rowspan             = AttrChecker("rowspan")
	Sandbox             = SeperatedAttrChecker("sandbox", ' ')
	Scope               = AttrChecker("scope")
	Selected            = AttrChecker("selected")
	Shape               = AttrChecker("shape")
	Size                = AttrChecker("size")
	Sizes               = SeperatedAttrChecker("sizes", ' ')
	Slot_               = AttrChecker("slot")
	Span_               = AttrChecker("span")
	Spellcheck          = AttrChecker("spellcheck")
	Src                 = AttrChecker("src")
	Srcdoc              = AttrChecker("srcdoc")
	Srclang             = AttrChecker("srclang")
	Srcset              = AttrChecker("srcset")
	Start               = AttrChecker("start")
	Step                = AttrChecker("step")
	Style_              = AttrChecker("style")
	Tabindex            = AttrChecker("tabindex")
	Target              = AttrChecker("target")
	Title_              = AttrChecker("title")
	Translate           = AttrChecker("translate")
	Type                = AttrChecker("type")
	Typemustmatch       = AttrChecker("typemustmatch")
	Updateviacache      = AttrChecker("updateviacache")
	Usemap              = AttrChecker("usemap")
	Value               = AttrChecker("value")
	Width               = AttrChecker("width")
	Workertype          = AttrChecker("workertype")
	Wrap                = AttrChecker("wrap")
)
View Source
var (
	ErrorNode    = TypeChecker(html.ErrorNode)
	TextNode     = TypeChecker(html.TextNode)
	DocumentNode = TypeChecker(html.DocumentNode)
	ElementNode  = TypeChecker(html.ElementNode)
	CommentNode  = TypeChecker(html.CommentNode)
	DoctypeNode  = TypeChecker(html.DoctypeNode)
)
View Source
var (
	Ahref = And(A, HasAttr("href"))
)

Functions

func AttrChecker

func AttrChecker(key string) func(string) Checker

func FirstChild

func FirstChild(n *html.Node) *html.Node

func GetAttr

func GetAttr(n *html.Node, key string) *string

func GetAttrSubmatch

func GetAttrSubmatch(n *html.Node, key, pat string) *string

func GetHref

func GetHref(n *html.Node) *string

func GetPat

func GetPat(pat []string) string

func GetSrc

func GetSrc(n *html.Node) *string

func GetSubmatch

func GetSubmatch(s *string, pat string) *string

func GetSubmatch_

func GetSubmatch_(s *string, rx *regexp.Regexp) *string

func GetText

func GetText(n *html.Node) *string

func GetTextNodeText

func GetTextNodeText(n *html.Node) *string

func Integers

func Integers(next Iter, f StringGetter) []int

func NextSibling

func NextSibling(n *html.Node) *html.Node

func NonemptyTextNode

func NonemptyTextNode(n *html.Node) *html.Node

func Parent

func Parent(n *html.Node) *html.Node

func PrevSibling

func PrevSibling(n *html.Node) *html.Node

func SeperatedAttrChecker

func SeperatedAttrChecker(name string, sep rune) func(...string) Checker

func Strings

func Strings(next Iter, f StringGetter, pat ...string) []string

func ToFloat

func ToFloat(ps *string) *float64

func ToHex

func ToHex(ps *string) *int

func ToInt

func ToInt(ps *string) *int

func ToTime

func ToTime(ps *string, layout string) *time.Time

Types

type Checker

type Checker func(*html.Node) *html.Node

func And

func And(cs ...Checker) Checker

func AtomChecker

func AtomChecker(a atom.Atom) Checker

func Attr

func Attr(key, pat string) Checker

func AttributeCmpChecker

func AttributeCmpChecker(key string, cmp func(string) bool) Checker

func CaptionText

func CaptionText(pat string) Checker

func ElementChecker

func ElementChecker(a atom.Atom) Checker

func Find

func Find(cs ...Checker) Checker

Broad first search in all descendants

func FindChild

func FindChild(cs ...Checker) Checker

Find in direct children

func FindSibling

func FindSibling(cs ...Checker) Checker

Find in sibling nodes

func HasAttr

func HasAttr(key string) Checker

func NoAttr

func NoAttr(key string) Checker

func Not

func Not(c Checker) Checker

func Or

func Or(cs ...Checker) Checker

func Pipe

func Pipe(cs ...Checker) Checker

func Text

func Text(pat string) Checker

func Text_

func Text_(rx *regexp.Regexp) Checker

func TypeChecker

func TypeChecker(t html.NodeType) Checker

type Iter

type Iter func() *html.Node

func Children

func Children(n *html.Node, cs ...Checker) Iter

func Descendants

func Descendants(n *html.Node, cs ...Checker) Iter

Pre-order depth first traversal in all descendants

func IterIter

func IterIter(next Iter, cs ...Checker) Iter

type Queue

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

FIFO queue.

func NewQueue

func NewQueue() *Queue

func (*Queue) Len

func (q *Queue) Len() int

func (*Queue) Pop

func (q *Queue) Pop() *html.Node

func (*Queue) Push

func (q *Queue) Push(n *html.Node)

func (*Queue) PushNodes

func (q *Queue) PushNodes(next Iter)

type Stack

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

FILO stack.

func NewStack

func NewStack() *Stack

func (*Stack) Len

func (s *Stack) Len() int

func (*Stack) Pop

func (s *Stack) Pop() (n *html.Node)

func (*Stack) Push

func (s *Stack) Push(n *html.Node)

type StringGetter

type StringGetter func(*html.Node) *string

Jump to

Keyboard shortcuts

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