-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
subrip.sublime-syntax
89 lines (83 loc) · 2.23 KB
/
subrip.sublime-syntax
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
%YAML 1.2
---
version: 2
name: SubRip / SRT
file_extensions:
- srt
scope: text.srt
contexts:
main:
- match: ^(\d+)$
comment: Subtitle ordinal number
scope: variable.function markup.bold
- match: ^(\d{2}:\d{2}:\d{2},\d{3}) (-->) (\d{2}:\d{2}:\d{2},\d{3})$
comment: Subtitle timecode
captures:
1: variable.function markup.italic
2: variable.function
3: variable.function markup.italic
# - match: ^\s.*$
# comment: Error - line starts with a whitespace character
# scope: markup.deleted.srt
# tags brackets only
# - match: "<"
# scope: punctuation.definition.tag.begin
# - match: ">"
# scope: punctuation.definition.tag.end
# simple highlighting tags
# - match: (</?)((?i:b|i|u)\b)
# captures:
# 1: punctuation.definition.tag.begin.html
# 2: entity.name.tag.inline.any.html
# push:
# - match: "((?: ?/)?>)"
# captures:
# 1: punctuation.definition.tag.end.html
# pop: true
# advanced highlighting tags
- match: \<b\>
comment: <b>bold</b>
scope: comment.srt
push:
- match: \<\/b\>
scope: comment.srt
pop: true
- include: main
- match: .
scope: markup.bold.srt
- match: \<i\>
comment: <i>italic</i>
scope: comment.srt
push:
- match: \<\/i\>
scope: comment.srt
pop: true
- include: main
- match: .
scope: markup.italic.srt
- match: \<(u)\>
comment: <u>underline</u>
scope: comment.srt
push:
- match: \<\/u\>
scope: comment.srt
pop: true
- include: main
- match: .
scope: markup.underline.srt
# - match: \{\\an[1-9]{1}\}
# comment: Position tags
# scope: entity.name.function.srt
- match: (\<font color="(#?\w+)"\>)
# TODO: perhaps, capture colors and apply them to tag contents
comment: <font>colored text</font>
captures:
1: comment.srt
2: markup.bold.srt
push:
- match: \<\/font\>
scope: comment.srt
pop: true
- include: main
- match: .
scope: markup.other.srt