Documentation
¶
Index ¶
- Variables
- func ReadFile(filename string) ([]string, error)
- type Handler
- type HandlerFactory
- type Interpol
- func (ip *Interpol) Add(text string) (*InterpolatedString, error)
- func (ip *Interpol) AddHandler(typ string, creator HandlerFactory) error
- func (ip *Interpol) AddModifier(typ string, modifier ModifierFactory) error
- func (ip *Interpol) AddMultiple(texts ...string) ([]*InterpolatedString, error)
- func (ip *Interpol) Next() bool
- func (ip *Interpol) Reset()
- type InterpolatedString
- type Modifier
- type ModifierFactory
- type Parameters
Constants ¶
This section is empty.
Variables ¶
var Version = []int{0, 2, 0}
Version is library version number
Functions ¶
Types ¶
type Handler ¶
type Handler interface { String() string // Get the next value, returns false if no more values are available Next() bool // Reset the handler and prepare the first value Reset() }
Handler represents a handler for a certain type of interpolation
Note 1: Handler object should call Reset() when created Note 2: String() should be valid right after Reset() Note 3: Unlike Interpol, Next() after Reset() yields the _second_ value not first.
type HandlerFactory ¶
type HandlerFactory func(ctx *Interpol, text string, data *Parameters) (Handler, error)
HandlerFactory creates a new handler for a given text or command
type Interpol ¶
type Interpol struct {
// contains filtered or unexported fields
}
Interpol context for an interpolation
func (*Interpol) Add ¶
func (ip *Interpol) Add(text string) (*InterpolatedString, error)
Add creates a new string to be interpolated
func (*Interpol) AddHandler ¶
func (ip *Interpol) AddHandler(typ string, creator HandlerFactory) error
AddHandler adds a handler for a specific type of interpolator
func (*Interpol) AddModifier ¶
func (ip *Interpol) AddModifier(typ string, modifier ModifierFactory) error
AddModifier registers a new modifier
func (*Interpol) AddMultiple ¶
func (ip *Interpol) AddMultiple(texts ...string) ([]*InterpolatedString, error)
AddMultiple creates multiple strings to be interpolated
type InterpolatedString ¶
type InterpolatedString struct {
// contains filtered or unexported fields
}
InterpolatedString contains an interpolator object
func (*InterpolatedString) String ¶
func (ips *InterpolatedString) String() string
convert InterpolatedString to a string
type ModifierFactory ¶
type ModifierFactory func(ctx *Interpol, data *Parameters) (Modifier, error)
ModifierFactory creates a new modifier
type Parameters ¶ added in v0.2.0
Parameters for an interpolator command in a more accesible form
func (*Parameters) GetInteger ¶ added in v0.2.0
func (id *Parameters) GetInteger(name string, def int) int
GetInteger returns an interpolation parameter as int