Subtitle.WebVTT.Payload (kim_subtitle v0.1.6)

View Source

Summary

Functions

Each tag will be fragmented into a list of single word tags of the same type. If words are longer than max_length, they are wrapped.

Merges the tags until their text size reaches max_length. Calls simplify/1 on the final result.

Merges equals tags together. Useful after a fragment call.

Splits words when they are longer then the specified length

Functions

fragment(tag_or_tags, max_length)

Each tag will be fragmented into a list of single word tags of the same type. If words are longer than max_length, they are wrapped.

marshal!(tags)

@spec marshal!([Subtitle.WebVTT.Payload.Tag.t()]) :: binary()

merge(tags, max_length)

Merges the tags until their text size reaches max_length. Calls simplify/1 on the final result.

simplify(tags)

Merges equals tags together. Useful after a fragment call.

size(tags)

string(tags)

unmarshal(text)

@spec unmarshal(binary()) ::
  {:ok, [Subtitle.WebVTT.Payload.Tag.t()]} | {:error, binary()}

unmarshal!(text)

@spec unmarshal!(binary()) :: [Subtitle.WebVTT.Payload.Tag.t()]

wrap_words(words, max_length)

@spec wrap_words([binary()], pos_integer()) :: [binary()]

Splits words when they are longer then the specified length