Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Side by Side Diff: lib/src/prism/components/prism-rest.js

Issue 1418513006: update elements and fix some bugs (Closed) Base URL: git@github.com:dart-lang/polymer_elements.git@master
Patch Set: code review updates Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/src/prism/components/prism-r.min.js ('k') | lib/src/prism/components/prism-rest.min.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 Prism.languages.rest = { 1 Prism.languages.rest = {
2 'table': [ 2 'table': [
3 { 3 {
4 pattern: /(\s*)(?:\+[=-]+)+\+(?:\r?\n|\r)(?:\1(?:[+|].+) +[+|](?:\r?\n|\r))+\1(?:\+[=-]+)+\+/, 4 pattern: /(\s*)(?:\+[=-]+)+\+(?:\r?\n|\r)(?:\1(?:[+|].+) +[+|](?:\r?\n|\r))+\1(?:\+[=-]+)+\+/,
5 lookbehind: true, 5 lookbehind: true,
6 inside: { 6 inside: {
7 'punctuation': /\||(?:\+[=-]+)+\+/ 7 'punctuation': /\||(?:\+[=-]+)+\+/
8 } 8 }
9 }, 9 },
10 { 10 {
11 pattern: /(\s*)(?:=+ +)+=+((?:\r?\n|\r)\1.+)+(?:\r?\n|\r )\1(?:=+ +)+=+(?=(?:\r?\n|\r){2}|\s*$)/, 11 pattern: /(\s*)(?:=+ +)+=+((?:\r?\n|\r)\1.+)+(?:\r?\n|\r )\1(?:=+ +)+=+(?=(?:\r?\n|\r){2}|\s*$)/,
12 lookbehind: true, 12 lookbehind: true,
13 inside: { 13 inside: {
14 'punctuation': /[=-]+/ 14 'punctuation': /[=-]+/
15 } 15 }
16 } 16 }
17 ], 17 ],
18 18
19 // Directive-like patterns 19 // Directive-like patterns
20 20
21 'substitution-def': { 21 'substitution-def': {
22 » » pattern: /(^\s*\.\. )\|(?:[^|\s]|[^|\s][^|]*[^|\s])\| [^:]+::/m, 22 » » pattern: /(^\s*\.\. )\|(?:[^|\s](?:[^|]*[^|\s])?)\| [^:]+::/m,
23 lookbehind: true, 23 lookbehind: true,
24 inside: { 24 inside: {
25 'substitution': { 25 'substitution': {
26 pattern: /^\|(?:[^|\s]|[^|\s][^|]*[^|\s])\|/, 26 pattern: /^\|(?:[^|\s]|[^|\s][^|]*[^|\s])\|/,
27 alias: 'attr-value', 27 alias: 'attr-value',
28 inside: { 28 inside: {
29 'punctuation': /^\||\|$/ 29 'punctuation': /^\||\|$/
30 } 30 }
31 }, 31 },
32 'directive': { 32 'directive': {
33 » » » » pattern: /( )[^:]+::/, 33 » » » » pattern: /( +)[^:]+::/,
34 lookbehind: true, 34 lookbehind: true,
35 alias: 'function', 35 alias: 'function',
36 inside: { 36 inside: {
37 'punctuation': /::$/ 37 'punctuation': /::$/
38 } 38 }
39 } 39 }
40 } 40 }
41 }, 41 },
42 'link-target': [ 42 'link-target': [
43 { 43 {
44 pattern: /(^\s*\.\. )\[[^\]]+\]/m, 44 pattern: /(^\s*\.\. )\[[^\]]+\]/m,
45 lookbehind: true, 45 lookbehind: true,
46 alias: 'string', 46 alias: 'string',
47 inside: { 47 inside: {
48 'punctuation': /^\[|\]$/ 48 'punctuation': /^\[|\]$/
49 } 49 }
50 }, 50 },
51 { 51 {
52 » » » pattern: /(^\s*\.\. )_(?:`[^`]+`|(?:\\:|[^:])+):/m, 52 » » » pattern: /(^\s*\.\. )_(?:`[^`]+`|(?:[^:\\]|\\.)+):/m,
53 lookbehind: true, 53 lookbehind: true,
54 alias: 'string', 54 alias: 'string',
55 inside: { 55 inside: {
56 'punctuation': /^_|:$/ 56 'punctuation': /^_|:$/
57 } 57 }
58 } 58 }
59 ], 59 ],
60 'directive': { 60 'directive': {
61 pattern: /(^\s*\.\. )[^:]+::/m, 61 pattern: /(^\s*\.\. )[^:]+::/m,
62 lookbehind: true, 62 lookbehind: true,
63 alias: 'function', 63 alias: 'function',
64 inside: { 64 inside: {
65 'punctuation': /::$/ 65 'punctuation': /::$/
66 } 66 }
67 }, 67 },
68 'comment': { 68 'comment': {
69 » » pattern: /(^\s*\.\.\s).*(?:(?:\r?\n|\r).*)*?(?=(?:\r?\n|\r){2}|$ )/m, 69 » » // The two alternatives try to prevent highlighting of blank com ments
70 » » pattern: /(^\s*\.\.)(?:(?: .+)?(?:(?:\r?\n|\r).+)+| .+)(?=(?:\r? \n|\r){2}|$)/m,
70 lookbehind: true 71 lookbehind: true
71 }, 72 },
72 73
73 'title': [ 74 'title': [
74 // Overlined and underlined 75 // Overlined and underlined
75 { 76 {
76 » » » pattern: /^([!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~]{2,}) (?:\r?\n|\r).+(?:\r?\n|\r)\1$/m, 77 » » » pattern: /^(([!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~])\2+ )(?:\r?\n|\r).+(?:\r?\n|\r)\1$/m,
77 inside: { 78 inside: {
78 'punctuation': /^[!"#$%&'()*+,\-.\/:;<=>?@\[\\\] ^_`{|}~]+|[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~]+$/, 79 'punctuation': /^[!"#$%&'()*+,\-.\/:;<=>?@\[\\\] ^_`{|}~]+|[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~]+$/,
79 'important': /.+/ 80 'important': /.+/
80 } 81 }
81 }, 82 },
82 83
83 // Underlined only 84 // Underlined only
84 { 85 {
85 » » » pattern: /(^|(?:\r?\n|\r){2}).+(?:\r?\n|\r)[!"#$%&'()*+, \-.\/:;<=>?@\[\\\]^_`{|}~]{2,}(?=\r?\n|\r|$)/, 86 » » » pattern: /(^|(?:\r?\n|\r){2}).+(?:\r?\n|\r)([!"#$%&'()*+ ,\-.\/:;<=>?@\[\\\]^_`{|}~])\2+(?=\r?\n|\r|$)/,
86 lookbehind: true, 87 lookbehind: true,
87 inside: { 88 inside: {
88 'punctuation': /[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^ _`{|}~]+$/, 89 'punctuation': /[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^ _`{|}~]+$/,
89 'important': /.+/ 90 'important': /.+/
90 } 91 }
91 } 92 }
92 ], 93 ],
93 'hr': { 94 'hr': {
94 » » pattern: /((?:\r?\n|\r){2})[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|} ~]{4,}(?=(?:\r?\n|\r){2})/, 95 » » pattern: /((?:\r?\n|\r){2})([!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{| }~])\2{3,}(?=(?:\r?\n|\r){2})/,
95 » » lookbehind: true,
96 » » alias: 'punctuation'
97 » },
98 » 'list-bullet': {
99 » » pattern: /(^\s*)(?:[*+\-•‣⁃]|\(?(?:\d+|[a-z]|[ivxdclm]+)\)|(?:\d +|[a-z]|[ivxdclm]+)\.)(?= )/im,
100 lookbehind: true, 96 lookbehind: true,
101 alias: 'punctuation' 97 alias: 'punctuation'
102 }, 98 },
103 'field': { 99 'field': {
104 » » pattern: /(^\s*):[^:]+:(?= )/m, 100 » » pattern: /(^\s*):[^:\r\n]+:(?= )/m,
105 lookbehind: true, 101 lookbehind: true,
106 alias: 'attr-name' 102 alias: 'attr-name'
107 }, 103 },
108 'command-line-option': { 104 'command-line-option': {
109 » » 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, 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,
110 lookbehind: true, 106 lookbehind: true,
111 alias: 'symbol' 107 alias: 'symbol'
112 }, 108 },
113 'literal-block': { 109 'literal-block': {
114 pattern: /::(?:\r?\n|\r){2}([ \t]+).+(?:(?:\r?\n|\r)\1.+)*/, 110 pattern: /::(?:\r?\n|\r){2}([ \t]+).+(?:(?:\r?\n|\r)\1.+)*/,
115 inside: { 111 inside: {
116 'literal-block-punctuation': { 112 'literal-block-punctuation': {
117 pattern: /^::/, 113 pattern: /^::/,
118 alias: 'punctuation' 114 alias: 'punctuation'
119 } 115 }
120 } 116 }
121 }, 117 },
122 'quoted-literal-block': { 118 'quoted-literal-block': {
123 pattern: /::(?:\r?\n|\r){2}([!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{| }~]).*(?:(?:\r?\n|\r)\1.*)*/, 119 pattern: /::(?:\r?\n|\r){2}([!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{| }~]).*(?:(?:\r?\n|\r)\1.*)*/,
124 inside: { 120 inside: {
125 'literal-block-punctuation': { 121 'literal-block-punctuation': {
126 » » » » pattern: /^(?:::|[!"#$%&'()*+,\-.\/:;<=>?@\[\\\] ^_`{|}~])/m, 122 » » » » pattern: /^(?:::|([!"#$%&'()*+,\-.\/:;<=>?@\[\\\ ]^_`{|}~])\1*)/m,
127 alias: 'punctuation' 123 alias: 'punctuation'
128 } 124 }
129 } 125 }
130 }, 126 },
127 'list-bullet': {
128 pattern: /(^\s*)(?:[*+\-•‣⁃]|\(?(?:\d+|[a-z]|[ivxdclm]+)\)|(?:\d +|[a-z]|[ivxdclm]+)\.)(?= )/im,
129 lookbehind: true,
130 alias: 'punctuation'
131 },
131 'doctest-block': { 132 'doctest-block': {
132 pattern: /(^\s*)>>> .+(?:(?:\r?\n|\r).+)*/m, 133 pattern: /(^\s*)>>> .+(?:(?:\r?\n|\r).+)*/m,
133 lookbehind: true, 134 lookbehind: true,
134 inside: { 135 inside: {
135 'punctuation': /^>>>/ 136 'punctuation': /^>>>/
136 } 137 }
137 }, 138 },
138 139
139 'inline': [ 140 'inline': [
140 { 141 {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 179
179 'link': [ 180 'link': [
180 { 181 {
181 pattern: /\[[^\]]+\]_(?=[\s\-.,:;!?\\\/'")\]}]|$)/, 182 pattern: /\[[^\]]+\]_(?=[\s\-.,:;!?\\\/'")\]}]|$)/,
182 alias: 'string', 183 alias: 'string',
183 inside: { 184 inside: {
184 'punctuation': /^\[|\]_$/ 185 'punctuation': /^\[|\]_$/
185 } 186 }
186 }, 187 },
187 { 188 {
188 » » » pattern: /(?:\b[a-z\d](?:[_.:+]?[a-z\d]+)?_?_|`[^`]+`_?_ |_`[^`]+`)(?=[\s\-.,:;!?\\\/'")\]}]|$)/i, 189 » » » pattern: /(?:\b[a-z\d](?:[_.:+]?[a-z\d]+)*_?_|`[^`]+`_?_ |_`[^`]+`)(?=[\s\-.,:;!?\\\/'")\]}]|$)/i,
189 alias: 'string', 190 alias: 'string',
190 inside: { 191 inside: {
191 » » » » 'punctuation': /^_?`|`?_?_$/ 192 » » » » 'punctuation': /^_?`|`$|`?_?_$/
192 } 193 }
193 } 194 }
194 ], 195 ],
195 196
196 // Line block start, 197 // Line block start,
197 // quote attribution, 198 // quote attribution,
198 // explicit markup start, 199 // explicit markup start,
199 // and anonymous hyperlink target shortcut (__) 200 // and anonymous hyperlink target shortcut (__)
200 'punctuation': { 201 'punctuation': {
201 pattern: /(^\s*)(?:\|(?= |$)|(?:---?|—|\.\.|__)(?= )|\.\.$)/m, 202 pattern: /(^\s*)(?:\|(?= |$)|(?:---?|—|\.\.|__)(?= )|\.\.$)/m,
202 lookbehind: true 203 lookbehind: true
203 } 204 }
204 }; 205 };
OLDNEW
« no previous file with comments | « lib/src/prism/components/prism-r.min.js ('k') | lib/src/prism/components/prism-rest.min.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698