~michaelforrest/use-case-mapper/trunk

« back to all changes in this revision

Viewing changes to vendor/rails/railties/guides/files/javascripts/highlighters.js

  • Committer: Richard Lee (Canonical)
  • Date: 2010-10-15 15:17:58 UTC
  • mfrom: (190.1.3 use-case-mapper)
  • Revision ID: richard.lee@canonical.com-20101015151758-wcvmfxrexsongf9d
Merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
CodeHighlighter.addStyle("css", {
2
 
        comment : {
3
 
                exp  : /\/\*[^*]*\*+([^\/][^*]*\*+)*\//
4
 
        },
5
 
        keywords : {
6
 
                exp  : /@\w[\w\s]*/
7
 
        },
8
 
        selectors : {
9
 
                exp  : "([\\w-:\\[.#][^{};>]*)(?={)"
10
 
        },
11
 
        properties : {
12
 
                exp  : "([\\w-]+)(?=\\s*:)"
13
 
        },
14
 
        units : {
15
 
                exp  : /([0-9])(em|en|px|%|pt)\b/,
16
 
                replacement : "$1<span class=\"$0\">$2</span>"
17
 
        },
18
 
        urls : {
19
 
                exp  : /url\([^\)]*\)/
20
 
        }
21
 
 });
22
 
 
23
 
CodeHighlighter.addStyle("ruby",{
24
 
        comment : {
25
 
                exp  : /#[^\n]+/
26
 
        },
27
 
        brackets : {
28
 
                exp  : /\(|\)/
29
 
        },
30
 
        string : {
31
 
                exp  : /'[^']*'|"[^"]*"/
32
 
        },
33
 
        keywords : {
34
 
                exp  : /\b(do|end|self|class|def|if|module|yield|then|else|for|until|unless|while|elsif|case|when|break|retry|redo|rescue|require|raise)\b/
35
 
        },
36
 
        /* Added by Shelly Fisher (shelly@agileevolved.com) */
37
 
        symbol : {
38
 
          exp : /([^:])(:[A-Za-z0-9_!?]+)/
39
 
        },
40
 
        ivar : {
41
 
          exp : /\@[A-Za-z0-9_!?]+/
42
 
        }
43
 
});
44
 
 
45
 
CodeHighlighter.addStyle("html", {
46
 
        comment : {
47
 
                exp: /&lt;!\s*(--([^-]|[\r\n]|-[^-])*--\s*)&gt;/
48
 
        },
49
 
        tag : {
50
 
                exp: /(&lt;\/?)([a-zA-Z1-9]+\s?)/,
51
 
                replacement: "$1<span class=\"$0\">$2</span>"
52
 
        },
53
 
        string : {
54
 
                exp  : /'[^']*'|"[^"]*"/
55
 
        },
56
 
        attribute : {
57
 
                exp: /\b([a-zA-Z-:]+)(=)/,
58
 
                replacement: "<span class=\"$0\">$1</span>$2"
59
 
        },
60
 
        doctype : {
61
 
                exp: /&lt;!DOCTYPE([^&]|&[^g]|&g[^t])*&gt;/
62
 
        }
63
 
});
64
 
 
65
 
CodeHighlighter.addStyle("javascript",{
66
 
        comment : {
67
 
                exp  : /(\/\/[^\n]*(\n|$))|(\/\*[^*]*\*+([^\/][^*]*\*+)*\/)/
68
 
        },
69
 
        brackets : {
70
 
                exp  : /\(|\)/
71
 
        },
72
 
        string : {
73
 
                exp  : /'[^']*'|"[^"]*"/
74
 
        },
75
 
        keywords : {
76
 
                exp  : /\b(arguments|break|case|continue|default|delete|do|else|false|for|function|if|in|instanceof|new|null|return|switch|this|true|typeof|var|void|while|with)\b/
77
 
        },
78
 
        global : {
79
 
                exp  : /\b(toString|valueOf|window|element|prototype|constructor|document|escape|unescape|parseInt|parseFloat|setTimeout|clearTimeout|setInterval|clearInterval|NaN|isNaN|Infinity)\b/
80
 
        }
81
 
});
82
 
 
83
 
CodeHighlighter.addStyle("yaml", {
84
 
        keyword : {
85
 
                exp  : /\/\*[^*]*\*+([^\/][^*]*\*+)*\//
86
 
        },
87
 
        value : {
88
 
                exp  : /@\w[\w\s]*/
89
 
        },
90
 
});