1
|
/*
|
2
|
* CodePress regular expressions for HTML syntax highlighting
|
3
|
*/
|
4
|
|
5
|
Language.syntax = [ // HTML
|
6
|
{
|
7
|
input : /(<[^!]*?>)/g,
|
8
|
output : '<b>$1</b>' // all tags
|
9
|
},{
|
10
|
input : /(<a .*?>|<\/a>)/g,
|
11
|
output : '<a>$1</a>' // links
|
12
|
},{
|
13
|
input : /(<img .*?>)/g,
|
14
|
output : '<big>$1</big>' // images
|
15
|
},{
|
16
|
input : /(<\/?(button|textarea|form|input|select|option|label).*?>)/g,
|
17
|
output : '<u>$1</u>' // forms
|
18
|
},{
|
19
|
input : /(<style.*?>)(.*?)(<\/style>)/g,
|
20
|
output : '<em>$1</em><em>$2</em><em>$3</em>' // style tags
|
21
|
},{
|
22
|
input : /(<script.*?>)(.*?)(<\/script>)/g,
|
23
|
output : '<strong>$1</strong><tt>$2</tt><strong>$3</strong>' // script tags
|
24
|
},{
|
25
|
input : /=(".*?")/g,
|
26
|
output : '=<s>$1</s>' // atributes double quote
|
27
|
},{
|
28
|
input : /=('.*?')/g,
|
29
|
output : '=<s>$1</s>' // atributes single quote
|
30
|
},{
|
31
|
input : /(<!--.*?-->.)/g,
|
32
|
output : '<ins>$1</ins>' // comments
|
33
|
},{
|
34
|
input : /\b(alert|window|document|break|continue|do|for|new|this|void|case|default|else|function|return|typeof|while|if|label|switch|var|with|catch|boolean|int|try|false|throws|null|true|goto)\b/g,
|
35
|
output : '<i>$1</i>' // script reserved words
|
36
|
}
|
37
|
];
|
38
|
|
39
|
Language.snippets = [
|
40
|
{input : 'aref', output : '<a href="$0"></a>' },
|
41
|
{input : 'h1', output : '<h1>$0</h1>' },
|
42
|
{input : 'h2', output : '<h2>$0</h2>' },
|
43
|
{input : 'h3', output : '<h3>$0</h3>' },
|
44
|
{input : 'h4', output : '<h4>$0</h4>' },
|
45
|
{input : 'h5', output : '<h5>$0</h5>' },
|
46
|
{input : 'h6', output : '<h6>$0</h6>' },
|
47
|
{input : 'html', output : '<html>\n\t$0\n</html>' },
|
48
|
{input : 'head', output : '<head>\n\t<meta http-equiv="content-type" content="text/html; charset=utf-8" />\n\t<title>$0</title>\n\t\n</head>' },
|
49
|
{input : 'img', output : '<img src="$0" alt="" />' },
|
50
|
{input : 'input', output : '<input name="$0" id="" type="" value="" />' },
|
51
|
{input : 'label', output : '<label for="$0"></label>' },
|
52
|
{input : 'legend', output : '<legend>\n\t$0\n</legend>' },
|
53
|
{input : 'link', output : '<link rel="stylesheet" href="$0" type="text/css" media="screen" charset="utf-8" />' },
|
54
|
{input : 'base', output : '<base href="$0" />' },
|
55
|
{input : 'body', output : '<body>\n\t$0\n</body>' },
|
56
|
{input : 'css', output : '<link rel="stylesheet" href="$0" type="text/css" media="screen" charset="utf-8" />' },
|
57
|
{input : 'div', output : '<div>\n\t$0\n</div>' },
|
58
|
{input : 'divid', output : '<div id="$0">\n\t\n</div>' },
|
59
|
{input : 'dl', output : '<dl>\n\t<dt>\n\t\t$0\n\t</dt>\n\t<dd></dd>\n</dl>' },
|
60
|
{input : 'fieldset', output : '<fieldset>\n\t$0\n</fieldset>' },
|
61
|
{input : 'form', output : '<form action="$0" method="" name="">\n\t\n</form>' },
|
62
|
{input : 'meta', output : '<meta name="$0" content="" />' },
|
63
|
{input : 'p', output : '<p>$0</p>' },
|
64
|
{input : 'script', output : '<script type="text/javascript" language="javascript" charset="utf-8">\n\t$0\t\n</script>' },
|
65
|
{input : 'scriptsrc', output : '<script src="$0" type="text/javascript" language="javascript" charset="utf-8"></script>' },
|
66
|
{input : 'span', output : '<span>$0</span>' },
|
67
|
{input : 'table', output : '<table border="$0" cellspacing="" cellpadding="">\n\t<tr><th></th></tr>\n\t<tr><td></td></tr>\n</table>' },
|
68
|
{input : 'style', output : '<style type="text/css" media="screen">\n\t$0\n</style>' }
|
69
|
];
|
70
|
|
71
|
Language.complete = [ // Auto complete only for 1 character
|
72
|
{input : '\'',output : '\'$0\'' },
|
73
|
{input : '"', output : '"$0"' },
|
74
|
{input : '(', output : '\($0\)' },
|
75
|
{input : '[', output : '\[$0\]' },
|
76
|
{input : '{', output : '{\n\t$0\n}' }
|
77
|
];
|
78
|
|
79
|
Language.shortcuts = [];
|