Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrReplacerSkipChildren could be returned from the ReplaceNodes replacer func // to skip children. Will never be returned by ReplaceNodes itself. ErrReplacerSkipChildren = errors.New("skip children") // ErrReplacerStuck means that replacer failed to make progress ErrReplacerStuck = errors.New("replacer stuck") )
Functions ¶
func ReplaceNodes ¶
func ReplaceNodes(n ast.Node, replacer func(n ast.Node) (repl ast.Node, err error)) (ast.Node, error)
ReplaceNodes walks the AST starting from the given node and replaces nodes in it. If replacer returns nil - the node is deleted
func ReplaceNodesInContent ¶
func ReplaceNodesInContent(el plugin.Content, replacer func(src *astsrc.ASTSource, n ast.Node) (repl ast.Node, err error)) error
ReplaceNodesInContent runs ReplaceNodes on plugin.ContentAST nodes Replacer is not expected to replace the top-level plugin node (ContentNode)
Types ¶
type Printer ¶
Printer is the interface for printing content.
func WithLogging ¶
WithLogging wraps the printer with logging instrumentation.
Click to show internal directories.
Click to hide internal directories.