all repos — NoPaste @ 3e3c433f026c49e04d0efa0f0f39fc688ed32bb1

Resurrected - The PussTheCat.org fork of NoPaste

scripts/CodeMirror/mode/slim/test.js (view raw)

 1// CodeMirror, copyright (c) by Marijn Haverbeke and others
 2// Distributed under an MIT license: https://codemirror.net/LICENSE
 3
 4// Slim Highlighting for CodeMirror copyright (c) HicknHack Software Gmbh
 5
 6(function() {
 7  var mode = CodeMirror.getMode({tabSize: 4, indentUnit: 2}, "slim");
 8  function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
 9
10  // Requires at least one media query
11  MT("elementName",
12     "[tag h1] Hey There");
13
14  MT("oneElementPerLine",
15     "[tag h1] Hey There .h2");
16
17  MT("idShortcut",
18     "[attribute&def #test] Hey There");
19
20  MT("tagWithIdShortcuts",
21     "[tag h1][attribute&def #test] Hey There");
22
23  MT("classShortcut",
24     "[attribute&qualifier .hello] Hey There");
25
26  MT("tagWithIdAndClassShortcuts",
27     "[tag h1][attribute&def #test][attribute&qualifier .hello] Hey There");
28
29  MT("docType",
30     "[keyword doctype] xml");
31
32  MT("comment",
33     "[comment / Hello WORLD]");
34
35  MT("notComment",
36     "[tag h1] This is not a / comment ");
37
38  MT("attributes",
39     "[tag a]([attribute title]=[string \"test\"]) [attribute href]=[string \"link\"]}");
40
41  MT("multiLineAttributes",
42     "[tag a]([attribute title]=[string \"test\"]",
43     "  ) [attribute href]=[string \"link\"]}");
44
45  MT("htmlCode",
46     "[tag&bracket <][tag h1][tag&bracket >]Title[tag&bracket </][tag h1][tag&bracket >]");
47
48  MT("rubyBlock",
49     "[operator&special =][variable-2 @item]");
50
51  MT("selectorRubyBlock",
52     "[tag a][attribute&qualifier .test][operator&special =] [variable-2 @item]");
53
54  MT("nestedRubyBlock",
55      "[tag a]",
56      "  [operator&special =][variable puts] [string \"test\"]");
57
58  MT("multilinePlaintext",
59      "[tag p]",
60      "  | Hello,",
61      "    World");
62
63  MT("multilineRuby",
64      "[tag p]",
65      "  [comment /# this is a comment]",
66      "     [comment and this is a comment too]",
67      "  | Date/Time",
68      "  [operator&special -] [variable now] [operator =] [tag DateTime][operator .][property now]",
69      "  [tag strong][operator&special =] [variable now]",
70      "  [operator&special -] [keyword if] [variable now] [operator >] [tag DateTime][operator .][property parse]([string \"December 31, 2006\"])",
71      "     [operator&special =][string \"Happy\"]",
72      "     [operator&special =][string \"Belated\"]",
73      "     [operator&special =][string \"Birthday\"]");
74
75  MT("multilineComment",
76      "[comment /]",
77      "  [comment Multiline]",
78      "  [comment Comment]");
79
80  MT("hamlAfterRubyTag",
81    "[attribute&qualifier .block]",
82    "  [tag strong][operator&special =] [variable now]",
83    "  [attribute&qualifier .test]",
84    "     [operator&special =][variable now]",
85    "  [attribute&qualifier .right]");
86
87  MT("stretchedRuby",
88     "[operator&special =] [variable puts] [string \"Hello\"],",
89     "   [string \"World\"]");
90
91  MT("interpolationInHashAttribute",
92     "[tag div]{[attribute id] = [string \"]#{[variable test]}[string _]#{[variable ting]}[string \"]} test");
93
94  MT("interpolationInHTMLAttribute",
95     "[tag div]([attribute title]=[string \"]#{[variable test]}[string _]#{[variable ting]()}[string \"]) Test");
96})();