premier commit
[bazdig.git] / bazdig / codepress / languages / xsl.js
blobb23d3591ff001235e9ceadb9ea74b27df817aa49
1 /*\r
2  * CodePress regular expressions for XSL syntax highlighting\r
3  * By RJ Bruneel\r
4  */\r
5 \r
6 Language.syntax = [ // XSL\r
7         {\r
8         input : /(<[^!]*?>)/g,\r
9         output : '<b>$1</b>' // all tags\r
10         },{\r
11         input : /(&lt;a.*?&gt;|&lt;\/a&gt;)/g,\r
12         output : '<a>$1</a>' // links\r
13         },{\r
14         input : /(&lt;img .*?&gt;)/g,\r
15         output : '<big>$1</big>' // images\r
16         },{\r
17         input : /(&lt;\/?(button|textarea|form|input|select|option|label).*?&gt;)/g,\r
18         output : '<u>$1</u>' // forms\r
19         },{\r
20         input : /(&lt;style.*?&gt;)(.*?)(&lt;\/style&gt;)/g,\r
21         output : '<em>$1</em><em>$2</em><em>$3</em>' // style tags\r
22         },{\r
23         input : /(&lt;script.*?&gt;)(.*?)(&lt;\/script&gt;)/g,\r
24         output : '<strong>$1</strong><tt>$2</tt><strong>$3</strong>' // script tags\r
25         },{     \r
26         input : /(&lt;xsl.*?&gt;|&lt;\/xsl.*?&gt;)/g,\r
27         output : '<xsl>$1</xsl>' // xsl\r
28         },{\r
29         input : /=(".*?")/g,\r
30         output : '=<s>$1</s>' // atributes double quote\r
31         },{\r
32         input : /=('.*?')/g,\r
33         output : '=<s>$1</s>' // atributes single quote\r
34         },{\r
35         input : /(&lt;!--.*?--&gt.)/g,\r
36         output : '<ins>$1</ins>' // comments \r
37         },{\r
38         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,\r
39         output : '<i>$1</i>' // script reserved words\r
40         }\r
41 ];\r
43 Language.snippets = [\r
44         {input : 'aref', output : '<a href="$0"></a>' },\r
45         {input : 'h1', output : '<h1>$0</h1>' },\r
46         {input : 'h2', output : '<h2>$0</h2>' },\r
47         {input : 'h3', output : '<h3>$0</h3>' },\r
48         {input : 'h4', output : '<h4>$0</h4>' },\r
49         {input : 'h5', output : '<h5>$0</h5>' },\r
50         {input : 'h6', output : '<h6>$0</h6>' },\r
51         {input : 'html', output : '<html>\n\t$0\n</html>' },\r
52         {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>' },\r
53         {input : 'img', output : '<img src="$0" width="" height="" alt="" border="0" />' },\r
54         {input : 'input', output : '<input name="$0" id="" type="" value="" />' },\r
55         {input : 'label', output : '<label for="$0"></label>' },\r
56         {input : 'legend', output : '<legend>\n\t$0\n</legend>' },\r
57         {input : 'link', output : '<link rel="stylesheet" href="$0" type="text/css" media="screen" charset="utf-8" />' },               \r
58         {input : 'base', output : '<base href="$0" />' }, \r
59         {input : 'body', output : '<body>\n\t$0\n</body>' }, \r
60         {input : 'css', output : '<link rel="stylesheet" href="$0" type="text/css" media="screen" charset="utf-8" />' },\r
61         {input : 'div', output : '<div>\n\t$0\n</div>' },\r
62         {input : 'divid', output : '<div id="$0">\n\t\n</div>' },\r
63         {input : 'dl', output : '<dl>\n\t<dt>\n\t\t$0\n\t</dt>\n\t<dd></dd>\n</dl>' },\r
64         {input : 'fieldset', output : '<fieldset>\n\t$0\n</fieldset>' },\r
65         {input : 'form', output : '<form action="$0" method="" name="">\n\t\n</form>' },\r
66         {input : 'meta', output : '<meta name="$0" content="" />' },\r
67         {input : 'p', output : '<p>$0</p>' },\r
68         {input : 'b', output : '<b>$0</b>' },\r
69         {input : 'li', output : '<li>$0</li>' },\r
70         {input : 'ul', output : '<ul>$0</ul>' },\r
71         {input : 'ol', output : '<ol>$0</ol>' },\r
72         {input : 'strong', output : '<strong>$0</strong>' },\r
73         {input : 'br', output : '<br />' },\r
74         {input : 'script', output : '<script type="text/javascript" language="javascript" charset="utf-8">\n\t$0\t\n</script>' },\r
75         {input : 'scriptsrc', output : '<script src="$0" type="text/javascript" language="javascript" charset="utf-8"></script>' },\r
76         {input : 'span', output : '<span>$0</span>' },\r
77         {input : 'table', output : '<table border="$0" cellspacing="" cellpadding="">\n\t<tr><th></th></tr>\n\t<tr><td></td></tr>\n</table>' },\r
78         {input : 'style', output : '<style type="text/css" media="screen">\n\t$0\n</style>' },\r
79         {input : 'xsl:stylesheet', output : '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">' },\r
80         {input : 'xsl:template', output : '<xsl:template>$0</xsl:template>' },\r
81         {input : 'xsl:for-each', output : '<xsl:for-each select="$0"></xsl:for-each>' },\r
82         {input : 'xsl:choose', output : '<xsl:choose>$0<\xsl:choose>' },\r
83         {input : 'xsl:param', output : '<xsl:param name="$0" />' },\r
84         {input : 'xsl:variable', output : '<xsl:variable name="$0"></xsl:variable>' },\r
85         {input : 'xsl:if', output : '<xsl:if test="$0"></xsl:if>' },\r
86         {input : 'xsl:when', output : '<xsl:when test="$0"></xsl:when>' },\r
87         {input : 'xsl:otherwise', output : '<xsl:otherwise>$0</xsl:otherwise>' },\r
88         {input : 'xsl:attribute', output : '<xsl:attribute name="$0"></xsl:attribute>' },\r
89         {input : 'xsl:value-of', output : '<xsl:value-of select="$0"/>' },\r
90         {input : 'xsl:with-param', output : '<xsl:with-param name="$0" select="" />' },\r
91         {input : 'xsl:call-template', output : '<xsl:call-template name="$0">' }\r
93 ];\r
94         \r
95 Language.complete = [ // Auto complete only for 1 character\r
96         {input : '\'',output : '\'$0\'' },\r
97         {input : '"', output : '"$0"' },\r
98         {input : '(', output : '\($0\)' },\r
99         {input : '[', output : '\[$0\]' },\r
100         {input : '{', output : '{\n\t$0\n}' }           \r
101 ];\r
103 Language.shortcuts = [];