utils

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ColorsDefault = iota
	ColorsForced
	ColorsDisabled
)

Variables

This section is empty.

Functions

func CSSQuery added in v1.1.0

func CSSQuery(reader io.Reader, writer io.Writer, query string, attr string, options QueryOptions) error

func FormatHtml added in v1.0.0

func FormatHtml(reader io.Reader, writer io.Writer, indent string, colors int) error

func FormatJson added in v1.2.0

func FormatJson(reader io.Reader, writer io.Writer, indent string, colors int) error

func FormatXml

func FormatXml(reader io.Reader, writer io.Writer, indent string, colors int) error

func IsHTML added in v1.1.1

func IsHTML(input string) bool

func IsJSON added in v1.2.0

func IsJSON(input string) bool

func LoadConfig added in v1.2.5

func LoadConfig(fileName string) error

func NodeToJSON added in v1.3.0

func NodeToJSON(node *xmlquery.Node, depth int) interface{}

NodeToJSON converts an xmlquery.Node to a JSON object. The depth parameter specifies how many levels of children to include in the result. A depth of 0 means only the text content of the node is included. A depth of 1 means the node's children are included, but not their children, and so on.

func PagerPrint

func PagerPrint(reader io.Reader, writer io.Writer) error

func XPathQuery

func XPathQuery(reader io.Reader, writer io.Writer, query string, singleNode bool, options QueryOptions) (errRes error)

Types

type ConfigOptions added in v1.2.5

type ConfigOptions struct {
	Indent  int
	Tab     bool
	NoColor bool
	Color   bool
	Html    bool
	Node    bool
}

func GetConfig added in v1.2.5

func GetConfig() ConfigOptions

type ContentType added in v1.2.0

type ContentType int
const (
	ContentXml ContentType = iota
	ContentHtml
	ContentJson
	ContentText
)

type QueryOptions added in v1.2.0

type QueryOptions struct {
	WithTags bool
	Indent   string
	Colors   int
}

Jump to

Keyboard shortcuts

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