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

Subtitles

The cue text of a SubRip file, with the indexes and timings left alone.

view textfsmmedia Vale ≥ 3.21.0 Source

Getting started

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

[*.srt]
BasedOnStyles = Vale

View = Subtitles

Subtitles.yml

Pull named scopes out of a file Vale can’t otherwise parse.
# SubRip subtitles: a cue is an index, a timing line, and one or more lines
# of text, separated by blank lines. Only the text is exposed.
#
#   [*.srt]
#   BasedOnStyles = Vale
#   View = Subtitles
engine: textfsm
template: |
  Value Index (\d+)
  Value Timing (\d\d:\d\d:\d\d,\d\d\d --> \d\d:\d\d:\d\d,\d\d\d.*)
  Value List Cue (.+)

  Start
    ^${Index}$ -> Timing

  Timing
    ^${Timing}$ -> Cue

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