File tree Expand file tree Collapse file tree 1 file changed +87
-0
lines changed Expand file tree Collapse file tree 1 file changed +87
-0
lines changed Original file line number Diff line number Diff line change
1
+ /*
2
+ Language: XDGDesktop
3
+ Description: XDG Desktop Entry Specification file format.
4
+ Contributors: Lee Yunjin <[email protected] >
5
+ Category: common, config
6
+ Website: https://www.freedesktop.org/wiki/Specifications/desktop-entry-spec/
7
+ */
8
+
9
+ export default function ( hljs ) {
10
+ const LITERALS = {
11
+ className : 'literal' ,
12
+ begin : / \b ( t r u e | f a l s e | A p p l i c a t i o n | L i n k | D i r e c t o r y ) \b / ,
13
+ relevance : 0
14
+ } ;
15
+
16
+ const FIELD_CODES = {
17
+ className : 'variable' ,
18
+ match : / % [ f F u U c C i I k K v V ] /
19
+ } ;
20
+
21
+ const QUOTED_STRING = {
22
+ className : 'string' ,
23
+ begin : / " / ,
24
+ end : / " / ,
25
+ contains : [ hljs . BACKSLASH_ESCAPE ] ,
26
+ relevance : 0
27
+ } ;
28
+
29
+ const COMMENT_MODE = {
30
+ className : 'comment' ,
31
+ begin : / # / ,
32
+ end : / $ / ,
33
+ relevance : 0
34
+ } ;
35
+
36
+ const SECTION_HEADER = {
37
+ className : 'section' ,
38
+ begin : / ^ \[ ( D e s k t o p E n t r y | D e s k t o p A c t i o n \s + [ A - Z a - z 0 - 9 _ - ] + ) \] / ,
39
+ relevance : 10
40
+ } ;
41
+
42
+ const MIMETYPE_FORMAT = {
43
+ className : 'type' ,
44
+ match : / \b [ a - z A - Z 0 - 9 _ . + - ] + \/ [ a - z A - Z 0 - 9 _ . + - ] + / ,
45
+ relevance : 0
46
+ } ;
47
+
48
+ const KEY_VALUE_PAIR = {
49
+ begin : / ^ [ A - Z a - z 0 - 9 _ - ] + ( \[ [ A - Z a - z 0 - 9 _ @ . ] + \] ) ? \s * = / ,
50
+ end : / $ / ,
51
+ returnBegin : true ,
52
+ contains : [
53
+ {
54
+ className : 'attribute' ,
55
+ begin : / ^ [ A - Z a - z 0 - 9 _ - ] + ( \[ [ A - Z a - z 0 - 9 _ @ . ] + \] ) ? / ,
56
+ relevance : 10
57
+ } ,
58
+ {
59
+ className : 'operator' ,
60
+ match : / = / ,
61
+ relevance : 0
62
+ } ,
63
+ COMMENT_MODE ,
64
+ LITERALS ,
65
+ QUOTED_STRING ,
66
+ FIELD_CODES ,
67
+ MIMETYPE_FORMAT ,
68
+ {
69
+ className : 'punctuation' ,
70
+ match : / ; / ,
71
+ relevance : 0
72
+ }
73
+ ]
74
+ } ;
75
+
76
+ return {
77
+ name : 'Desktop' ,
78
+ aliases : [ 'desktop' ] ,
79
+ case_insensitive : false ,
80
+ contains : [
81
+ COMMENT_MODE ,
82
+ SECTION_HEADER ,
83
+ KEY_VALUE_PAIR
84
+ ]
85
+ } ;
86
+ }
87
+
You can’t perform that action at this time.
0 commit comments