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