pkg

package
v0.4.9 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// NBSP is the non-breaking space rune.
	NBSP rune = '\u00A0'
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Buffer

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

Buffer is a type that represents a Buffer of a document.

func NewBuffer

func NewBuffer() *Buffer

NewBuffer creates a new buffer.

Returns:

  • *Buffer: The new buffer.

func (*Buffer) AcceptLine

func (b *Buffer) AcceptLine(right_delim string)

AcceptLine is a function that accepts the current line of the formatted string. However, it does not accept the line if the line is empty.

Parameters:

  • right_delim: The right delimiter to use for the line.

func (*Buffer) AcceptWord

func (b *Buffer) AcceptWord()

AcceptWord is a function that accepts the current word of the formatted string when the word is not empty.

func (*Buffer) Clean

func (b *Buffer) Clean()

Cleanup implements the object.Cleaner interface method.

func (*Buffer) ForceAcceptLine

func (b *Buffer) ForceAcceptLine(right_delim string)

AcceptLine is a function that accepts the current line of the formatted string. However, it does not accept the line if the line is empty.

Parameters:

  • right_delim: The right delimiter to use for the line.

func (*Buffer) ForceWriteString

func (b *Buffer) ForceWriteString(str string)

ForceWriteString is a function that writes a string to the buffer without checking for special characters. However, it does check for empty strings and will not write them.

Parameters:

  • str: The string to write.

func (*Buffer) GetPages

func (b *Buffer) GetPages(tabSize int, fieldSpacing int) [][][][]string

GetPages returns the pages that are in the buffer.

Parameters:

  • tabSize: The size of the tab.
  • fieldSpacing: The spacing to use for the tab stop.

Returns:

  • [][][][]string: The pages of the StdPrinter.

func (*Buffer) IsFirstOfLine

func (b *Buffer) IsFirstOfLine() bool

IsFirstOfLine is a function that returns true if the current position is the first position of a line.

Returns:

  • bool: True if the current position is the first position of a line.

func (*Buffer) Write

func (b *Buffer) Write(char rune)

Write is a private function that appends a rune to the buffer while dealing with special characters.

Parameters:

  • char: The rune to append.

func (*Buffer) WriteBytes

func (b *Buffer) WriteBytes(data []byte) (int, error)

WriteBytes is a function that writes bytes to the formatted string.

Parameters:

  • b: The bytes to write.

Returns:

  • int: The number of bytes written.
  • error: An error if one occurred.

func (*Buffer) WriteEmptyLine

func (b *Buffer) WriteEmptyLine(right_delim string)

WriteEmptyLine is a function that accepts the current line regardless of the whether the line is empty or not.

Parameters:

  • right_delim: The right delimiter to use for the line.

func (*Buffer) WriteRune

func (b *Buffer) WriteRune(r rune)

WriteRune is a private function that appends a rune to the buffer without checking for special characters.

Parameters:

  • r: The rune to append.

Jump to

Keyboard shortcuts

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