Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Parse ¶
func Parse(ctx context.Context, message string, ranges []*signalpb.BodyRange, params *FormatParams) *event.MessageEventContent
Types ¶
type BodyRange ¶
type BodyRange struct { Start int Length int Value BodyRangeValue }
func (BodyRange) TruncateEnd ¶
TruncateEnd changes the length of the range, so it ends at or before the given index and starts at the same index as before.
func (BodyRange) TruncateStart ¶
TruncateStart changes the length of the range, so it starts at the given index and ends at the same index as before.
type BodyRangeList ¶
type BodyRangeList []BodyRange
func (BodyRangeList) Len ¶
func (b BodyRangeList) Len() int
func (BodyRangeList) Less ¶
func (b BodyRangeList) Less(i, j int) bool
func (BodyRangeList) Swap ¶
func (b BodyRangeList) Swap(i, j int)
type BodyRangeValue ¶
type BodyRangeValue interface { String() string Format(message string) string Proto() signalpb.BodyRangeAssociatedValue }
type FormatParams ¶
type LinkedRangeTree ¶
type LinkedRangeTree struct { Node *BodyRange Sibling *LinkedRangeTree Child *LinkedRangeTree }
LinkedRangeTree is a linked tree of formatting entities.
It's meant to parse a list of Signal body ranges into nodes that either overlap completely or not at all, which enables more natural conversion to HTML.
func (*LinkedRangeTree) Add ¶
func (lrt *LinkedRangeTree) Add(r *BodyRange)
Add adds the given formatting entity to this tree.
func (*LinkedRangeTree) Format ¶
func (lrt *LinkedRangeTree) Format(message UTF16String, ctx formatContext) string
type Style ¶
type Style int
func (Style) Proto ¶
func (s Style) Proto() signalpb.BodyRangeAssociatedValue
type UTF16String ¶
type UTF16String []uint16
func NewUTF16String ¶
func NewUTF16String(s string) UTF16String
func (UTF16String) String ¶
func (u UTF16String) String() string
Click to show internal directories.
Click to hide internal directories.