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

Side by Side Diff: lib/src/prism/components/prism-haml.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
OLDNEW
1 /* TODO 1 /* TODO
2 Handle multiline code after tag 2 Handle multiline code after tag
3 %foo= some | 3 %foo= some |
4 multiline | 4 multiline |
5 code | 5 code |
6 */ 6 */
7 7
8 (function(Prism) { 8 (function(Prism) {
9 9
10 Prism.languages.haml = { 10 Prism.languages.haml = {
11 // Multiline stuff should appear before the rest 11 // Multiline stuff should appear before the rest
12 12
13 » » 'multiline-comment': [ 13 » » 'multiline-comment': {
14 » » » { 14 » » » pattern: /((?:^|\r?\n|\r)([\t ]*))(?:\/|-#).*((?:\r?\n|\ r)\2[\t ]+.+)*/,
15 » » » » pattern: /((?:^|\n)([\t ]*))\/.*(\n\2[\t ]+.+)*/ , 15 » » » lookbehind: true,
16 » » » » lookbehind: true, 16 » » » alias: 'comment'
17 » » » » alias: 'comment' 17 » » },
18 » » » },
19 » » » {
20 » » » » pattern: /((?:^|\n)([\t ]*))-#.*(\n\2[\t ]+.+)*/ ,
21 » » » » lookbehind: true,
22 » » » » alias: 'comment'
23 » » » }
24 » » ],
25 18
26 'multiline-code': [ 19 'multiline-code': [
27 { 20 {
28 » » » » pattern: /((?:^|\n)([\t ]*)(?:[~-]|[&!]?=)).*,[\ t ]*(\n\2[\t ]+.*,[\t ]*)*(\n\2[\t ]+.+)/, 21 » » » » pattern: /((?:^|\r?\n|\r)([\t ]*)(?:[~-]|[&!]?=) ).*,[\t ]*((?:\r?\n|\r)\2[\t ]+.*,[\t ]*)*((?:\r?\n|\r)\2[\t ]+.+)/,
29 lookbehind: true, 22 lookbehind: true,
30 inside: { 23 inside: {
31 rest: Prism.languages.ruby 24 rest: Prism.languages.ruby
32 } 25 }
33 }, 26 },
34 { 27 {
35 » » » » pattern: /((?:^|\n)([\t ]*)(?:[~-]|[&!]?=)).*\|[ \t ]*(\n\2[\t ]+.*\|[\t ]*)*/, 28 » » » » pattern: /((?:^|\r?\n|\r)([\t ]*)(?:[~-]|[&!]?=) ).*\|[\t ]*((?:\r?\n|\r)\2[\t ]+.*\|[\t ]*)*/,
36 lookbehind: true, 29 lookbehind: true,
37 inside: { 30 inside: {
38 rest: Prism.languages.ruby 31 rest: Prism.languages.ruby
39 } 32 }
40 } 33 }
41 ], 34 ],
42 35
43 // See at the end of the file for known filters 36 // See at the end of the file for known filters
44 'filter': { 37 'filter': {
45 » » » pattern: /((?:^|\n)([\t ]*)):[\w-]+(\n(?:\2[\t ]+.+|\s*? (?=\n)))+/, 38 » » » pattern: /((?:^|\r?\n|\r)([\t ]*)):[\w-]+((?:\r?\n|\r)(? :\2[\t ]+.+|\s*?(?=\r?\n|\r)))+/,
46 lookbehind: true, 39 lookbehind: true,
47 inside: { 40 inside: {
48 'filter-name': { 41 'filter-name': {
49 pattern: /^:[\w-]+/, 42 pattern: /^:[\w-]+/,
50 alias: 'variable' 43 alias: 'variable'
51 } 44 }
52 } 45 }
53 }, 46 },
54 47
55 'markup': { 48 'markup': {
56 » » » pattern: /((?:^|\n)[\t ]*)<.+/, 49 » » » pattern: /((?:^|\r?\n|\r)[\t ]*)<.+/,
57 lookbehind: true, 50 lookbehind: true,
58 inside: { 51 inside: {
59 rest: Prism.languages.markup 52 rest: Prism.languages.markup
60 } 53 }
61 }, 54 },
62 'doctype': { 55 'doctype': {
63 » » » pattern: /((?:^|\n)[\t ]*)!!!(?: .+)?/, 56 » » » pattern: /((?:^|\r?\n|\r)[\t ]*)!!!(?: .+)?/,
64 lookbehind: true 57 lookbehind: true
65 }, 58 },
66 'tag': { 59 'tag': {
67 // Allows for one nested group of braces 60 // Allows for one nested group of braces
68 » » » pattern: /((?:^|\n)[\t ]*)[%.#][\w\-#.]*[\w\-](?:\([^)]+ \)|\{(?:\{[^}]+\}|[^}])+\}|\[[^\]]+\])*[\/<>]*/, 61 » » » pattern: /((?:^|\r?\n|\r)[\t ]*)[%.#][\w\-#.]*[\w\-](?:\ ([^)]+\)|\{(?:\{[^}]+\}|[^}])+\}|\[[^\]]+\])*[\/<>]*/,
69 lookbehind: true, 62 lookbehind: true,
70 inside: { 63 inside: {
71 'attributes': [ 64 'attributes': [
72 { 65 {
73 // Lookbehind tries to prevent i nterpolations for breaking it all 66 // Lookbehind tries to prevent i nterpolations for breaking it all
74 // Allows for one nested group o f braces 67 // Allows for one nested group o f braces
75 pattern: /(^|[^#])\{(?:\{[^}]+\} |[^}])+\}/, 68 pattern: /(^|[^#])\{(?:\{[^}]+\} |[^}])+\}/,
76 lookbehind: true, 69 lookbehind: true,
77 inside: { 70 inside: {
78 rest: Prism.languages.ru by 71 rest: Prism.languages.ru by
(...skipping 14 matching lines...) Expand all
93 pattern: /\[[^\]]+\]/, 86 pattern: /\[[^\]]+\]/,
94 inside: { 87 inside: {
95 rest: Prism.languages.ru by 88 rest: Prism.languages.ru by
96 } 89 }
97 } 90 }
98 ], 91 ],
99 'punctuation': /[<>]/ 92 'punctuation': /[<>]/
100 } 93 }
101 }, 94 },
102 'code': { 95 'code': {
103 » » » pattern: /((?:^|\n)[\t ]*(?:[~-]|[&!]?=)).+/, 96 » » » pattern: /((?:^|\r?\n|\r)[\t ]*(?:[~-]|[&!]?=)).+/,
104 lookbehind: true, 97 lookbehind: true,
105 inside: { 98 inside: {
106 rest: Prism.languages.ruby 99 rest: Prism.languages.ruby
107 } 100 }
108 }, 101 },
109 // Interpolations in plain text 102 // Interpolations in plain text
110 'interpolation': { 103 'interpolation': {
111 pattern: /#\{[^}]+\}/, 104 pattern: /#\{[^}]+\}/,
112 inside: { 105 inside: {
113 'delimiter': { 106 'delimiter': {
114 pattern: /^#\{|\}$/, 107 pattern: /^#\{|\}$/,
115 alias: 'punctuation' 108 alias: 'punctuation'
116 }, 109 },
117 rest: Prism.languages.ruby 110 rest: Prism.languages.ruby
118 } 111 }
119 }, 112 },
120 'punctuation': { 113 'punctuation': {
121 » » » pattern: /((?:^|\n)[\t ]*)[~=\-&!]/, 114 » » » pattern: /((?:^|\r?\n|\r)[\t ]*)[~=\-&!]+/,
122 lookbehind: true 115 lookbehind: true
123 } 116 }
124 }; 117 };
125 118
126 » var filter_pattern = '((?:^|\\n)([\\t ]*)):{{filter_name}}(\\n(?:\\2[\\t ]+.+|\\s*?(?=\\n)))+'; 119 » var filter_pattern = '((?:^|\\r?\\n|\\r)([\\t ]*)):{{filter_name}}((?:\\ r?\\n|\\r)(?:\\2[\\t ]+.+|\\s*?(?=\\r?\\n|\\r)))+';
127 120
128 // Non exhaustive list of available filters and associated languages 121 // Non exhaustive list of available filters and associated languages
129 var filters = [ 122 var filters = [
130 'css', 123 'css',
131 {filter:'coffee',language:'coffeescript'}, 124 {filter:'coffee',language:'coffeescript'},
132 'erb', 125 'erb',
133 'javascript', 126 'javascript',
134 'less', 127 'less',
135 'markdown', 128 'markdown',
136 'ruby', 129 'ruby',
(...skipping 15 matching lines...) Expand all
152 }, 145 },
153 rest: Prism.languages[filter.language] 146 rest: Prism.languages[filter.language]
154 } 147 }
155 } 148 }
156 } 149 }
157 } 150 }
158 151
159 Prism.languages.insertBefore('haml', 'filter', all_filters); 152 Prism.languages.insertBefore('haml', 'filter', all_filters);
160 153
161 }(Prism)); 154 }(Prism));
OLDNEW
« no previous file with comments | « lib/src/prism/components/prism-groovy.min.js ('k') | lib/src/prism/components/prism-haml.min.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698