text

package
v0.0.0-...-dc6f9f8 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const Abyss = "█" // "ᨆ", "ᨖ"
View Source
const AlreadyShown = "ᨔ"
View Source
const BreadthExhausted = "ᨓ"
View Source
const DepthExhausted = "ᨑ"

Variables

View Source
var (
	DefaultPrinter     = PrintContext{Indent: "\t", Width: 100, Console: ANSI}
	DefaultMonoPrinter = PrintContext{Indent: "\t", Width: 100, Console: Mono}
)

Functions

This section is empty.

Types

type PrintContext

type PrintContext struct {
	Prefix  string
	Indent  string
	Width   int     // screen width
	Console Console // color highlighting
}

type TextGlue

type TextGlue struct {
	Text []Textual `ko:"name=text,monadic"`
}

TextGlue is a list of textual objects which cannot be broken up at their boundary.

func (TextGlue) Play

func (g TextGlue) Play(*runtime.Context) TextGlue

func (TextGlue) Render

func (g TextGlue) Render(ctx PrintContext, w io.Writer, linePrefix string, width int)

func (TextGlue) Width

func (g TextGlue) Width() int

type TextRenderer

type TextRenderer interface {
	RenderText() Textual
}

type TextRubber

type TextRubber struct {
	Header *string   `ko:"name=header"`
	Open   *string   `ko:"name=open"`  // e.g. "{"
	Close  *string   `ko:"name=close"` // e.g. "}"
	Field  []Textual `ko:"name=text,monadic"`
}

TextRubber is a sequence of textual objects which can render horizontally or vertically, depending on available width.

func (TextRubber) Play

func (TextRubber) Render

func (g TextRubber) Render(ctx PrintContext, w io.Writer, linePrefix string, width int)

func (TextRubber) Width

func (g TextRubber) Width() int

type TextSlab

type TextSlab struct {
	String string `ko:"name=string,monadic"`
}

TextSlab is a verbatim/indivisible string.

func (TextSlab) Play

func (t TextSlab) Play(*runtime.Context) TextSlab

func (TextSlab) Render

func (t TextSlab) Render(_ PrintContext, w io.Writer, _ string, _ int)

func (TextSlab) Width

func (t TextSlab) Width() int

type TextTile

type TextTile struct {
	String string `ko:"name=string,monadic"`
}

TextTile is a verbatim string printed with a highlight.

func (TextTile) Play

func (t TextTile) Play(*runtime.Context) TextTile

func (TextTile) Render

func (t TextTile) Render(ctx PrintContext, w io.Writer, _ string, _ int)

func (TextTile) Width

func (t TextTile) Width() int

type Textual

type Textual interface {
	Render(ctx PrintContext, w io.Writer, linePrefix string, width int)
	Width() int
}

type TextualCtx

type TextualCtx interface {
	Rewrite(Textual) Textual
}

Jump to

Keyboard shortcuts

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