Documentation ¶
Index ¶
- Variables
- type Block
- type BlockSection
- type BlockSections
- func (sects *BlockSections) EmptyLine(sect int)
- func (sects *BlockSections) Line(sect int, line string)
- func (sects *BlockSections) Linef(sect int, f string, v ...interface{})
- func (sects *BlockSections) Reset()
- func (sects *BlockSections) Section(sect int) *BlockSection
- func (sects *BlockSections) String() string
- type Joints
- type PaperBuffer
- type PaperString
- type Pen
- func (p *Pen) Ascend()
- func (p *Pen) Descend()
- func (p *Pen) EmptyLine()
- func (p *Pen) Line(line string)
- func (p *Pen) LineTmpl(v interface{}, tmpl string)
- func (p *Pen) Linef(f string, v ...interface{})
- func (p *Pen) Lines(lines []string)
- func (p *Pen) Printf(f string, v ...interface{})
- func (p *Pen) Words(words ...interface{})
- func (p *Pen) WriteTmpl(tmpl *template.Template, args interface{})
- type PenWriter
- type Piece
- func (p *Piece) Char(b byte) *Piece
- func (p *Piece) EmptyLine() *Piece
- func (p *Piece) Line(line string) *Piece
- func (p *Piece) Linef(f string, v ...interface{}) *Piece
- func (p *Piece) String() string
- func (p *Piece) Write(v ...interface{}) *Piece
- func (p *Piece) Writef(f string, v ...interface{}) *Piece
Constants ¶
This section is empty.
Variables ¶
var NoopPen = NewPen(noopWriter{})
NoopPen is a pen that does nothing.
Functions ¶
This section is empty.
Types ¶
type Block ¶
type Block struct {
// contains filtered or unexported fields
}
Block writes a scoped Go block.
type BlockSection ¶
type BlockSection struct {
// contains filtered or unexported fields
}
BlockSection is a section writer that writes into a single section from BlockSections.
func (*BlockSection) EmptyLine ¶
func (sect *BlockSection) EmptyLine()
EmptyLine write an empty line into the section.
func (*BlockSection) Line ¶
func (sect *BlockSection) Line(line string)
Line writes a single line into the section.
func (*BlockSection) Linef ¶
func (sect *BlockSection) Linef(f string, v ...interface{})
Linef writes a Sprintf'd line.
type BlockSections ¶
type BlockSections struct {
// contains filtered or unexported fields
}
BlockSections is a section writer for writing multiple sections of a block at once. It can write 10 sections maximum.
func NewBlockSections ¶
func NewBlockSections(preallocs ...int) *BlockSections
NewBlockSections preallocates backing arrays for BlockSections for a maximum of 8.
func (*BlockSections) EmptyLine ¶
func (sects *BlockSections) EmptyLine(sect int)
EmptyLine writes an empty line into the given section.
func (*BlockSections) Line ¶
func (sects *BlockSections) Line(sect int, line string)
Line writes a single line into the given section.
func (*BlockSections) Linef ¶
func (sects *BlockSections) Linef(sect int, f string, v ...interface{})
Linef writes a Sprintf'd line.
func (*BlockSections) Reset ¶
func (sects *BlockSections) Reset()
func (*BlockSections) Section ¶
func (sects *BlockSections) Section(sect int) *BlockSection
Section returns a single section within the block sections.
func (*BlockSections) String ¶
func (sects *BlockSections) String() string
String joins the sections together.
type Joints ¶
type Joints struct {
// contains filtered or unexported fields
}
Joints is a string builder that joins using a separator.
type PaperBuffer ¶
type PaperBuffer struct {
Pen
}
PaperBuffer wraps a Pen and its own buffer.
func NewPaperBuffer ¶
func NewPaperBuffer() *PaperBuffer
NewPaperBuffer creates a new Paper that preallocates 1KB.
func NewPaperBufferSize ¶
func NewPaperBufferSize(size int) *PaperBuffer
NewPaperBufferSize creates a new Paper with the given size to preallocate.
func (*PaperBuffer) Bytes ¶
func (p *PaperBuffer) Bytes() []byte
Bytes returns the internal byte slice.
func (*PaperBuffer) IsEmpty ¶
func (p *PaperBuffer) IsEmpty() bool
IsEmpty returns true if the buffer is empty.
func (*PaperBuffer) Len ¶
func (p *PaperBuffer) Len() int
Len returns the internal length of the buffer.
func (*PaperBuffer) String ¶
func (p *PaperBuffer) String() string
String returns the copied final string written from the Pen.
type PaperString ¶
type PaperString struct {
Pen
}
PaperString wraps a Pen and its own buffer.
func NewPaperString ¶
func NewPaperString() *PaperString
NewPaperString creates a new Paper that preallocates 1KB.
func NewPaperStringSize ¶
func NewPaperStringSize(size int) *PaperString
NewPaperStringSize creates a new Paper with the given size to preallocate.
func (*PaperString) IsEmpty ¶
func (p *PaperString) IsEmpty() bool
IsEmpty returns true if the buffer is empty.
func (*PaperString) Len ¶
func (p *PaperString) Len() int
Len returns the internal length of the buffer.
func (*PaperString) String ¶
func (p *PaperString) String() string
String returns the final string written from the Pen.
type Pen ¶
type Pen struct {
PenWriter
}
Pen wraps a Pen and its own buffer.
type PenWriter ¶
type PenWriter interface { io.Writer io.ByteWriter io.StringWriter }
PenWriter describes an interface that a pen can write to.