Documentation ¶
Index ¶
- Variables
- func GetJSONByte(nodes []*html.Node) []byte
- func ParseArgs() ([]string, error)
- func ParseAttrMatcher(selector *CSSSelector, s scanner.Scanner) error
- func ParseClassMatcher(selector *CSSSelector, s scanner.Scanner) error
- func ParseCommands(cmdString string) ([]string, error)
- func ParseDisplayer(cmd string) error
- func ParseHTML(r io.Reader, cs string) (*html.Node, error)
- func ParseIdMatcher(selector *CSSSelector, s scanner.Scanner) error
- func ParsePseudo(selector *CSSSelector, s scanner.Scanner) error
- func ParseTagMatcher(selector *CSSSelector, s scanner.Scanner) error
- func PrintHelp(w io.Writer, exitCode int)
- func ProcessFlags(cmds []string) (nonFlagCmds []string, err error)
- func Run(_pupIn io.ReadCloser) []byte
- type AttrDisplayer
- type CSSSelector
- type Displayer
- type JSONDisplayer
- type NumDisplayer
- type PseudoClass
- type Selector
- type SelectorFunc
- type TextDisplayer
- type TreeDisplayer
Constants ¶
This section is empty.
Variables ¶
View Source
var VERSION string = "0.4.0"
Functions ¶
func GetJSONByte ¶
func ParseAttrMatcher ¶
func ParseAttrMatcher(selector *CSSSelector, s scanner.Scanner) error
Parse an attribute matcher e.g. `[attr^="http"]`
func ParseClassMatcher ¶
func ParseClassMatcher(selector *CSSSelector, s scanner.Scanner) error
Parse a class matcher e.g. `.btn`
func ParseCommands ¶
Split a string with awareness for quoted text and commas
func ParseDisplayer ¶
func ParseIdMatcher ¶
func ParseIdMatcher(selector *CSSSelector, s scanner.Scanner) error
Parse an id matcher e.g. `#my-picture`
func ParsePseudo ¶
func ParsePseudo(selector *CSSSelector, s scanner.Scanner) error
Parse the selector after ':'
func ParseTagMatcher ¶
func ParseTagMatcher(selector *CSSSelector, s scanner.Scanner) error
Parse the initial tag e.g. `div`
func ProcessFlags ¶
Process command arguments and return all non-flags.
func Run ¶
func Run(_pupIn io.ReadCloser) []byte
Types ¶
type AttrDisplayer ¶
type AttrDisplayer struct {
Attr string
}
Print the attribute of a node
func (AttrDisplayer) Display ¶
func (a AttrDisplayer) Display(nodes []*html.Node)
type CSSSelector ¶
type CSSSelector struct { Tag string Attrs map[string]*regexp.Regexp Pseudo PseudoClass }
func ParseSelector ¶
func ParseSelector(cmd string) (selector CSSSelector, err error)
Parse a selector e.g. `div#my-button.btn[href^="http"]`
type JSONDisplayer ¶
type JSONDisplayer struct{}
Print nodes as a JSON list
func (JSONDisplayer) Display ¶
func (j JSONDisplayer) Display(nodes []*html.Node)
type NumDisplayer ¶
type NumDisplayer struct{}
Print the number of features returned
func (NumDisplayer) Display ¶
func (d NumDisplayer) Display(nodes []*html.Node)
type PseudoClass ¶
type SelectorFunc ¶
func Select ¶
func Select(s Selector) SelectorFunc
func SelectFromChildren ¶
func SelectFromChildren(s Selector) SelectorFunc
Defined for the '+' selector
func SelectNextSibling ¶
func SelectNextSibling(s Selector) SelectorFunc
Defined for the '>' selector
type TextDisplayer ¶
type TextDisplayer struct{}
Print the text of a node
func (TextDisplayer) Display ¶
func (t TextDisplayer) Display(nodes []*html.Node)
type TreeDisplayer ¶
type TreeDisplayer struct { }
func (TreeDisplayer) Display ¶
func (t TreeDisplayer) Display(nodes []*html.Node)
Click to show internal directories.
Click to hide internal directories.