rtf

package module
v0.0.0-...-f57508a Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2025 License: MIT Imports: 5 Imported by: 0

README

= go-rtf

Go package that allows to convert rtf files to HTML or plain text.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Convert

func Convert(input string, rules RuleSet, ignore []string) (string, error)

func IgnoreList

func IgnoreList() []string

Types

type Action

type Action struct {
	Word  string
	Para  *int
	Write Write
	Close Write
}

type Actions

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

func AsActions

func AsActions(input string, rules RuleSet, ignore []string) (*Actions, error)

func (*Actions) Action

func (as *Actions) Action() Action

func (*Actions) Append

func (as *Actions) Append(a Action)

func (*Actions) AppendRune

func (as *Actions) AppendRune(r rune)

func (*Actions) AppendString

func (as *Actions) AppendString(s string)

func (Actions) Execute

func (as Actions) Execute(b *bytes.Buffer)

type Color

type Color struct {
}

type ColorTable

type ColorTable []Color

type FontInfo

type FontInfo struct {
	CharSet int
	Name    string
}

type FontTable

type FontTable map[int]FontInfo
type Header struct {
	FontTable
	ColorTable
}

type Rule

type Rule func(header Header, actions *Actions, act Action) error

func As

func As(val string) Rule

func Cover

func Cover(head, tail string) Rule

func Toggle

func Toggle(head, tail string) Rule

type RuleSet

type RuleSet map[string]Rule

func HTMLRules

func HTMLRules() RuleSet

func PlainTextRules

func PlainTextRules() RuleSet

type Write

type Write func(b *bytes.Buffer)

Jump to

Keyboard shortcuts

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