mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-04 10:16:24 +02:00
* [FilePreview] Use syntax highlighting for .srt * Change customTokenColors to customTokenThemeRules * Ignore text on the same line as a timestamp * Update tokenization rules
29 lines
854 B
JavaScript
29 lines
854 B
JavaScript
export function srtDefinition() {
|
|
return {
|
|
tokenizer: {
|
|
root: [
|
|
[/\s*\d+/, 'number', '@block']
|
|
],
|
|
|
|
block: [
|
|
[/^\d{2}:\d{2}:\d{2},\d{3} --> \d{2}:\d{2}:\d{2},\d{3}/, {
|
|
cases: {
|
|
'@eos': {token: 'type.identifier', next: '@subtitle'},
|
|
'@default': {token: 'type.identifier', next: '@ignore'}
|
|
}
|
|
}],
|
|
[/^$/, 'string', '@pop']
|
|
],
|
|
|
|
ignore: [
|
|
[/.+$/, '', '@subtitle']
|
|
],
|
|
|
|
subtitle: [
|
|
[/^$/, 'string', '@popall'],
|
|
[/<\/?(?:[ibu]|font(?:\s+color="[^"]+"\s*)?)>/, 'tag'],
|
|
[/./, 'string']
|
|
]
|
|
}
|
|
};
|
|
} |