pipe

package
v0.0.0-...-799c480 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Clause

type Clause interface {
	IsTrue(Context, Page) bool
}

func IsPath

func IsPath(path string) Clause

func IsURL

func IsURL(url string) Clause

type ClauseFunc

type ClauseFunc func(x Context, p Page) bool

func (ClauseFunc) IsTrue

func (f ClauseFunc) IsTrue(x Context, p Page) bool

type CleanClassFilter

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

func CleanClassName

func CleanClassName() CleanClassFilter

func (CleanClassFilter) Apply

func (f CleanClassFilter) Apply(_ Context, p Page) (Page, error)

func (CleanClassFilter) WithPreserveClasses

func (f CleanClassFilter) WithPreserveClasses(classes ...string) CleanClassFilter

func (CleanClassFilter) WithPreserveSelectors

func (f CleanClassFilter) WithPreserveSelectors(selectors ...string) CleanClassFilter

type CleanStyleFilter

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

func CleanStyle

func CleanStyle() CleanStyleFilter

func (CleanStyleFilter) Apply

func (f CleanStyleFilter) Apply(_ Context, p Page) (Page, error)

func (CleanStyleFilter) WithPreserveSelectors

func (f CleanStyleFilter) WithPreserveSelectors(selectors ...string) CleanStyleFilter

type Condition

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

func If

func If(clause Clause) Condition

func (Condition) Apply

func (c Condition) Apply(x Context, p Page) (Page, error)

func (Condition) Else

func (c Condition) Else(filters ...Filter) Condition

func (Condition) Then

func (c Condition) Then(filters ...Filter) Condition

type Context

type Context struct {
	URL  *url.URL
	Path string
}

type Filter

type Filter interface {
	Apply(Context, Page) (Page, error)
}

func Container

func Container(selectors ...string) Filter

func DefaultMeta

func DefaultMeta() Filter

func MapOriginalURLPrefix

func MapOriginalURLPrefix(from, to string) Filter

func SanitizeHTML

func SanitizeHTML() Filter

func SyntaxHighlight

func SyntaxHighlight() Filter

type FilterFunc

type FilterFunc func(Context, Page) (Page, error)

func (FilterFunc) Apply

func (f FilterFunc) Apply(x Context, p Page) (Page, error)

type Mark

type Mark struct {
	Kind string
	Name string
}

type Meta

type Meta struct {
	Title       string
	OriginalURL string
}

type Option

type Option interface {
	Apply(*Pipeline)
}

func Filters

func Filters(filters ...Filter) Option

type OptionFunc

type OptionFunc func(*Pipeline)

func (OptionFunc) Apply

func (f OptionFunc) Apply(c *Pipeline)

type Page

type Page struct {
	Meta  Meta
	Doc   *goquery.Document
	Marks []Mark
}

type Pipeline

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

func New

func New(options ...Option) Pipeline

func (Pipeline) Process

func (p Pipeline) Process(x Context, page Page) (Page, error)

type RewriteURLsFilter

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

func RewriteURLs

func RewriteURLs(siteKey string, rootURL string) RewriteURLsFilter

func (RewriteURLsFilter) Apply

func (f RewriteURLsFilter) Apply(x Context, p Page) (Page, error)

func (RewriteURLsFilter) WithDisallowedPaths

func (f RewriteURLsFilter) WithDisallowedPaths(paths ...string) RewriteURLsFilter

func (RewriteURLsFilter) WithDisallowedURLFilters

func (f RewriteURLsFilter) WithDisallowedURLFilters(filters ...*regexp.Regexp) RewriteURLsFilter

func (RewriteURLsFilter) WithPrefixMappings

func (f RewriteURLsFilter) WithPrefixMappings(fromto ...string) RewriteURLsFilter

func (RewriteURLsFilter) WithURLFilters

func (f RewriteURLsFilter) WithURLFilters(filters ...*regexp.Regexp) RewriteURLsFilter

Jump to

Keyboard shortcuts

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