Debian Codegraph @

data/syntax/subrip-subtitles.xml

raw
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE language
3 [
4 <!ENTITY time "\d\d+(?:\:[0-5]\d){2}[\,\.]\d{3}">
5 <!ENTITY coordinates "(?:\s+[XY][12]\:\d+){0,4}\s*$">
6 <!ENTITY formatTags "(?:&lt;/?[bius]&gt;|\{/?[bius]\})">
7 <!ENTITY htmlName "[A-Za-z_\:][\w\.\:\-]*">
8 <!ENTITY htmlAttributeName "[A-Za-z_:\*#\(\[][\)\]\w\.\:_\-]+">
9 ]>
10
11 <!--
12 SubRip Text (.SRT) Subtitles Syntax Highlighting Definition
13 ===========================================================================
14
15 This file is part of the KDE's KSyntaxHighlighting framework.
16
17 SPDX-FileCopyrightText: 2019-2020 Nibaldo González S. <[email protected]>
18
19 SPDX-License-Identifier: MIT
20
21 ===========================================================================
22
23 Mor information: http://ale5000.altervista.org/subtitles.htm
24
25 Last update: September 30, 2020 (v2)
26 -->
27
28 <language name="SubRip Subtitles"
29 version="3"
30 kateversion="5.53"
31 section="Other"
32 extensions="*.srt"
33 mimetype="application/x-subrip"
34 priority="9"
35 author="Nibaldo González ([email protected])"
36 license="MIT">
37
38 <highlighting>
39
40 <contexts>
41
42 <context name="Normal" attribute="Normal Text" lineEndContext="#stay">
43 <RegExpr context="FindTime" attribute="Sequence Number" String="\d+(?=\s*$)" firstNonSpace="true" />
44 <RegExpr context="Time" String="(&time;\s+)(\-\-&gt;)(\s+&time;)(&coordinates;)" firstNonSpace="true" lookAhead="true" />
45 <Int context="TimeError" attribute="Error" firstNonSpace="true" />
46 </context>
47 <context name="FindTime" attribute="Normal Text" lineEndContext="#stay" lineEmptyContext="#pop">
48 <RegExpr context="#pop!Time" String="(&time;\s+)(\-\-&gt;)(\s+&time;)(&coordinates;)" firstNonSpace="true" lookAhead="true" />
49 <Int context="#pop!TimeError" attribute="Error" firstNonSpace="true" />
50 </context>
51 <context name="Time" attribute="Normal Text" lineEndContext="#pop!SubtitleContent">
52 <StringDetect context="#stay" attribute="Appearance Time" String="%1" dynamic="true" />
53 <StringDetect context="#stay" attribute="Time Arrow" String="%2" dynamic="true" />
54 <StringDetect context="#stay" attribute="Disappearance Time" String="%3" dynamic="true" />
55 <StringDetect context="#pop!SubtitleContent" attribute="Coordinates" String="%4" dynamic="true" />
56 </context>
57
58 <!-- Mark all subtitle text as error -->
59 <context name="TimeError" attribute="Error" lineEndContext="Error" lineEmptyContext="#pop" />
60 <context name="Error" attribute="Error (Subtitle)" lineEndContext="#stay" lineEmptyContext="#pop#pop" />
61
62 <context name="SubtitleContent" attribute="Subtitle" lineEndContext="#stay" lineEmptyContext="#pop">
63 <StringDetect context="BoldThan" attribute="Format Tag: Bold" String="&lt;b&gt;" />
64 <StringDetect context="ItalicThan" attribute="Format Tag: Italic" String="&lt;i&gt;" />
65 <StringDetect context="UnderlineThan" attribute="Format Tag: Underline" String="&lt;u&gt;" />
66 <StringDetect context="StrikeoutThan" attribute="Format Tag: Strikethrough" String="&lt;s&gt;" />
67 <StringDetect context="BoldCBracket" attribute="Format Tag: Bold" String="{b}" />
68 <StringDetect context="ItalicCBracket" attribute="Format Tag: Italic" String="{i}" />
69 <StringDetect context="UnderlineCBracket" attribute="Format Tag: Underline" String="{u}" />
70 <StringDetect context="StrikeoutCBracket" attribute="Format Tag: Strikethrough" String="{s}" />
71 <RegExpr context="#stay" attribute="Format Tag" String="&formatTags;" />
72 <IncludeRules context="SubtitleCommon" />
73 </context>
74
75 <context name="SubtitleCommon" attribute="Subtitle" lineEndContext="#stay">
76 <!-- {\anX} -->
77 <RegExpr context="#stay" attribute="Line Alignment Tag" String="\{\\an\d\}" />
78 <!-- {\some_letters_or_numbers_or_chars}, {Y:some_letters_or_numbers_or_chars} -->
79 <RegExpr context="#stay" attribute="Tag" String="\{(?:\\|Y\:)[^\{\}\s][^\{\}]*\}" />
80 <RegExpr context="#stay" attribute="Escape" String="\\[hN&lt;&gt;\{\}]" />
81 <!-- HTML Tag -->
82 <RegExpr context="FindHTML" String="&lt;&htmlName;(?:\s+&htmlAttributeName;(?:\s*\=\s*(?:&quot;(?:[^&quot;\\]|\\.)*&quot;|&apos;(?:[^&apos;\\]|\\.)*&apos;|[^&gt;&lt;&quot;&apos;\s]+))?)*\s*/?&gt;|&lt;/&htmlName;\s*&gt;" lookAhead="true" />
83 </context>
84 <context name="FindHTML" attribute="Normal Text" lineEndContext="#pop" fallthrough="true" fallthroughContext="#pop">
85 <IncludeRules context="FindHTMLTags##HTML" />
86 </context>
87
88 <!-- Format Tag: <b>, <i>, <u>, <s> -->
89 <context name="BoldThan" attribute="Bold" lineEndContext="#stay" lineEmptyContext="#pop#pop">
90 <StringDetect context="#pop" attribute="Format Tag: Bold" String="&lt;/b&gt;" />
91 <StringDetect context="BoldThan-ItalicThan" attribute="Format Tag: Bold-Italic" String="&lt;i&gt;" />
92 <StringDetect context="BoldThan-UnderlineThan" attribute="Format Tag: Bold-Underline" String="&lt;u&gt;" />
93 <RegExpr context="#stay" attribute="Format Tag: Bold" String="&formatTags;" />
94 <IncludeRules context="SubtitleCommon" />
95 </context>
96 <context name="ItalicThan" attribute="Italic" lineEndContext="#stay" lineEmptyContext="#pop#pop">
97 <StringDetect context="#pop" attribute="Format Tag: Italic" String="&lt;/i&gt;" />
98 <StringDetect context="ItalicThan-BoldThan" attribute="Format Tag: Bold-Italic" String="&lt;b&gt;" />
99 <StringDetect context="ItalicThan-UnderlineThan" attribute="Format Tag: Italic-Underline" String="&lt;u&gt;" />
100 <RegExpr context="#stay" attribute="Format Tag: Italic" String="&formatTags;" />
101 <IncludeRules context="SubtitleCommon" />
102 </context>
103 <context name="UnderlineThan" attribute="Underline" lineEndContext="#stay" lineEmptyContext="#pop#pop">
104 <StringDetect context="#pop" attribute="Format Tag: Underline" String="&lt;/u&gt;" />
105 <StringDetect context="UnderlineThan-BoldThan" attribute="Format Tag: Bold-Underline" String="&lt;b&gt;" />
106 <StringDetect context="UnderlineThan-ItalicThan" attribute="Format Tag: Italic-Underline" String="&lt;i&gt;" />
107 <RegExpr context="#stay" attribute="Format Tag: Underline" String="&formatTags;" />
108 <IncludeRules context="SubtitleCommon" />
109 </context>
110 <context name="StrikeoutThan" attribute="Strikethrough" lineEndContext="#stay" lineEmptyContext="#pop#pop">
111 <StringDetect context="#pop" attribute="Format Tag: Strikethrough" String="&lt;/s&gt;" />
112 <RegExpr context="#stay" attribute="Format Tag: Strikethrough" String="&formatTags;" />
113 <IncludeRules context="SubtitleCommon" />
114 </context>
115
116 <!-- Format Tag: {b}, {i}, {u}, {s} -->
117 <context name="BoldCBracket" attribute="Bold" lineEndContext="#stay" lineEmptyContext="#pop#pop">
118 <StringDetect context="#pop" attribute="Format Tag: Bold" String="{/b}" />
119 <StringDetect context="BoldCBracket-ItalicCBracket" attribute="Format Tag: Bold-Italic" String="{i}" />
120 <StringDetect context="BoldCBracket-UnderlineCBracket" attribute="Format Tag: Bold-Underline" String="{u}" />
121 <RegExpr context="#stay" attribute="Format Tag: Bold" String="&formatTags;" />
122 <IncludeRules context="SubtitleCommon" />
123 </context>
124 <context name="ItalicCBracket" attribute="Italic" lineEndContext="#stay" lineEmptyContext="#pop#pop">
125 <StringDetect context="#pop" attribute="Format Tag: Italic" String="{/i}" />
126 <StringDetect context="ItalicCBracket-BoldCBracket" attribute="Format Tag: Bold-Italic" String="{b}" />
127 <StringDetect context="ItalicCBracket-UnderlineCBracket" attribute="Format Tag: Italic-Underline" String="{u}" />
128 <RegExpr context="#stay" attribute="Format Tag: Italic" String="&formatTags;" />
129 <IncludeRules context="SubtitleCommon" />
130 </context>
131 <context name="UnderlineCBracket" attribute="Underline" lineEndContext="#stay" lineEmptyContext="#pop#pop">
132 <StringDetect context="#pop" attribute="Format Tag: Underline" String="{/u}" />
133 <StringDetect context="UnderlineCBracket-BoldCBracket" attribute="Format Tag: Bold-Underline" String="{b}" />
134 <StringDetect context="UnderlineCBracket-ItalicCBracket" attribute="Format Tag: Italic-Underline" String="{i}" />
135 <RegExpr context="#stay" attribute="Format Tag: Underline" String="&formatTags;" />
136 <IncludeRules context="SubtitleCommon" />
137 </context>
138 <context name="StrikeoutCBracket" attribute="Strikethrough" lineEndContext="#stay" lineEmptyContext="#pop#pop">
139 <StringDetect context="#pop" attribute="Format Tag: Strikethrough" String="{/s}" />
140 <RegExpr context="#stay" attribute="Format Tag: Strikethrough" String="&formatTags;" />
141 <IncludeRules context="SubtitleCommon" />
142 </context>
143
144 <!-- Bold-Italic -->
145
146 <!-- <b> <i> text </i> </b> -->
147 <context name="BoldThan-ItalicThan" attribute="Bold-Italic" lineEndContext="#stay" lineEmptyContext="#pop#pop#pop">
148 <StringDetect context="#pop" attribute="Format Tag: Bold-Italic" String="&lt;/i&gt;" />
149 <StringDetect context="#pop#pop!ItalicThan" attribute="Format Tag: Bold-Italic" String="&lt;/b&gt;" />
150 <RegExpr context="#stay" attribute="Format Tag: Bold-Italic" String="&formatTags;" />
151 <IncludeRules context="SubtitleCommon" />
152 </context>
153 <!-- <i> <b> text </b> </i> -->
154 <context name="ItalicThan-BoldThan" attribute="Bold-Italic" lineEndContext="#stay" lineEmptyContext="#pop#pop#pop">
155 <StringDetect context="#pop" attribute="Format Tag: Bold-Italic" String="&lt;/b&gt;" />
156 <StringDetect context="#pop#pop!BoldThan" attribute="Format Tag: Bold-Italic" String="&lt;/i&gt;" />
157 <RegExpr context="#stay" attribute="Format Tag: Bold-Italic" String="&formatTags;" />
158 <IncludeRules context="SubtitleCommon" />
159 </context>
160 <!-- {b} {i} text {/i} {/b} -->
161 <context name="BoldCBracket-ItalicCBracket" attribute="Bold-Italic" lineEndContext="#stay" lineEmptyContext="#pop#pop#pop">
162 <StringDetect context="#pop" attribute="Format Tag: Bold-Italic" String="{/i}" />
163 <StringDetect context="#pop#pop!ItalicCBracket" attribute="Format Tag: Bold-Italic" String="{/b}" />
164 <RegExpr context="#stay" attribute="Format Tag: Bold-Italic" String="&formatTags;" />
165 <IncludeRules context="SubtitleCommon" />
166 </context>
167 <!-- {i} {b} text {/b} {/i} -->
168 <context name="ItalicCBracket-BoldCBracket" attribute="Bold-Italic" lineEndContext="#stay" lineEmptyContext="#pop#pop#pop">
169 <StringDetect context="#pop" attribute="Format Tag: Bold-Italic" String="{/b}" />
170 <StringDetect context="#pop#pop!BoldCBracket" attribute="Format Tag: Bold-Italic" String="{/i}" />
171 <RegExpr context="#stay" attribute="Format Tag: Bold-Italic" String="&formatTags;" />
172 <IncludeRules context="SubtitleCommon" />
173 </context>
174
175 <!-- Bold-Underline -->
176
177 <!-- <b> <u> text </u> </b> -->
178 <context name="BoldThan-UnderlineThan" attribute="Bold-Underline" lineEndContext="#stay" lineEmptyContext="#pop#pop#pop">
179 <StringDetect context="#pop" attribute="Format Tag: Bold-Underline" String="&lt;/u&gt;" />
180 <StringDetect context="#pop#pop!UnderlineThan" attribute="Format Tag: Bold-Underline" String="&lt;/b&gt;" />
181 <RegExpr context="#stay" attribute="Format Tag: Bold-Underline" String="&formatTags;" />
182 <IncludeRules context="SubtitleCommon" />
183 </context>
184 <!-- <u> <b> text </b> </u> -->
185 <context name="UnderlineThan-BoldThan" attribute="Bold-Underline" lineEndContext="#stay" lineEmptyContext="#pop#pop#pop">
186 <StringDetect context="#pop" attribute="Format Tag: Bold-Underline" String="&lt;/b&gt;" />
187 <StringDetect context="#pop#pop!BoldThan" attribute="Format Tag: Bold-Underline" String="&lt;/u&gt;" />
188 <RegExpr context="#stay" attribute="Format Tag: Bold-Underline" String="&formatTags;" />
189 <IncludeRules context="SubtitleCommon" />
190 </context>
191 <!-- {b} {u} text {/u} {/b} -->
192 <context name="BoldCBracket-UnderlineCBracket" attribute="Bold-Underline" lineEndContext="#stay" lineEmptyContext="#pop#pop#pop">
193 <StringDetect context="#pop" attribute="Format Tag: Bold-Underline" String="{/u}" />
194 <StringDetect context="#pop#pop!UnderlineCBracket" attribute="Format Tag: Bold-Underline" String="{/b}" />
195 <RegExpr context="#stay" attribute="Format Tag: Bold-Underline" String="&formatTags;" />
196 <IncludeRules context="SubtitleCommon" />
197 </context>
198 <!-- {u} {b} text {/b} {/u} -->
199 <context name="UnderlineCBracket-BoldCBracket" attribute="Bold-Underline" lineEndContext="#stay" lineEmptyContext="#pop#pop#pop">
200 <StringDetect context="#pop" attribute="Format Tag: Bold-Underline" String="{/b}" />
201 <StringDetect context="#pop#pop!BoldCBracket" attribute="Format Tag: Bold-Underline" String="{/u}" />
202 <RegExpr context="#stay" attribute="Format Tag: Bold-Underline" String="&formatTags;" />
203 <IncludeRules context="SubtitleCommon" />
204 </context>
205
206 <!-- Italic-Underline -->
207
208 <!-- <i> <u> text </u> </i> -->
209 <context name="ItalicThan-UnderlineThan" attribute="Italic-Underline" lineEndContext="#stay" lineEmptyContext="#pop#pop#pop">
210 <StringDetect context="#pop" attribute="Format Tag: Italic-Underline" String="&lt;/u&gt;" />
211 <StringDetect context="#pop#pop!UnderlineThan" attribute="Format Tag: Italic-Underline" String="&lt;/i&gt;" />
212 <RegExpr context="#stay" attribute="Format Tag: Italic-Underline" String="&formatTags;" />
213 <IncludeRules context="SubtitleCommon" />
214 </context>
215 <!-- <u> <i> text </i> </u> -->
216 <context name="UnderlineThan-ItalicThan" attribute="Italic-Underline" lineEndContext="#stay" lineEmptyContext="#pop#pop#pop">
217 <StringDetect context="#pop" attribute="Format Tag: Italic-Underline" String="&lt;/i&gt;" />
218 <StringDetect context="#pop#pop!ItalicThan" attribute="Format Tag: Italic-Underline" String="&lt;/u&gt;" />
219 <RegExpr context="#stay" attribute="Format Tag: Italic-Underline" String="&formatTags;" />
220 <IncludeRules context="SubtitleCommon" />
221 </context>
222 <!-- {i} {u} text {/u} {/i} -->
223 <context name="ItalicCBracket-UnderlineCBracket" attribute="Italic-Underline" lineEndContext="#stay" lineEmptyContext="#pop#pop#pop">
224 <StringDetect context="#pop" attribute="Format Tag: Italic-Underline" String="{/u}" />
225 <StringDetect context="#pop#pop!UnderlineCBracket" attribute="Format Tag: Italic-Underline" String="{/i}" />
226 <RegExpr context="#stay" attribute="Format Tag: Italic-Underline" String="&formatTags;" />
227 <IncludeRules context="SubtitleCommon" />
228 </context>
229 <!-- {u} {i} text {/i} {/u} -->
230 <context name="UnderlineCBracket-ItalicCBracket" attribute="Italic-Underline" lineEndContext="#stay" lineEmptyContext="#pop#pop#pop">
231 <StringDetect context="#pop" attribute="Format Tag: Italic-Underline" String="{/i}" />
232 <StringDetect context="#pop#pop!ItalicCBracket" attribute="Format Tag: Italic-Underline" String="{/u}" />
233 <RegExpr context="#stay" attribute="Format Tag: Italic-Underline" String="&formatTags;" />
234 <IncludeRules context="SubtitleCommon" />
235 </context>
236
237 </contexts>
238
239 <itemDatas>
240 <itemData name="Normal Text" defStyleNum="dsNormal" spellChecking="false" />
241
242 <itemData name="Sequence Number" defStyleNum="dsOthers" bold="1" spellChecking="false" />
243 <itemData name="Appearance Time" defStyleNum="dsComment" bold="0" italic="0" spellChecking="false" />
244 <itemData name="Disappearance Time" defStyleNum="dsComment" bold="0" italic="0" spellChecking="false" />
245 <itemData name="Time Arrow" defStyleNum="dsComment" bold="1" italic="0" spellChecking="false" />
246 <itemData name="Coordinates" defStyleNum="dsAnnotation" bold="0" italic="0" underline="0" spellChecking="false" />
247 <itemData name="Subtitle" defStyleNum="dsNormal" />
248
249 <itemData name="Tag" defStyleNum="dsVariable" bold="0" italic="0" underline="0" spellChecking="false" />
250 <itemData name="Line Alignment Tag" defStyleNum="dsVariable" bold="1" italic="0" underline="0" spellChecking="false" />
251 <itemData name="Format Tag" defStyleNum="dsVariable" bold="0" italic="0" underline="0" strikeOut="0" spellChecking="false" />
252 <itemData name="Format Tag: Bold" defStyleNum="dsVariable" bold="1" italic="0" underline="0" strikeOut="0" spellChecking="false" />
253 <itemData name="Format Tag: Italic" defStyleNum="dsVariable" bold="0" italic="1" underline="0" strikeOut="0" spellChecking="false" />
254 <itemData name="Format Tag: Underline" defStyleNum="dsVariable" bold="0" italic="0" underline="1" strikeOut="0" spellChecking="false" />
255 <itemData name="Format Tag: Strikethrough" defStyleNum="dsVariable" bold="0" italic="0" underline="0" strikeOut="1" spellChecking="false" />
256 <itemData name="Format Tag: Bold-Italic" defStyleNum="dsVariable" bold="1" italic="1" underline="0" strikeOut="0" spellChecking="false" />
257 <itemData name="Format Tag: Bold-Underline" defStyleNum="dsVariable" bold="1" italic="0" underline="1" strikeOut="0" spellChecking="false" />
258 <itemData name="Format Tag: Italic-Underline" defStyleNum="dsVariable" bold="0" italic="1" underline="1" strikeOut="0" spellChecking="false" />
259 <itemData name="Bold" defStyleNum="dsNormal" bold="1" />
260 <itemData name="Italic" defStyleNum="dsNormal" italic="1" />
261 <itemData name="Underline" defStyleNum="dsNormal" underline="1" />
262 <itemData name="Strikethrough" defStyleNum="dsNormal" strikeOut="1" />
263 <itemData name="Bold-Italic" defStyleNum="dsNormal" bold="1" italic="1" />
264 <itemData name="Bold-Underline" defStyleNum="dsNormal" bold="1" underline="1" />
265 <itemData name="Italic-Underline" defStyleNum="dsNormal" italic="1" underline="1" />
266
267 <itemData name="Escape" defStyleNum="dsSpecialChar" spellChecking="false" />
268 <itemData name="Error" defStyleNum="dsError" />
269 <itemData name="Error (Subtitle)" defStyleNum="dsError" bold="0" italic="0" underline="0" />
270 </itemDatas>
271
272 </highlighting>
273
274 </language>
275 <!-- kate: replace-tabs off; tab-width 3; indent-width 3; remove-trailing-spaces mod; dynamic-word-wrap off; -->