Documentation ¶
Overview ¶
Package print provides low level routines for styling output.
Index ¶
- func AndSeparator(w writer.Output) writer.OutputCloser
- func Capitalize(out writer.Output) writer.ChunkOutput
- func Lowercase(out writer.Output) writer.ChunkOutput
- func NewLineSentences(w io.Writer) writer.ChunkOutput
- func OrSeparator(w writer.Output) writer.OutputCloser
- func Slash(out writer.Output) writer.ChunkOutput
- func Tag(out writer.Output, tag string) writer.OutputCloser
- func TitleCase(out writer.Output) writer.ChunkOutput
- type BracketSpanner
- type Filter
- type Lines
- type Sep
- type Spanner
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AndSeparator ¶
func AndSeparator(w writer.Output) writer.OutputCloser
AndSeparator creates a phrase: a, b, c, and d. Note: spacing between words is left to print.Spacing.
func Capitalize ¶
func Capitalize(out writer.Output) writer.ChunkOutput
Capitalize filters writer.Output, capitalizing the first string.
func Lowercase ¶
func Lowercase(out writer.Output) writer.ChunkOutput
Lowercase filters writer.Output, lowering every string.
func NewLineSentences ¶
func NewLineSentences(w io.Writer) writer.ChunkOutput
A special writer that looks for trailing full stops, and other terminals and writes a line after them. https://www.unicode.org/review/pr-23.html
func OrSeparator ¶
func OrSeparator(w writer.Output) writer.OutputCloser
OrSeparator creates a phrase: a, b, c, or d. Note: spacing between words is left to print.Spacing.
func Slash ¶
func Slash(out writer.Output) writer.ChunkOutput
Slash filters writer.Output, separating writes with a slash.
Types ¶
type BracketSpanner ¶
type BracketSpanner struct { Spanner // inside the brackets: write with spaces // contains filtered or unexported fields }
func Brackets ¶
func Brackets(open, close string) BracketSpanner
func Parens ¶
func Parens() BracketSpanner
Parens buffers writer.Output, grouping a stream of writes. Close adds the closing paren.
func (*BracketSpanner) ChunkOutput ¶
func (p *BracketSpanner) ChunkOutput() writer.ChunkOutput
func (*BracketSpanner) WriteChunk ¶
func (p *BracketSpanner) WriteChunk(c writer.Chunk) (ret int, err error)
type Filter ¶
type Filter struct {
First, Rest func(writer.Chunk) (int, error)
Last func(int) error
// contains filtered or unexported fields
}
Filter - sends incoming chunks to one of three functions: first, rest, or last. a user of filter can alter those chunks before sending them onward somewhere else. this doesnt define that destination.
type Lines ¶
type Lines struct { writer.ChunkOutput // contains filtered or unexported fields }
Lines implements io.Writer, buffering every Write as a new line. use MakeChunks to construct a valid line writer.
type Sep ¶
type Sep struct {
// contains filtered or unexported fields
}
Sep implements writer.Output, treating every Write as a new word.
func (*Sep) ChunkOutput ¶
func (l *Sep) ChunkOutput() writer.ChunkOutput
type Spanner ¶
type Spanner struct {
// contains filtered or unexported fields
}
Spanner implements ChunkWriter, buffering output with spaces. It treats each new Write as a word adding spaces to separate words as necessary.
func NewSeparator ¶ added in v0.24.6
func NewSpanner ¶
func NewSpanner() *Spanner
func (*Spanner) ChunkOutput ¶
func (p *Spanner) ChunkOutput() writer.ChunkOutput
ChunkOutput - returns an object capable of writing to the spanner.