Document

package
v0.3.17 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// DefaultPageWidth is the default width of a page.
	DefaultPageWidth int = 80

	// DefaultPageHeight is the default height of a page.
	DefaultPageHeight int = 24
)

Variables

This section is empty.

Functions

func PageRenderTransition

func PageRenderTransition(page *Page) *ut.SimpleTray[*RenderedPage]

Types

type Builder

type Builder struct {

	// Traversor is the traversor used by the builder.
	*fsp.Traversor
	// contains filtered or unexported fields
}

Builder is a type that represents a builder for creating formatted strings.

func NewBuilder

func NewBuilder() *Builder

NewBuilder creates a new builder with the default configuration.

Returns:

  • *Builder: A pointer to the new builder.

func (*Builder) AddPage

func (d *Builder) AddPage(page *Page)

func (*Builder) AddPages

func (d *Builder) AddPages(pages []*Page)

func (*Builder) AppendSection

func (d *Builder) AppendSection(section fss.Sectioner)

func (*Builder) AppendSections

func (d *Builder) AppendSections(sections []fss.Sectioner)

func (*Builder) Apply

func (b *Builder) Apply(elem fsp.FStringer) error

Apply is a function that applies the element to the builder.

Parameters:

  • elem: The element to apply.

Returns:

  • error: An error if the application fails.

func (*Builder) Build

func (b *Builder) Build() (*DocumentViewer, error)

Build is a function that builds the document.

Returns:

  • *Document: The document.
  • error: An error if the building fails.

func (*Builder) Reset

func (b *Builder) Reset()

Reset is a function that resets the builder.

type Document

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

func NewDocument

func NewDocument() *Document

func (*Document) AddPage

func (d *Document) AddPage(page *Page)

func (*Document) FString

func (d *Document) FString(trav *ffs.Traversor) error

type DocumentViewer

type DocumentViewer struct {
	*ut.DynamicTray[*Page, *RenderedPage]
}

DocumentViewer is a type that represents a document.

func MakeDocument

func MakeDocument(rawPages [][][][]string) (*DocumentViewer, error)

MakeDocument creates a new document.

Parameters:

  • rawPages: The raw pages to add to the document.

Returns:

  • *Document: A pointer to the newly created document.

type Page

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

Page is a type that represents a page of a document.

func NewPage

func NewPage() *Page

func (*Page) AddSection

func (p *Page) AddSection(section fss.Sectioner) *Page

func (*Page) FString

func (p *Page) FString(trav *ffs.Traversor) error

FString implements the FStringer interface.

func (*Page) View

func (p *Page) View() ([]*RenderedPage, error)

type RenderedPage

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

RenderedPage is a type that represents a page of a document.

func NewRenderedPage

func NewRenderedPage(render *fss.Render, pageNumber, subPageNumber int) *RenderedPage

Jump to

Keyboard shortcuts

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