htmlproc

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package htmlproc implements a Processor to process HTML documents.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHTMLProcessor

func NewHTMLProcessor(config Config) processor.Processor

NewHTMLProcessor creates and initializes a new Processor to process HTML documents. The Processor turns provided exchange.Response into htmldoc.HTMLResponse then runs the specified htmltask.HTMLTasks one by one. The Processor fails immediately when some HTMLTask encounters an error.

Types

type Config

type Config struct {
	// TaskSet specifies the sequence of HTMLTasks to run.
	//
	// nil or empty implies htmltask.ConservativeTaskSet.
	TaskSet []htmltask.HTMLTask

	// ModifyHTML indicates whether the processor can modify HTML documents.
	//
	// When ModifyHTML is true, the processor always rewrites the payload
	// with HTML reconstructed from the parse tree. The response thus always
	// contains a well-formed HTML after processing.
	//
	// Some HTMLTasks have an effect only when ModifyHTML is true.
	ModifyHTML bool
}

Config holds parameters to NewHTMLProcessor.

Directories

Path Synopsis
Package htmldoc provides interface to handle HTML documents.
Package htmldoc provides interface to handle HTML documents.
Package htmltask implements some optimization logic for HTML documents.
Package htmltask implements some optimization logic for HTML documents.

Jump to

Keyboard shortcuts

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