Blame view

bower_components/prism/components/prism-rest.js 4.61 KB
73bcce88   luigser   COMPONENTS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
  Prism.languages.rest = {
  	'table': [
  		{
  			pattern: /(\s*)(?:\+[=-]+)+\+(?:\r?\n|\r)(?:\1(?:[+|].+)+[+|](?:\r?\n|\r))+\1(?:\+[=-]+)+\+/,
  			lookbehind: true,
  			inside: {
  				'punctuation': /\||(?:\+[=-]+)+\+/
  			}
  		},
  		{
  			pattern: /(\s*)(?:=+ +)+=+((?:\r?\n|\r)\1.+)+(?:\r?\n|\r)\1(?:=+ +)+=+(?=(?:\r?\n|\r){2}|\s*$)/,
  			lookbehind: true,
  			inside: {
  				'punctuation': /[=-]+/
  			}
  		}
  	],
  
  	// Directive-like patterns
  
  	'substitution-def': {
eb240478   Luigi Serra   public room cards...
22
  		pattern: /(^\s*\.\. )\|(?:[^|\s](?:[^|]*[^|\s])?)\| [^:]+::/m,
73bcce88   luigser   COMPONENTS
23
24
25
26
27
28
29
30
31
32
  		lookbehind: true,
  		inside: {
  			'substitution': {
  				pattern: /^\|(?:[^|\s]|[^|\s][^|]*[^|\s])\|/,
  				alias: 'attr-value',
  				inside: {
  					'punctuation': /^\||\|$/
  				}
  			},
  			'directive': {
eb240478   Luigi Serra   public room cards...
33
  				pattern: /( +)[^:]+::/,
73bcce88   luigser   COMPONENTS
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
  				lookbehind: true,
  				alias: 'function',
  				inside: {
  					'punctuation': /::$/
  				}
  			}
  		}
  	},
  	'link-target': [
  		{
  			pattern: /(^\s*\.\. )\[[^\]]+\]/m,
  			lookbehind: true,
  			alias: 'string',
  			inside: {
  				'punctuation': /^\[|\]$/
  			}
  		},
  		{
eb240478   Luigi Serra   public room cards...
52
  			pattern: /(^\s*\.\. )_(?:`[^`]+`|(?:[^:\\]|\\.)+):/m,
73bcce88   luigser   COMPONENTS
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
  			lookbehind: true,
  			alias: 'string',
  			inside: {
  				'punctuation': /^_|:$/
  			}
  		}
  	],
  	'directive': {
  		pattern: /(^\s*\.\. )[^:]+::/m,
  		lookbehind: true,
  		alias: 'function',
  		inside: {
  			'punctuation': /::$/
  		}
  	},
  	'comment': {
eb240478   Luigi Serra   public room cards...
69
70
  		// The two alternatives try to prevent highlighting of blank comments
  		pattern: /(^\s*\.\.)(?:(?: .+)?(?:(?:\r?\n|\r).+)+| .+)(?=(?:\r?\n|\r){2}|$)/m,
73bcce88   luigser   COMPONENTS
71
72
73
74
75
76
  		lookbehind: true
  	},
  
  	'title': [
  		// Overlined and underlined
  		{
eb240478   Luigi Serra   public room cards...
77
  			pattern: /^(([!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~])\2+)(?:\r?\n|\r).+(?:\r?\n|\r)\1$/m,
73bcce88   luigser   COMPONENTS
78
79
80
81
82
83
84
85
  			inside: {
  				'punctuation': /^[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~]+|[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~]+$/,
  				'important': /.+/
  			}
  		},
  
  		// Underlined only
  		{
eb240478   Luigi Serra   public room cards...
86
  			pattern: /(^|(?:\r?\n|\r){2}).+(?:\r?\n|\r)([!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~])\2+(?=\r?\n|\r|$)/,
73bcce88   luigser   COMPONENTS
87
88
89
90
91
92
93
94
  			lookbehind: true,
  			inside: {
  				'punctuation': /[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~]+$/,
  				'important': /.+/
  			}
  		}
  	],
  	'hr': {
eb240478   Luigi Serra   public room cards...
95
  		pattern: /((?:\r?\n|\r){2})([!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~])\2{3,}(?=(?:\r?\n|\r){2})/,
73bcce88   luigser   COMPONENTS
96
97
98
99
  		lookbehind: true,
  		alias: 'punctuation'
  	},
  	'field': {
eb240478   Luigi Serra   public room cards...
100
  		pattern: /(^\s*):[^:\r\n]+:(?= )/m,
73bcce88   luigser   COMPONENTS
101
102
103
104
  		lookbehind: true,
  		alias: 'attr-name'
  	},
  	'command-line-option': {
eb240478   Luigi Serra   public room cards...
105
  		pattern: /(^\s*)(?:[+-][a-z\d]|(?:\-\-|\/)[a-z\d-]+)(?:[ =](?:[a-z][a-z\d_-]*|<[^<>]+>))?(?:, (?:[+-][a-z\d]|(?:\-\-|\/)[a-z\d-]+)(?:[ =](?:[a-z][a-z\d_-]*|<[^<>]+>))?)*(?=(?:\r?\n|\r)? {2,}\S)/im,
73bcce88   luigser   COMPONENTS
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
  		lookbehind: true,
  		alias: 'symbol'
  	},
  	'literal-block': {
  		pattern: /::(?:\r?\n|\r){2}([ \t]+).+(?:(?:\r?\n|\r)\1.+)*/,
  		inside: {
  			'literal-block-punctuation': {
  				pattern: /^::/,
  				alias: 'punctuation'
  			}
  		}
  	},
  	'quoted-literal-block': {
  		pattern: /::(?:\r?\n|\r){2}([!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~]).*(?:(?:\r?\n|\r)\1.*)*/,
  		inside: {
  			'literal-block-punctuation': {
eb240478   Luigi Serra   public room cards...
122
  				pattern: /^(?:::|([!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~])\1*)/m,
73bcce88   luigser   COMPONENTS
123
124
125
126
  				alias: 'punctuation'
  			}
  		}
  	},
eb240478   Luigi Serra   public room cards...
127
128
129
130
131
  	'list-bullet': {
  		pattern: /(^\s*)(?:[*+\-•‣⁃]|\(?(?:\d+|[a-z]|[ivxdclm]+)\)|(?:\d+|[a-z]|[ivxdclm]+)\.)(?= )/im,
  		lookbehind: true,
  		alias: 'punctuation'
  	},
73bcce88   luigser   COMPONENTS
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
  	'doctest-block': {
  		pattern: /(^\s*)>>> .+(?:(?:\r?\n|\r).+)*/m,
  		lookbehind: true,
  		inside: {
  			'punctuation': /^>>>/
  		}
  	},
  
  	'inline': [
  		{
  			pattern: /(^|[\s\-:\/'"<(\[{])(?::[^:]+:`.*?`|`.*?`:[^:]+:|(\*\*?|``?|\|)(?!\s).*?[^\s]\2(?=[\s\-.,:;!?\\\/'")\]}]|$))/m,
  			lookbehind: true,
  			inside: {
  				'bold': {
  					pattern: /(^\*\*).+(?=\*\*$)/,
  					lookbehind: true
  				},
  				'italic': {
  					pattern: /(^\*).+(?=\*$)/,
  					lookbehind: true
  				},
  				'inline-literal': {
  					pattern: /(^``).+(?=``$)/,
  					lookbehind: true,
  					alias: 'symbol'
  				},
  				'role': {
  					pattern: /^:[^:]+:|:[^:]+:$/,
  					alias: 'function',
  					inside: {
  						'punctuation': /^:|:$/
  					}
  				},
  				'interpreted-text': {
  					pattern: /(^`).+(?=`$)/,
  					lookbehind: true,
  					alias: 'attr-value'
  				},
  				'substitution': {
  					pattern: /(^\|).+(?=\|$)/,
  					lookbehind: true,
  					alias: 'attr-value'
  				},
  				'punctuation': /\*\*?|``?|\|/
  			}
  		}
  	],
  
  	'link': [
  		{
  			pattern: /\[[^\]]+\]_(?=[\s\-.,:;!?\\\/'")\]}]|$)/,
  			alias: 'string',
  			inside: {
  				'punctuation': /^\[|\]_$/
  			}
  		},
  		{
eb240478   Luigi Serra   public room cards...
189
  			pattern: /(?:\b[a-z\d](?:[_.:+]?[a-z\d]+)*_?_|`[^`]+`_?_|_`[^`]+`)(?=[\s\-.,:;!?\\\/'")\]}]|$)/i,
73bcce88   luigser   COMPONENTS
190
191
  			alias: 'string',
  			inside: {
eb240478   Luigi Serra   public room cards...
192
  				'punctuation': /^_?`|`$|`?_?_$/
73bcce88   luigser   COMPONENTS
193
194
195
196
197
198
199
200
201
202
203
204
205
  			}
  		}
  	],
  
  	// Line block start,
  	// quote attribution,
  	// explicit markup start,
  	// and anonymous hyperlink target shortcut (__)
  	'punctuation': {
  		pattern: /(^\s*)(?:\|(?= |$)|(?:---?||\.\.|__)(?= )|\.\.$)/m,
  		lookbehind: true
  	}
  };