View Source Subtitle.WebVTT.Payload (kim_subtitle v0.1.1)

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 falls within min_length and 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

Link to this function

fragment(tag_or_tags, max_length)

View Source

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.

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

merge(tags, min_length, max_length)

View Source

Merges the tags until their text size falls within min_length and max_length. Calls simplify/1 on the final result.

Link to this function

pretty?(text, min_length)

View Source
@spec pretty?(binary(), pos_integer()) :: boolean()

Merges equals tags together. Useful after a fragment call.

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

wrap_words(words, max_length)

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

Splits words when they are longer then the specified length