Matteo Scandolo | 46b5610 | 2015-12-16 14:23:08 -0800 | [diff] [blame] | 1 | /** |
| 2 | * HTML patterns |
| 3 | * |
| 4 | * @author Craig Campbell |
| 5 | * @version 1.0.7 |
| 6 | */ |
| 7 | Rainbow.extend('html', [ |
| 8 | { |
| 9 | 'name': 'source.php.embedded', |
| 10 | 'matches': { |
| 11 | 2: { |
| 12 | 'language': 'php' |
| 13 | } |
| 14 | }, |
| 15 | 'pattern': /<\?=?(?!xml)(php)?([\s\S]*?)(\?>)/gm |
| 16 | }, |
| 17 | { |
| 18 | 'name': 'source.css.embedded', |
| 19 | 'matches': { |
| 20 | 0: { |
| 21 | 'language': 'css' |
| 22 | } |
| 23 | }, |
| 24 | 'pattern': /<style(.*?)>([\s\S]*?)<\/style>/gm |
| 25 | }, |
| 26 | { |
| 27 | 'name': 'source.js.embedded', |
| 28 | 'matches': { |
| 29 | 0: { |
| 30 | 'language': 'javascript' |
| 31 | } |
| 32 | }, |
| 33 | 'pattern': /<script(?! src)(.*?)>([\s\S]*?)<\/script>/gm |
| 34 | }, |
| 35 | { |
| 36 | 'name': 'comment.html', |
| 37 | 'pattern': /<\!--[\S\s]*?-->/g |
| 38 | }, |
| 39 | { |
| 40 | 'matches': { |
| 41 | 1: 'support.tag.open', |
| 42 | 2: 'support.tag.cclose' |
| 43 | }, |
| 44 | 'pattern': /(<)|(\/?\??>)/g |
| 45 | }, |
| 46 | { |
| 47 | 'name': 'support.tag', |
| 48 | 'matches': { |
| 49 | 1: 'support.tag', |
| 50 | 2: 'support.tag.special', |
| 51 | 3: 'support.tag-name' |
| 52 | }, |
| 53 | 'pattern': /(<\??)(\/|\!?)(\w+)/g |
| 54 | }, |
| 55 | { |
| 56 | 'matches': { |
| 57 | 1: 'support.attribute' |
| 58 | }, |
| 59 | 'pattern': /([a-z-]+)(?=\=)/gi |
| 60 | }, |
| 61 | { |
| 62 | 'matches': { |
| 63 | 1: 'support.operator', |
| 64 | 2: 'string.quote', |
| 65 | 3: 'string.value', |
| 66 | 4: 'string.quote' |
| 67 | }, |
| 68 | 'pattern': /(=)('|")(.*?)(\2)/g |
| 69 | }, |
| 70 | { |
| 71 | 'matches': { |
| 72 | 1: 'support.operator', |
| 73 | 2: 'support.value' |
| 74 | }, |
| 75 | 'pattern': /(=)([a-zA-Z\-0-9]*)\b/g |
| 76 | }, |
| 77 | { |
| 78 | 'matches': { |
| 79 | 1: 'support.attribute' |
| 80 | }, |
| 81 | 'pattern': /\s(\w+)(?=\s|>)(?![\s\S]*<)/g |
| 82 | } |
| 83 | ], true); |