Mercurial
comparison .cms/lib/codemirror/mode/stex/test.js @ 0:78edf6b517a0 draft
24.10
author | Coffee CMS <info@coffee-cms.ru> |
---|---|
date | Fri, 11 Oct 2024 22:40:23 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:78edf6b517a0 |
---|---|
1 // CodeMirror, copyright (c) by Marijn Haverbeke and others | |
2 // Distributed under an MIT license: https://codemirror.net/5/LICENSE | |
3 | |
4 (function() { | |
5 var mode = CodeMirror.getMode({tabSize: 4}, "stex"); | |
6 function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); } | |
7 | |
8 MT("word", | |
9 "foo"); | |
10 | |
11 MT("twoWords", | |
12 "foo bar"); | |
13 | |
14 MT("beginEndDocument", | |
15 "[tag \\begin][bracket {][atom document][bracket }]", | |
16 "[tag \\end][bracket {][atom document][bracket }]"); | |
17 | |
18 MT("beginEndEquation", | |
19 "[tag \\begin][bracket {][atom equation][bracket }]", | |
20 " E=mc^2", | |
21 "[tag \\end][bracket {][atom equation][bracket }]"); | |
22 | |
23 MT("beginModule", | |
24 "[tag \\begin][bracket {][atom module][bracket }[[]]]"); | |
25 | |
26 MT("beginModuleId", | |
27 "[tag \\begin][bracket {][atom module][bracket }[[]id=bbt-size[bracket ]]]"); | |
28 | |
29 MT("importModule", | |
30 "[tag \\importmodule][bracket [[][string b-b-t][bracket ]]{][builtin b-b-t][bracket }]"); | |
31 | |
32 MT("importModulePath", | |
33 "[tag \\importmodule][bracket [[][tag \\KWARCslides][bracket {][string dmath/en/cardinality][bracket }]]{][builtin card][bracket }]"); | |
34 | |
35 MT("psForPDF", | |
36 "[tag \\PSforPDF][bracket [[][atom 1][bracket ]]{]#1[bracket }]"); | |
37 | |
38 MT("comment", | |
39 "[comment % foo]"); | |
40 | |
41 MT("tagComment", | |
42 "[tag \\item][comment % bar]"); | |
43 | |
44 MT("commentTag", | |
45 " [comment % \\item]"); | |
46 | |
47 MT("commentLineBreak", | |
48 "[comment %]", | |
49 "foo"); | |
50 | |
51 MT("tagErrorCurly", | |
52 "[tag \\begin][error }][bracket {]"); | |
53 | |
54 MT("tagErrorSquare", | |
55 "[tag \\item][error ]]][bracket {]"); | |
56 | |
57 MT("commentCurly", | |
58 "[comment % }]"); | |
59 | |
60 MT("tagHash", | |
61 "the [tag \\#] key"); | |
62 | |
63 MT("tagNumber", | |
64 "a [tag \\$][atom 5] stetson"); | |
65 | |
66 MT("tagPercent", | |
67 "[atom 100][tag \\%] beef"); | |
68 | |
69 MT("tagAmpersand", | |
70 "L [tag \\&] N"); | |
71 | |
72 MT("tagUnderscore", | |
73 "foo[tag \\_]bar"); | |
74 | |
75 MT("tagBracketOpen", | |
76 "[tag \\emph][bracket {][tag \\{][bracket }]"); | |
77 | |
78 MT("tagBracketClose", | |
79 "[tag \\emph][bracket {][tag \\}][bracket }]"); | |
80 | |
81 MT("tagLetterNumber", | |
82 "section [tag \\S][atom 1]"); | |
83 | |
84 MT("textTagNumber", | |
85 "para [tag \\P][atom 2]"); | |
86 | |
87 MT("thinspace", | |
88 "x[tag \\,]y"); | |
89 | |
90 MT("thickspace", | |
91 "x[tag \\;]y"); | |
92 | |
93 MT("negativeThinspace", | |
94 "x[tag \\!]y"); | |
95 | |
96 MT("periodNotSentence", | |
97 "J.\\ L.\\ is"); | |
98 | |
99 MT("periodSentence", | |
100 "X[tag \\@]. The"); | |
101 | |
102 MT("italicCorrection", | |
103 "[bracket {][tag \\em] If[tag \\/][bracket }] I"); | |
104 | |
105 MT("tagBracket", | |
106 "[tag \\newcommand][bracket {][tag \\pop][bracket }]"); | |
107 | |
108 MT("inlineMathTagFollowedByNumber", | |
109 "[keyword $][tag \\pi][number 2][keyword $]"); | |
110 | |
111 MT("inlineMath", | |
112 "[keyword $][number 3][variable-2 x][tag ^][number 2.45]-[tag \\sqrt][bracket {][tag \\$\\alpha][bracket }] = [number 2][keyword $] other text"); | |
113 | |
114 MT("inlineMathLatexStyle", | |
115 "[keyword \\(][number 3][variable-2 x][tag ^][number 2.45]-[tag \\sqrt][bracket {][tag \\$\\alpha][bracket }] = [number 2][keyword \\)] other text"); | |
116 | |
117 MT("displayMath", | |
118 "More [keyword $$]\t[variable-2 S][tag ^][variable-2 n][tag \\sum] [variable-2 i][keyword $$] other text"); | |
119 | |
120 MT("displayMath environment", | |
121 "[tag \\begin][bracket {][atom equation][bracket }] x [tag \\end][bracket {][atom equation][bracket }] other text"); | |
122 | |
123 MT("displayMath environment with label", | |
124 "[tag \\begin][bracket {][atom equation][bracket }][tag \\label][bracket {][atom eq1][bracket }] x [tag \\end][bracket {][atom equation][bracket }] other text~[tag \\ref][bracket {][atom eq1][bracket }]"); | |
125 | |
126 MT("mathWithComment", | |
127 "[keyword $][variable-2 x] [comment % $]", | |
128 "[variable-2 y][keyword $] other text"); | |
129 | |
130 MT("lineBreakArgument", | |
131 "[tag \\\\][bracket [[][atom 1cm][bracket ]]]"); | |
132 })(); |