formatting

package
v0.0.1-111123-b98951d Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const ParseMode = tgbotapi.ModeMarkdownV2

Variables

View Source
var ErrInvalidTimeFormat = errors.New("invalid time format")

Functions

func Bold added in v0.0.2

func Bold(s string) string

func Escape added in v0.0.2

func Escape(s string) string

Escape makes arbitrary text valid when parsed with ParseMode.

func Escapef added in v0.0.2

func Escapef(format string, a ...any) string

Escapef is a formatted version of Escape, but it does not escape a. This means that these values must be valid when parsed via ParseMode.

func FormatCommandHelp added in v0.0.2

func FormatCommandHelp(cmd commands.Desc) string

func FormatCommandShortHelp added in v0.0.2

func FormatCommandShortHelp(cmd commands.Desc) string

func FormatHelp added in v0.0.2

func FormatHelp(cmds []commands.Desc) string

func FormatMessageCreated added in v0.0.2

func FormatMessageCreated(id string) string

func FormatMessages

func FormatMessages(header string, msgs []*standup.Message) string

FormatMessages formats a list of messages for the report. If present, header must be valid when parsed with ParseMode (see Escape).

func Mono added in v0.0.2

func Mono(s string) string

func MustRenderTemplate added in v0.0.2

func MustRenderTemplate(tmpl string, data any) string

MustRenderTemplate acts like RenderTemplate, but panics on errors.

func ParseTime

func ParseTime(s string, now time.Time) (time.Time, error)

func RenderTemplate added in v0.0.2

func RenderTemplate(tmpl string, data any) (string, error)

RenderTemplate renders text/template.Template tmpl. All plaint text nodes of the template are escaped via Escape. The following functions are also availible in template context:

- "bold" -> Bold

- "mono" -> Mono

- "esc" -> Escape

Types

This section is empty.

Jump to

Keyboard shortcuts

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