Vale CMS Need more than a rule playground? Explore
Asset Explorer

WebVTT

The cue text of a WebVTT file, with the header, identifiers, timings, and notes left alone.

view textfsmmedia Vale ≥ 3.21.0 Source

Getting started

Save the file as config/views/WebVTT.yml under your StylesPath, then:

[*.vtt]
BasedOnStyles = Vale

View = WebVTT

WebVTT.yml

Pull named scopes out of a file Vale can’t otherwise parse.
# WebVTT captions: a header, then cues separated by blank lines, each an
# optional identifier, a timing line, and the text. Only the text is
# exposed; NOTE, STYLE, and REGION blocks are skipped.
#
#   [*.vtt]
#   BasedOnStyles = Vale
#   View = WebVTT
engine: textfsm
template: |
  Value Timing ((?:\d+:)?\d\d:\d\d\.\d\d\d --> .*)
  Value List Cue (.+)

  Start
    ^WEBVTT -> Header

  Header
    ^$ -> Block

  Block
    ^$ -> Next
    ^(?:NOTE|STYLE|REGION)(?:\s|$) -> Skip
    ^${Timing}$ -> Cue
    ^.+ -> Next

  Skip
    ^$ -> Block

  Cue
    ^$ -> Record Block
    ^${Cue}
scopes:
  - name: cue
    expr: Cue