133 lines
3.5 KiB
JavaScript
133 lines
3.5 KiB
JavaScript
/**
|
|
* HTML patterns
|
|
*
|
|
* @author Craig Campbell
|
|
* @version 1.0.9
|
|
*/
|
|
Rainbow.extend('html', [
|
|
{
|
|
'name': 'source.php.embedded',
|
|
'matches': {
|
|
2: {
|
|
'language': 'php'
|
|
}
|
|
},
|
|
'pattern': /<\?=?(?!xml)(php)?([\s\S]*?)(\?>)/gm
|
|
},
|
|
{
|
|
'name': 'source.css.embedded',
|
|
'matches': {
|
|
1: {
|
|
'matches': {
|
|
1: 'support.tag.style',
|
|
2: [
|
|
{
|
|
'name': 'entity.tag.style',
|
|
'pattern': /^style/g
|
|
},
|
|
{
|
|
'name': 'string',
|
|
'pattern': /('|")(.*?)(\1)/g
|
|
},
|
|
{
|
|
'name': 'entity.tag.style.attribute',
|
|
'pattern': /(\w+)/g
|
|
}
|
|
],
|
|
3: 'support.tag.style'
|
|
},
|
|
'pattern': /(<\/?)(style.*?)(>)/g
|
|
},
|
|
2: {
|
|
'language': 'css'
|
|
},
|
|
3: 'support.tag.style',
|
|
4: 'entity.tag.style',
|
|
5: 'support.tag.style'
|
|
},
|
|
'pattern': /(<style.*?>)([\s\S]*?)(<\/)(style)(>)/gm
|
|
},
|
|
{
|
|
'name': 'source.js.embedded',
|
|
'matches': {
|
|
1: {
|
|
'matches': {
|
|
1: 'support.tag.script',
|
|
2: [
|
|
{
|
|
'name': 'entity.tag.script',
|
|
'pattern': /^script/g
|
|
},
|
|
|
|
{
|
|
'name': 'string',
|
|
'pattern': /('|")(.*?)(\1)/g
|
|
},
|
|
{
|
|
'name': 'entity.tag.script.attribute',
|
|
'pattern': /(\w+)/g
|
|
}
|
|
],
|
|
3: 'support.tag.script'
|
|
},
|
|
'pattern': /(<\/?)(script.*?)(>)/g
|
|
},
|
|
2: {
|
|
'language': 'javascript'
|
|
},
|
|
3: 'support.tag.script',
|
|
4: 'entity.tag.script',
|
|
5: 'support.tag.script'
|
|
},
|
|
'pattern': /(<script(?! src).*?>)([\s\S]*?)(<\/)(script)(>)/gm
|
|
},
|
|
{
|
|
'name': 'comment.html',
|
|
'pattern': /<\!--[\S\s]*?-->/g
|
|
},
|
|
{
|
|
'matches': {
|
|
1: 'support.tag.open',
|
|
2: 'support.tag.close'
|
|
},
|
|
'pattern': /(<)|(\/?\??>)/g
|
|
},
|
|
{
|
|
'name': 'support.tag',
|
|
'matches': {
|
|
1: 'support.tag',
|
|
2: 'support.tag.special',
|
|
3: 'support.tag-name'
|
|
},
|
|
'pattern': /(<\??)(\/|\!?)(\w+)/g
|
|
},
|
|
{
|
|
'matches': {
|
|
1: 'support.attribute'
|
|
},
|
|
'pattern': /([a-z-]+)(?=\=)/gi
|
|
},
|
|
{
|
|
'matches': {
|
|
1: 'support.operator',
|
|
2: 'string.quote',
|
|
3: 'string.value',
|
|
4: 'string.quote'
|
|
},
|
|
'pattern': /(=)('|")(.*?)(\2)/g
|
|
},
|
|
{
|
|
'matches': {
|
|
1: 'support.operator',
|
|
2: 'support.value'
|
|
},
|
|
'pattern': /(=)([a-zA-Z\-0-9]*)\b/g
|
|
},
|
|
{
|
|
'matches': {
|
|
1: 'support.attribute'
|
|
},
|
|
'pattern': /\s(\w+)(?=\s|>)(?![\s\S]*<)/g
|
|
}
|
|
], true);
|