tabbycat

package module
v0.0.0-...-cd35816 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2016 License: MIT Imports: 4 Imported by: 0

README

tabbycat

Package tabbycat is a wrapper around text/tabwriter which ignores the width of any text matching a given regular expression. This can be used to properly tabbify text containing non-printing ANSI terminal control codes, for example. Note that text/tabwriter's ability to filter HTML tags is always enabled since this mechanism is exploited to achieve this package's purpose.

Documentation

Overview

Package tabbycat is a wrapper around text/tabwriter which ignores the width of any text matching a given regular expression. This can be used to properly tabbify text containing non-printing ANSI terminal control codes, for example. Note that text/tabwriter's ability to filter HTML tags is always enabled since this mechanism is exploited to achieve this package's purpose.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Writer

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

Writer wraps text/tabwriter, ignoring the width of specified text when tabbifying.

func NewWriter

func NewWriter(ignore string, output io.Writer, minWidth, tabWidth, padding int, padChar byte, flags uint) *Writer

NewWriter allocates and initializes a new tabbycat.Writer. The parameters are the same as for the Init function.

func (*Writer) Flush

func (w *Writer) Flush() error

Flush flushes the underlying tabwriter, extracts ignored text from the HTML comment tags, and writes the result.

func (*Writer) Init

func (w *Writer) Init(ignore string, output io.Writer, minWidth, tabWidth, padding int, padChar byte, flags uint) *Writer

Init initializes a Writer. The ignore parameters is a regular expression that specifies which text to ignore when tabbifying. The other parameters are identical to those of text/tabwriter, with the exception of the FilterHTML flag being always enabled.

func (*Writer) Write

func (w *Writer) Write(buf []byte) (int, error)

Write wraps text to be ignored in HTML comment tags to prevent its width from being considered, then writes it to the underlying tabwriter.

Jump to

Keyboard shortcuts

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