rich

package
v0.0.0-...-917641f Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2019 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package rich implements rich text data types

Package rich implements rich text data types

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Attr

type Attr interface {
	changes.Value
	Name() string
}

Attr is a single attribute value

type Attrs

type Attrs map[string]Attr

Attrs is a collection of attribute name value pairs

func (Attrs) Apply

func (a Attrs) Apply(ctx changes.Context, c changes.Change) changes.Value

Apply implements changes.Value

func (Attrs) Equal

func (a Attrs) Equal(x interface{}) bool

Equal does a deep comparison of all attributes

type Text

type Text []attrText

Text represents a rich text

func NewEmbed

func NewEmbed(embedded Attr) *Text

NewEmbed creates a text with an embedded object (such as data.link)

func NewText

func NewText(s string, attr ...Attr) *Text

NewText initializes a new rich text value

func (*Text) Apply

func (t *Text) Apply(ctx changes.Context, c changes.Change) changes.Value

Apply implements changes.Value

func (*Text) ApplyCollection

func (t *Text) ApplyCollection(ctx changes.Context, c changes.Change) changes.Collection

ApplyCollection implements changes.Collection

func (*Text) Concat

func (t *Text) Concat(o *Text) *Text

Concat joins two rich text values

func (*Text) Count

func (t *Text) Count() int

Count returns the size of the text

func (*Text) PlainText

func (t *Text) PlainText() string

PlainText returns the plain text version of the rich text.

func (*Text) RemoveAttribute

func (t *Text) RemoveAttribute(offset, count int, name string) changes.Change

RemoveAttribute returns a change which when applied would remove the named attributes in the range [offset, offset+count]

func (*Text) SetAttribute

func (t *Text) SetAttribute(offset, count int, attr Attr) changes.Change

SetAttribute returns a change which when applied would set all the attributes in the range [offset, offset+count] to the provided value.

func (*Text) Slice

func (t *Text) Slice(offset, count int) changes.Collection

Slice returns a text within the specified range

Directories

Path Synopsis
Package data impleements data structures for use with rich text
Package data impleements data structures for use with rich text
Package eval implements evaluated objects Package eval implements evaluated objects Package eval implements expression values that can be evaluated Expression syntax The language used by eval is a very simple infix expression.
Package eval implements evaluated objects Package eval implements evaluated objects Package eval implements expression values that can be evaluated Expression syntax The language used by eval is a very simple infix expression.
Package html implements rich text to HTML conversion
Package html implements rich text to HTML conversion

Jump to

Keyboard shortcuts

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