Documentation ¶
Overview ¶
Package format contains various formatting tools wrapped around text/template
Index ¶
- Variables
- type Format
- type Storage
- func (s *Storage) Delete(name string) string
- func (s *Storage) GetBool(name string, def bool) bool
- func (s *Storage) GetInt(name string, def int) int
- func (s *Storage) GetString(name, def string) string
- func (s *Storage) SetBool(name string, data bool) bool
- func (s *Storage) SetInt(name string, i int) int
- func (s *Storage) SetString(name, data string) string
Constants ¶
This section is empty.
Variables ¶
var ( // ErrEmptyFormat Is returned when the format is empty ErrEmptyFormat = errors.New("format: cannot compile an empty format") )
var UtilFuncs = template.FuncMap{ "zwsp": util.AddZwsp, "wordEOL": util.WordEol, "escape": util.EscapeString, "stripAll": util.StripAll, "eat": func(...interface{}) string { return "" }, }
UtilFuncs is a standard set of functions added to all Format's template.Template
Functions ¶
This section is empty.
Types ¶
type Format ¶
type Format struct { FormatString string `xml:",chardata"` // The original format string CompiledFormat *template.Template `xml:"-"` // Our internal template // contains filtered or unexported fields }
Format represents a wrapped template.Template
func (*Format) Compile ¶
Compile compiles the given format string into a text.template, evaluating IRC colours if requested, and adding the default functions plus any passed to the template. If the template is invalid or the format has already been compiled, Compile errors. An optional root text/template can be passed, and if so, the compiled format's internal template will be associated with the passed root
func (*Format) ExecuteBytes ¶
ExecuteBytes is like Execute but returns a slice of bytes
type Storage ¶
type Storage struct { sync.RWMutex // Lets not have lists explode // contains filtered or unexported fields }
Storage holds data for cross-execution storage
func (*Storage) Delete ¶
Delete deletes an entry from the Storage, It will not error if the entry does not exist
Directories ¶
Path | Synopsis |
---|---|
Package transformer implements a platform agnostic way of converting between platform specific formatting styles In order to do this, an intermediate format is used internally and by all implementations of Transformer The format is defined as follows Formatters are first indicated with a sentinel, '$', after which a single character for type follows The only defined types are: b Bold i Italics u Underline s Strikethrough r Reset $ Escaped Sentinel c Colour Colour has a special definition, instead of simply $c, the sentinel and type is followed by six hex characters that together indicate a colour.
|
Package transformer implements a platform agnostic way of converting between platform specific formatting styles In order to do this, an intermediate format is used internally and by all implementations of Transformer The format is defined as follows Formatters are first indicated with a sentinel, '$', after which a single character for type follows The only defined types are: b Bold i Italics u Underline s Strikethrough r Reset $ Escaped Sentinel c Colour Colour has a special definition, instead of simply $c, the sentinel and type is followed by six hex characters that together indicate a colour. |
minecraft
Package minecraft contains a Transformer implementation for the JSON specification of minecraft format strings see https://minecraft.gamepedia.com/Raw_JSON_text_format for a full look at the format itself
|
Package minecraft contains a Transformer implementation for the JSON specification of minecraft format strings see https://minecraft.gamepedia.com/Raw_JSON_text_format for a full look at the format itself |
simple
Package simple implements a Transformer that supports basic replacement based transformations
|
Package simple implements a Transformer that supports basic replacement based transformations |
tokeniser
Package tokeniser implements a tokeniser for the format/transformer intermediate language
|
Package tokeniser implements a tokeniser for the format/transformer intermediate language |