fluentd-ui 0.3.12 → 0.3.13

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of fluentd-ui might be problematic. Click here for more details.

Files changed (234) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog +4 -0
  3. data/Gemfile.lock +1 -1
  4. data/app/assets/javascripts/application.js +2 -0
  5. data/app/assets/javascripts/codemirror.js +29 -0
  6. data/app/assets/javascripts/codemirror_fluentd.js +59 -0
  7. data/app/assets/stylesheets/application.css +6 -0
  8. data/app/views/fluentd/settings/edit.html.haml +1 -1
  9. data/app/views/shared/vue/_setting.html.erb +1 -1
  10. data/bower.json +2 -1
  11. data/lib/fluentd-ui/version.rb +1 -1
  12. data/spec/features/source_and_output_spec.rb +16 -6
  13. data/vendor/assets/javascripts/bower/codemirror/.bower.json +29 -0
  14. data/vendor/assets/javascripts/bower/codemirror/AUTHORS +423 -0
  15. data/vendor/assets/javascripts/bower/codemirror/CONTRIBUTING.md +76 -0
  16. data/vendor/assets/javascripts/bower/codemirror/LICENSE +19 -0
  17. data/vendor/assets/javascripts/bower/codemirror/README.md +11 -0
  18. data/vendor/assets/javascripts/bower/codemirror/addon/comment/comment.js +183 -0
  19. data/vendor/assets/javascripts/bower/codemirror/addon/comment/continuecomment.js +85 -0
  20. data/vendor/assets/javascripts/bower/codemirror/addon/dialog/dialog.css +32 -0
  21. data/vendor/assets/javascripts/bower/codemirror/addon/dialog/dialog.js +155 -0
  22. data/vendor/assets/javascripts/bower/codemirror/addon/display/fullscreen.css +6 -0
  23. data/vendor/assets/javascripts/bower/codemirror/addon/display/fullscreen.js +41 -0
  24. data/vendor/assets/javascripts/bower/codemirror/addon/display/panel.js +94 -0
  25. data/vendor/assets/javascripts/bower/codemirror/addon/display/placeholder.js +58 -0
  26. data/vendor/assets/javascripts/bower/codemirror/addon/display/rulers.js +64 -0
  27. data/vendor/assets/javascripts/bower/codemirror/addon/edit/closebrackets.js +159 -0
  28. data/vendor/assets/javascripts/bower/codemirror/addon/edit/closetag.js +159 -0
  29. data/vendor/assets/javascripts/bower/codemirror/addon/edit/continuelist.js +51 -0
  30. data/vendor/assets/javascripts/bower/codemirror/addon/edit/matchbrackets.js +120 -0
  31. data/vendor/assets/javascripts/bower/codemirror/addon/edit/matchtags.js +66 -0
  32. data/vendor/assets/javascripts/bower/codemirror/addon/edit/trailingspace.js +27 -0
  33. data/vendor/assets/javascripts/bower/codemirror/addon/fold/brace-fold.js +105 -0
  34. data/vendor/assets/javascripts/bower/codemirror/addon/fold/comment-fold.js +57 -0
  35. data/vendor/assets/javascripts/bower/codemirror/addon/fold/foldcode.js +145 -0
  36. data/vendor/assets/javascripts/bower/codemirror/addon/fold/foldgutter.css +20 -0
  37. data/vendor/assets/javascripts/bower/codemirror/addon/fold/foldgutter.js +134 -0
  38. data/vendor/assets/javascripts/bower/codemirror/addon/fold/indent-fold.js +44 -0
  39. data/vendor/assets/javascripts/bower/codemirror/addon/fold/markdown-fold.js +49 -0
  40. data/vendor/assets/javascripts/bower/codemirror/addon/fold/xml-fold.js +182 -0
  41. data/vendor/assets/javascripts/bower/codemirror/addon/hint/anyword-hint.js +41 -0
  42. data/vendor/assets/javascripts/bower/codemirror/addon/hint/css-hint.js +56 -0
  43. data/vendor/assets/javascripts/bower/codemirror/addon/hint/html-hint.js +348 -0
  44. data/vendor/assets/javascripts/bower/codemirror/addon/hint/javascript-hint.js +146 -0
  45. data/vendor/assets/javascripts/bower/codemirror/addon/hint/show-hint.css +38 -0
  46. data/vendor/assets/javascripts/bower/codemirror/addon/hint/show-hint.js +389 -0
  47. data/vendor/assets/javascripts/bower/codemirror/addon/hint/sql-hint.js +197 -0
  48. data/vendor/assets/javascripts/bower/codemirror/addon/hint/xml-hint.js +110 -0
  49. data/vendor/assets/javascripts/bower/codemirror/addon/lint/coffeescript-lint.js +41 -0
  50. data/vendor/assets/javascripts/bower/codemirror/addon/lint/css-lint.js +35 -0
  51. data/vendor/assets/javascripts/bower/codemirror/addon/lint/javascript-lint.js +136 -0
  52. data/vendor/assets/javascripts/bower/codemirror/addon/lint/json-lint.js +31 -0
  53. data/vendor/assets/javascripts/bower/codemirror/addon/lint/lint.css +73 -0
  54. data/vendor/assets/javascripts/bower/codemirror/addon/lint/lint.js +204 -0
  55. data/vendor/assets/javascripts/bower/codemirror/addon/lint/yaml-lint.js +28 -0
  56. data/vendor/assets/javascripts/bower/codemirror/addon/merge/merge.css +112 -0
  57. data/vendor/assets/javascripts/bower/codemirror/addon/merge/merge.js +643 -0
  58. data/vendor/assets/javascripts/bower/codemirror/addon/mode/loadmode.js +64 -0
  59. data/vendor/assets/javascripts/bower/codemirror/addon/mode/multiplex.js +118 -0
  60. data/vendor/assets/javascripts/bower/codemirror/addon/mode/multiplex_test.js +33 -0
  61. data/vendor/assets/javascripts/bower/codemirror/addon/mode/overlay.js +85 -0
  62. data/vendor/assets/javascripts/bower/codemirror/addon/mode/simple.js +213 -0
  63. data/vendor/assets/javascripts/bower/codemirror/addon/runmode/colorize.js +40 -0
  64. data/vendor/assets/javascripts/bower/codemirror/addon/runmode/runmode-standalone.js +157 -0
  65. data/vendor/assets/javascripts/bower/codemirror/addon/runmode/runmode.js +72 -0
  66. data/vendor/assets/javascripts/bower/codemirror/addon/runmode/runmode.node.js +120 -0
  67. data/vendor/assets/javascripts/bower/codemirror/addon/scroll/annotatescrollbar.js +76 -0
  68. data/vendor/assets/javascripts/bower/codemirror/addon/scroll/scrollpastend.js +46 -0
  69. data/vendor/assets/javascripts/bower/codemirror/addon/scroll/simplescrollbars.css +66 -0
  70. data/vendor/assets/javascripts/bower/codemirror/addon/scroll/simplescrollbars.js +139 -0
  71. data/vendor/assets/javascripts/bower/codemirror/addon/search/match-highlighter.js +128 -0
  72. data/vendor/assets/javascripts/bower/codemirror/addon/search/matchesonscrollbar.css +8 -0
  73. data/vendor/assets/javascripts/bower/codemirror/addon/search/matchesonscrollbar.js +90 -0
  74. data/vendor/assets/javascripts/bower/codemirror/addon/search/search.js +164 -0
  75. data/vendor/assets/javascripts/bower/codemirror/addon/search/searchcursor.js +189 -0
  76. data/vendor/assets/javascripts/bower/codemirror/addon/selection/active-line.js +71 -0
  77. data/vendor/assets/javascripts/bower/codemirror/addon/selection/mark-selection.js +118 -0
  78. data/vendor/assets/javascripts/bower/codemirror/addon/tern/tern.css +86 -0
  79. data/vendor/assets/javascripts/bower/codemirror/addon/tern/tern.js +670 -0
  80. data/vendor/assets/javascripts/bower/codemirror/addon/tern/worker.js +44 -0
  81. data/vendor/assets/javascripts/bower/codemirror/addon/wrap/hardwrap.js +139 -0
  82. data/vendor/assets/javascripts/bower/codemirror/bower.json +16 -0
  83. data/vendor/assets/javascripts/bower/codemirror/keymap/emacs.js +411 -0
  84. data/vendor/assets/javascripts/bower/codemirror/keymap/sublime.js +540 -0
  85. data/vendor/assets/javascripts/bower/codemirror/keymap/vim.js +4901 -0
  86. data/vendor/assets/javascripts/bower/codemirror/lib/codemirror.css +309 -0
  87. data/vendor/assets/javascripts/bower/codemirror/lib/codemirror.js +8029 -0
  88. data/vendor/assets/javascripts/bower/codemirror/mode/apl/apl.js +175 -0
  89. data/vendor/assets/javascripts/bower/codemirror/mode/asterisk/asterisk.js +198 -0
  90. data/vendor/assets/javascripts/bower/codemirror/mode/clike/clike.js +489 -0
  91. data/vendor/assets/javascripts/bower/codemirror/mode/clike/scala.html +767 -0
  92. data/vendor/assets/javascripts/bower/codemirror/mode/clojure/clojure.js +243 -0
  93. data/vendor/assets/javascripts/bower/codemirror/mode/cobol/cobol.js +255 -0
  94. data/vendor/assets/javascripts/bower/codemirror/mode/coffeescript/coffeescript.js +369 -0
  95. data/vendor/assets/javascripts/bower/codemirror/mode/commonlisp/commonlisp.js +122 -0
  96. data/vendor/assets/javascripts/bower/codemirror/mode/css/css.js +717 -0
  97. data/vendor/assets/javascripts/bower/codemirror/mode/css/less.html +152 -0
  98. data/vendor/assets/javascripts/bower/codemirror/mode/css/less_test.js +51 -0
  99. data/vendor/assets/javascripts/bower/codemirror/mode/css/scss.html +157 -0
  100. data/vendor/assets/javascripts/bower/codemirror/mode/css/scss_test.js +110 -0
  101. data/vendor/assets/javascripts/bower/codemirror/mode/css/test.js +135 -0
  102. data/vendor/assets/javascripts/bower/codemirror/mode/cypher/cypher.js +146 -0
  103. data/vendor/assets/javascripts/bower/codemirror/mode/d/d.js +218 -0
  104. data/vendor/assets/javascripts/bower/codemirror/mode/dart/dart.js +50 -0
  105. data/vendor/assets/javascripts/bower/codemirror/mode/diff/diff.js +47 -0
  106. data/vendor/assets/javascripts/bower/codemirror/mode/django/django.js +67 -0
  107. data/vendor/assets/javascripts/bower/codemirror/mode/dockerfile/dockerfile.js +76 -0
  108. data/vendor/assets/javascripts/bower/codemirror/mode/dtd/dtd.js +142 -0
  109. data/vendor/assets/javascripts/bower/codemirror/mode/dylan/dylan.js +299 -0
  110. data/vendor/assets/javascripts/bower/codemirror/mode/ebnf/ebnf.js +195 -0
  111. data/vendor/assets/javascripts/bower/codemirror/mode/ecl/ecl.js +207 -0
  112. data/vendor/assets/javascripts/bower/codemirror/mode/eiffel/eiffel.js +162 -0
  113. data/vendor/assets/javascripts/bower/codemirror/mode/erlang/erlang.js +622 -0
  114. data/vendor/assets/javascripts/bower/codemirror/mode/fortran/fortran.js +188 -0
  115. data/vendor/assets/javascripts/bower/codemirror/mode/gas/gas.js +345 -0
  116. data/vendor/assets/javascripts/bower/codemirror/mode/gfm/gfm.js +123 -0
  117. data/vendor/assets/javascripts/bower/codemirror/mode/gfm/test.js +213 -0
  118. data/vendor/assets/javascripts/bower/codemirror/mode/gherkin/gherkin.js +178 -0
  119. data/vendor/assets/javascripts/bower/codemirror/mode/go/go.js +184 -0
  120. data/vendor/assets/javascripts/bower/codemirror/mode/groovy/groovy.js +226 -0
  121. data/vendor/assets/javascripts/bower/codemirror/mode/haml/haml.js +159 -0
  122. data/vendor/assets/javascripts/bower/codemirror/mode/haml/test.js +97 -0
  123. data/vendor/assets/javascripts/bower/codemirror/mode/haskell/haskell.js +267 -0
  124. data/vendor/assets/javascripts/bower/codemirror/mode/haxe/haxe.js +518 -0
  125. data/vendor/assets/javascripts/bower/codemirror/mode/htmlembedded/htmlembedded.js +86 -0
  126. data/vendor/assets/javascripts/bower/codemirror/mode/htmlmixed/htmlmixed.js +121 -0
  127. data/vendor/assets/javascripts/bower/codemirror/mode/http/http.js +113 -0
  128. data/vendor/assets/javascripts/bower/codemirror/mode/idl/idl.js +290 -0
  129. data/vendor/assets/javascripts/bower/codemirror/mode/jade/jade.js +590 -0
  130. data/vendor/assets/javascripts/bower/codemirror/mode/javascript/javascript.js +686 -0
  131. data/vendor/assets/javascripts/bower/codemirror/mode/javascript/json-ld.html +72 -0
  132. data/vendor/assets/javascripts/bower/codemirror/mode/javascript/test.js +200 -0
  133. data/vendor/assets/javascripts/bower/codemirror/mode/javascript/typescript.html +61 -0
  134. data/vendor/assets/javascripts/bower/codemirror/mode/jinja2/jinja2.js +142 -0
  135. data/vendor/assets/javascripts/bower/codemirror/mode/julia/julia.js +301 -0
  136. data/vendor/assets/javascripts/bower/codemirror/mode/kotlin/kotlin.js +280 -0
  137. data/vendor/assets/javascripts/bower/codemirror/mode/livescript/livescript.js +280 -0
  138. data/vendor/assets/javascripts/bower/codemirror/mode/lua/lua.js +159 -0
  139. data/vendor/assets/javascripts/bower/codemirror/mode/markdown/markdown.js +765 -0
  140. data/vendor/assets/javascripts/bower/codemirror/mode/markdown/test.js +754 -0
  141. data/vendor/assets/javascripts/bower/codemirror/mode/meta.js +165 -0
  142. data/vendor/assets/javascripts/bower/codemirror/mode/mirc/mirc.js +193 -0
  143. data/vendor/assets/javascripts/bower/codemirror/mode/mllike/mllike.js +205 -0
  144. data/vendor/assets/javascripts/bower/codemirror/mode/modelica/modelica.js +245 -0
  145. data/vendor/assets/javascripts/bower/codemirror/mode/nginx/nginx.js +178 -0
  146. data/vendor/assets/javascripts/bower/codemirror/mode/ntriples/ntriples.js +186 -0
  147. data/vendor/assets/javascripts/bower/codemirror/mode/octave/octave.js +135 -0
  148. data/vendor/assets/javascripts/bower/codemirror/mode/pascal/pascal.js +109 -0
  149. data/vendor/assets/javascripts/bower/codemirror/mode/pegjs/pegjs.js +114 -0
  150. data/vendor/assets/javascripts/bower/codemirror/mode/perl/perl.js +832 -0
  151. data/vendor/assets/javascripts/bower/codemirror/mode/php/php.js +226 -0
  152. data/vendor/assets/javascripts/bower/codemirror/mode/php/test.js +154 -0
  153. data/vendor/assets/javascripts/bower/codemirror/mode/pig/pig.js +188 -0
  154. data/vendor/assets/javascripts/bower/codemirror/mode/properties/properties.js +78 -0
  155. data/vendor/assets/javascripts/bower/codemirror/mode/puppet/puppet.js +220 -0
  156. data/vendor/assets/javascripts/bower/codemirror/mode/python/python.js +359 -0
  157. data/vendor/assets/javascripts/bower/codemirror/mode/q/q.js +139 -0
  158. data/vendor/assets/javascripts/bower/codemirror/mode/r/r.js +162 -0
  159. data/vendor/assets/javascripts/bower/codemirror/mode/rpm/rpm.js +101 -0
  160. data/vendor/assets/javascripts/bower/codemirror/mode/rst/rst.js +557 -0
  161. data/vendor/assets/javascripts/bower/codemirror/mode/ruby/ruby.js +285 -0
  162. data/vendor/assets/javascripts/bower/codemirror/mode/ruby/test.js +14 -0
  163. data/vendor/assets/javascripts/bower/codemirror/mode/rust/rust.js +451 -0
  164. data/vendor/assets/javascripts/bower/codemirror/mode/sass/sass.js +327 -0
  165. data/vendor/assets/javascripts/bower/codemirror/mode/scheme/scheme.js +248 -0
  166. data/vendor/assets/javascripts/bower/codemirror/mode/shell/shell.js +139 -0
  167. data/vendor/assets/javascripts/bower/codemirror/mode/shell/test.js +58 -0
  168. data/vendor/assets/javascripts/bower/codemirror/mode/sieve/sieve.js +193 -0
  169. data/vendor/assets/javascripts/bower/codemirror/mode/slim/slim.js +575 -0
  170. data/vendor/assets/javascripts/bower/codemirror/mode/slim/test.js +96 -0
  171. data/vendor/assets/javascripts/bower/codemirror/mode/smalltalk/smalltalk.js +168 -0
  172. data/vendor/assets/javascripts/bower/codemirror/mode/smarty/smarty.js +221 -0
  173. data/vendor/assets/javascripts/bower/codemirror/mode/smartymixed/smartymixed.js +197 -0
  174. data/vendor/assets/javascripts/bower/codemirror/mode/solr/solr.js +104 -0
  175. data/vendor/assets/javascripts/bower/codemirror/mode/soy/soy.js +198 -0
  176. data/vendor/assets/javascripts/bower/codemirror/mode/sparql/sparql.js +174 -0
  177. data/vendor/assets/javascripts/bower/codemirror/mode/spreadsheet/spreadsheet.js +109 -0
  178. data/vendor/assets/javascripts/bower/codemirror/mode/sql/sql.js +391 -0
  179. data/vendor/assets/javascripts/bower/codemirror/mode/stex/stex.js +251 -0
  180. data/vendor/assets/javascripts/bower/codemirror/mode/stex/test.js +123 -0
  181. data/vendor/assets/javascripts/bower/codemirror/mode/tcl/tcl.js +147 -0
  182. data/vendor/assets/javascripts/bower/codemirror/mode/textile/test.js +417 -0
  183. data/vendor/assets/javascripts/bower/codemirror/mode/textile/textile.js +469 -0
  184. data/vendor/assets/javascripts/bower/codemirror/mode/tiddlywiki/tiddlywiki.css +14 -0
  185. data/vendor/assets/javascripts/bower/codemirror/mode/tiddlywiki/tiddlywiki.js +369 -0
  186. data/vendor/assets/javascripts/bower/codemirror/mode/tiki/tiki.css +26 -0
  187. data/vendor/assets/javascripts/bower/codemirror/mode/tiki/tiki.js +323 -0
  188. data/vendor/assets/javascripts/bower/codemirror/mode/toml/toml.js +88 -0
  189. data/vendor/assets/javascripts/bower/codemirror/mode/tornado/tornado.js +68 -0
  190. data/vendor/assets/javascripts/bower/codemirror/mode/turtle/turtle.js +162 -0
  191. data/vendor/assets/javascripts/bower/codemirror/mode/vb/vb.js +274 -0
  192. data/vendor/assets/javascripts/bower/codemirror/mode/vbscript/vbscript.js +350 -0
  193. data/vendor/assets/javascripts/bower/codemirror/mode/velocity/velocity.js +201 -0
  194. data/vendor/assets/javascripts/bower/codemirror/mode/verilog/test.js +273 -0
  195. data/vendor/assets/javascripts/bower/codemirror/mode/verilog/verilog.js +364 -0
  196. data/vendor/assets/javascripts/bower/codemirror/mode/xml/test.js +51 -0
  197. data/vendor/assets/javascripts/bower/codemirror/mode/xml/xml.js +384 -0
  198. data/vendor/assets/javascripts/bower/codemirror/mode/xquery/test.js +67 -0
  199. data/vendor/assets/javascripts/bower/codemirror/mode/xquery/xquery.js +447 -0
  200. data/vendor/assets/javascripts/bower/codemirror/mode/yaml/yaml.js +117 -0
  201. data/vendor/assets/javascripts/bower/codemirror/mode/z80/z80.js +100 -0
  202. data/vendor/assets/javascripts/bower/codemirror/theme/3024-day.css +38 -0
  203. data/vendor/assets/javascripts/bower/codemirror/theme/3024-night.css +37 -0
  204. data/vendor/assets/javascripts/bower/codemirror/theme/ambiance-mobile.css +5 -0
  205. data/vendor/assets/javascripts/bower/codemirror/theme/ambiance.css +77 -0
  206. data/vendor/assets/javascripts/bower/codemirror/theme/base16-dark.css +36 -0
  207. data/vendor/assets/javascripts/bower/codemirror/theme/base16-light.css +36 -0
  208. data/vendor/assets/javascripts/bower/codemirror/theme/blackboard.css +30 -0
  209. data/vendor/assets/javascripts/bower/codemirror/theme/cobalt.css +23 -0
  210. data/vendor/assets/javascripts/bower/codemirror/theme/eclipse.css +23 -0
  211. data/vendor/assets/javascripts/bower/codemirror/theme/elegant.css +13 -0
  212. data/vendor/assets/javascripts/bower/codemirror/theme/erlang-dark.css +32 -0
  213. data/vendor/assets/javascripts/bower/codemirror/theme/lesser-dark.css +45 -0
  214. data/vendor/assets/javascripts/bower/codemirror/theme/mbo.css +35 -0
  215. data/vendor/assets/javascripts/bower/codemirror/theme/mdn-like.css +44 -0
  216. data/vendor/assets/javascripts/bower/codemirror/theme/midnight.css +45 -0
  217. data/vendor/assets/javascripts/bower/codemirror/theme/monokai.css +31 -0
  218. data/vendor/assets/javascripts/bower/codemirror/theme/neat.css +12 -0
  219. data/vendor/assets/javascripts/bower/codemirror/theme/neo.css +43 -0
  220. data/vendor/assets/javascripts/bower/codemirror/theme/night.css +26 -0
  221. data/vendor/assets/javascripts/bower/codemirror/theme/paraiso-dark.css +36 -0
  222. data/vendor/assets/javascripts/bower/codemirror/theme/paraiso-light.css +36 -0
  223. data/vendor/assets/javascripts/bower/codemirror/theme/pastel-on-dark.css +50 -0
  224. data/vendor/assets/javascripts/bower/codemirror/theme/rubyblue.css +23 -0
  225. data/vendor/assets/javascripts/bower/codemirror/theme/solarized.css +165 -0
  226. data/vendor/assets/javascripts/bower/codemirror/theme/the-matrix.css +28 -0
  227. data/vendor/assets/javascripts/bower/codemirror/theme/tomorrow-night-bright.css +35 -0
  228. data/vendor/assets/javascripts/bower/codemirror/theme/tomorrow-night-eighties.css +36 -0
  229. data/vendor/assets/javascripts/bower/codemirror/theme/twilight.css +30 -0
  230. data/vendor/assets/javascripts/bower/codemirror/theme/vibrant-ink.css +32 -0
  231. data/vendor/assets/javascripts/bower/codemirror/theme/xq-dark.css +51 -0
  232. data/vendor/assets/javascripts/bower/codemirror/theme/xq-light.css +43 -0
  233. data/vendor/assets/javascripts/bower/codemirror/theme/zenburn.css +37 -0
  234. metadata +225 -2
@@ -0,0 +1,251 @@
1
+ // CodeMirror, copyright (c) by Marijn Haverbeke and others
2
+ // Distributed under an MIT license: http://codemirror.net/LICENSE
3
+
4
+ /*
5
+ * Author: Constantin Jucovschi (c.jucovschi@jacobs-university.de)
6
+ * Licence: MIT
7
+ */
8
+
9
+ (function(mod) {
10
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
11
+ mod(require("../../lib/codemirror"));
12
+ else if (typeof define == "function" && define.amd) // AMD
13
+ define(["../../lib/codemirror"], mod);
14
+ else // Plain browser env
15
+ mod(CodeMirror);
16
+ })(function(CodeMirror) {
17
+ "use strict";
18
+
19
+ CodeMirror.defineMode("stex", function() {
20
+ "use strict";
21
+
22
+ function pushCommand(state, command) {
23
+ state.cmdState.push(command);
24
+ }
25
+
26
+ function peekCommand(state) {
27
+ if (state.cmdState.length > 0) {
28
+ return state.cmdState[state.cmdState.length - 1];
29
+ } else {
30
+ return null;
31
+ }
32
+ }
33
+
34
+ function popCommand(state) {
35
+ var plug = state.cmdState.pop();
36
+ if (plug) {
37
+ plug.closeBracket();
38
+ }
39
+ }
40
+
41
+ // returns the non-default plugin closest to the end of the list
42
+ function getMostPowerful(state) {
43
+ var context = state.cmdState;
44
+ for (var i = context.length - 1; i >= 0; i--) {
45
+ var plug = context[i];
46
+ if (plug.name == "DEFAULT") {
47
+ continue;
48
+ }
49
+ return plug;
50
+ }
51
+ return { styleIdentifier: function() { return null; } };
52
+ }
53
+
54
+ function addPluginPattern(pluginName, cmdStyle, styles) {
55
+ return function () {
56
+ this.name = pluginName;
57
+ this.bracketNo = 0;
58
+ this.style = cmdStyle;
59
+ this.styles = styles;
60
+ this.argument = null; // \begin and \end have arguments that follow. These are stored in the plugin
61
+
62
+ this.styleIdentifier = function() {
63
+ return this.styles[this.bracketNo - 1] || null;
64
+ };
65
+ this.openBracket = function() {
66
+ this.bracketNo++;
67
+ return "bracket";
68
+ };
69
+ this.closeBracket = function() {};
70
+ };
71
+ }
72
+
73
+ var plugins = {};
74
+
75
+ plugins["importmodule"] = addPluginPattern("importmodule", "tag", ["string", "builtin"]);
76
+ plugins["documentclass"] = addPluginPattern("documentclass", "tag", ["", "atom"]);
77
+ plugins["usepackage"] = addPluginPattern("usepackage", "tag", ["atom"]);
78
+ plugins["begin"] = addPluginPattern("begin", "tag", ["atom"]);
79
+ plugins["end"] = addPluginPattern("end", "tag", ["atom"]);
80
+
81
+ plugins["DEFAULT"] = function () {
82
+ this.name = "DEFAULT";
83
+ this.style = "tag";
84
+
85
+ this.styleIdentifier = this.openBracket = this.closeBracket = function() {};
86
+ };
87
+
88
+ function setState(state, f) {
89
+ state.f = f;
90
+ }
91
+
92
+ // called when in a normal (no environment) context
93
+ function normal(source, state) {
94
+ var plug;
95
+ // Do we look like '\command' ? If so, attempt to apply the plugin 'command'
96
+ if (source.match(/^\\[a-zA-Z@]+/)) {
97
+ var cmdName = source.current().slice(1);
98
+ plug = plugins[cmdName] || plugins["DEFAULT"];
99
+ plug = new plug();
100
+ pushCommand(state, plug);
101
+ setState(state, beginParams);
102
+ return plug.style;
103
+ }
104
+
105
+ // escape characters
106
+ if (source.match(/^\\[$&%#{}_]/)) {
107
+ return "tag";
108
+ }
109
+
110
+ // white space control characters
111
+ if (source.match(/^\\[,;!\/\\]/)) {
112
+ return "tag";
113
+ }
114
+
115
+ // find if we're starting various math modes
116
+ if (source.match("\\[")) {
117
+ setState(state, function(source, state){ return inMathMode(source, state, "\\]"); });
118
+ return "keyword";
119
+ }
120
+ if (source.match("$$")) {
121
+ setState(state, function(source, state){ return inMathMode(source, state, "$$"); });
122
+ return "keyword";
123
+ }
124
+ if (source.match("$")) {
125
+ setState(state, function(source, state){ return inMathMode(source, state, "$"); });
126
+ return "keyword";
127
+ }
128
+
129
+ var ch = source.next();
130
+ if (ch == "%") {
131
+ source.skipToEnd();
132
+ return "comment";
133
+ } else if (ch == '}' || ch == ']') {
134
+ plug = peekCommand(state);
135
+ if (plug) {
136
+ plug.closeBracket(ch);
137
+ setState(state, beginParams);
138
+ } else {
139
+ return "error";
140
+ }
141
+ return "bracket";
142
+ } else if (ch == '{' || ch == '[') {
143
+ plug = plugins["DEFAULT"];
144
+ plug = new plug();
145
+ pushCommand(state, plug);
146
+ return "bracket";
147
+ } else if (/\d/.test(ch)) {
148
+ source.eatWhile(/[\w.%]/);
149
+ return "atom";
150
+ } else {
151
+ source.eatWhile(/[\w\-_]/);
152
+ plug = getMostPowerful(state);
153
+ if (plug.name == 'begin') {
154
+ plug.argument = source.current();
155
+ }
156
+ return plug.styleIdentifier();
157
+ }
158
+ }
159
+
160
+ function inMathMode(source, state, endModeSeq) {
161
+ if (source.eatSpace()) {
162
+ return null;
163
+ }
164
+ if (source.match(endModeSeq)) {
165
+ setState(state, normal);
166
+ return "keyword";
167
+ }
168
+ if (source.match(/^\\[a-zA-Z@]+/)) {
169
+ return "tag";
170
+ }
171
+ if (source.match(/^[a-zA-Z]+/)) {
172
+ return "variable-2";
173
+ }
174
+ // escape characters
175
+ if (source.match(/^\\[$&%#{}_]/)) {
176
+ return "tag";
177
+ }
178
+ // white space control characters
179
+ if (source.match(/^\\[,;!\/]/)) {
180
+ return "tag";
181
+ }
182
+ // special math-mode characters
183
+ if (source.match(/^[\^_&]/)) {
184
+ return "tag";
185
+ }
186
+ // non-special characters
187
+ if (source.match(/^[+\-<>|=,\/@!*:;'"`~#?]/)) {
188
+ return null;
189
+ }
190
+ if (source.match(/^(\d+\.\d*|\d*\.\d+|\d+)/)) {
191
+ return "number";
192
+ }
193
+ var ch = source.next();
194
+ if (ch == "{" || ch == "}" || ch == "[" || ch == "]" || ch == "(" || ch == ")") {
195
+ return "bracket";
196
+ }
197
+
198
+ if (ch == "%") {
199
+ source.skipToEnd();
200
+ return "comment";
201
+ }
202
+ return "error";
203
+ }
204
+
205
+ function beginParams(source, state) {
206
+ var ch = source.peek(), lastPlug;
207
+ if (ch == '{' || ch == '[') {
208
+ lastPlug = peekCommand(state);
209
+ lastPlug.openBracket(ch);
210
+ source.eat(ch);
211
+ setState(state, normal);
212
+ return "bracket";
213
+ }
214
+ if (/[ \t\r]/.test(ch)) {
215
+ source.eat(ch);
216
+ return null;
217
+ }
218
+ setState(state, normal);
219
+ popCommand(state);
220
+
221
+ return normal(source, state);
222
+ }
223
+
224
+ return {
225
+ startState: function() {
226
+ return {
227
+ cmdState: [],
228
+ f: normal
229
+ };
230
+ },
231
+ copyState: function(s) {
232
+ return {
233
+ cmdState: s.cmdState.slice(),
234
+ f: s.f
235
+ };
236
+ },
237
+ token: function(stream, state) {
238
+ return state.f(stream, state);
239
+ },
240
+ blankLine: function(state) {
241
+ state.f = normal;
242
+ state.cmdState.length = 0;
243
+ },
244
+ lineComment: "%"
245
+ };
246
+ });
247
+
248
+ CodeMirror.defineMIME("text/x-stex", "stex");
249
+ CodeMirror.defineMIME("text/x-latex", "stex");
250
+
251
+ });
@@ -0,0 +1,123 @@
1
+ // CodeMirror, copyright (c) by Marijn Haverbeke and others
2
+ // Distributed under an MIT license: http://codemirror.net/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("displayMath",
115
+ "More [keyword $$]\t[variable-2 S][tag ^][variable-2 n][tag \\sum] [variable-2 i][keyword $$] other text");
116
+
117
+ MT("mathWithComment",
118
+ "[keyword $][variable-2 x] [comment % $]",
119
+ "[variable-2 y][keyword $] other text");
120
+
121
+ MT("lineBreakArgument",
122
+ "[tag \\\\][bracket [[][atom 1cm][bracket ]]]");
123
+ })();
@@ -0,0 +1,147 @@
1
+ // CodeMirror, copyright (c) by Marijn Haverbeke and others
2
+ // Distributed under an MIT license: http://codemirror.net/LICENSE
3
+
4
+ //tcl mode by Ford_Lawnmower :: Based on Velocity mode by Steve O'Hara
5
+
6
+ (function(mod) {
7
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
8
+ mod(require("../../lib/codemirror"));
9
+ else if (typeof define == "function" && define.amd) // AMD
10
+ define(["../../lib/codemirror"], mod);
11
+ else // Plain browser env
12
+ mod(CodeMirror);
13
+ })(function(CodeMirror) {
14
+ "use strict";
15
+
16
+ CodeMirror.defineMode("tcl", function() {
17
+ function parseWords(str) {
18
+ var obj = {}, words = str.split(" ");
19
+ for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
20
+ return obj;
21
+ }
22
+ var keywords = parseWords("Tcl safe after append array auto_execok auto_import auto_load " +
23
+ "auto_mkindex auto_mkindex_old auto_qualify auto_reset bgerror " +
24
+ "binary break catch cd close concat continue dde eof encoding error " +
25
+ "eval exec exit expr fblocked fconfigure fcopy file fileevent filename " +
26
+ "filename flush for foreach format gets glob global history http if " +
27
+ "incr info interp join lappend lindex linsert list llength load lrange " +
28
+ "lreplace lsearch lset lsort memory msgcat namespace open package parray " +
29
+ "pid pkg::create pkg_mkIndex proc puts pwd re_syntax read regex regexp " +
30
+ "registry regsub rename resource return scan seek set socket source split " +
31
+ "string subst switch tcl_endOfWord tcl_findLibrary tcl_startOfNextWord " +
32
+ "tcl_wordBreakAfter tcl_startOfPreviousWord tcl_wordBreakBefore tcltest " +
33
+ "tclvars tell time trace unknown unset update uplevel upvar variable " +
34
+ "vwait");
35
+ var functions = parseWords("if elseif else and not or eq ne in ni for foreach while switch");
36
+ var isOperatorChar = /[+\-*&%=<>!?^\/\|]/;
37
+ function chain(stream, state, f) {
38
+ state.tokenize = f;
39
+ return f(stream, state);
40
+ }
41
+ function tokenBase(stream, state) {
42
+ var beforeParams = state.beforeParams;
43
+ state.beforeParams = false;
44
+ var ch = stream.next();
45
+ if ((ch == '"' || ch == "'") && state.inParams)
46
+ return chain(stream, state, tokenString(ch));
47
+ else if (/[\[\]{}\(\),;\.]/.test(ch)) {
48
+ if (ch == "(" && beforeParams) state.inParams = true;
49
+ else if (ch == ")") state.inParams = false;
50
+ return null;
51
+ }
52
+ else if (/\d/.test(ch)) {
53
+ stream.eatWhile(/[\w\.]/);
54
+ return "number";
55
+ }
56
+ else if (ch == "#" && stream.eat("*")) {
57
+ return chain(stream, state, tokenComment);
58
+ }
59
+ else if (ch == "#" && stream.match(/ *\[ *\[/)) {
60
+ return chain(stream, state, tokenUnparsed);
61
+ }
62
+ else if (ch == "#" && stream.eat("#")) {
63
+ stream.skipToEnd();
64
+ return "comment";
65
+ }
66
+ else if (ch == '"') {
67
+ stream.skipTo(/"/);
68
+ return "comment";
69
+ }
70
+ else if (ch == "$") {
71
+ stream.eatWhile(/[$_a-z0-9A-Z\.{:]/);
72
+ stream.eatWhile(/}/);
73
+ state.beforeParams = true;
74
+ return "builtin";
75
+ }
76
+ else if (isOperatorChar.test(ch)) {
77
+ stream.eatWhile(isOperatorChar);
78
+ return "comment";
79
+ }
80
+ else {
81
+ stream.eatWhile(/[\w\$_{}\xa1-\uffff]/);
82
+ var word = stream.current().toLowerCase();
83
+ if (keywords && keywords.propertyIsEnumerable(word))
84
+ return "keyword";
85
+ if (functions && functions.propertyIsEnumerable(word)) {
86
+ state.beforeParams = true;
87
+ return "keyword";
88
+ }
89
+ return null;
90
+ }
91
+ }
92
+ function tokenString(quote) {
93
+ return function(stream, state) {
94
+ var escaped = false, next, end = false;
95
+ while ((next = stream.next()) != null) {
96
+ if (next == quote && !escaped) {
97
+ end = true;
98
+ break;
99
+ }
100
+ escaped = !escaped && next == "\\";
101
+ }
102
+ if (end) state.tokenize = tokenBase;
103
+ return "string";
104
+ };
105
+ }
106
+ function tokenComment(stream, state) {
107
+ var maybeEnd = false, ch;
108
+ while (ch = stream.next()) {
109
+ if (ch == "#" && maybeEnd) {
110
+ state.tokenize = tokenBase;
111
+ break;
112
+ }
113
+ maybeEnd = (ch == "*");
114
+ }
115
+ return "comment";
116
+ }
117
+ function tokenUnparsed(stream, state) {
118
+ var maybeEnd = 0, ch;
119
+ while (ch = stream.next()) {
120
+ if (ch == "#" && maybeEnd == 2) {
121
+ state.tokenize = tokenBase;
122
+ break;
123
+ }
124
+ if (ch == "]")
125
+ maybeEnd++;
126
+ else if (ch != " ")
127
+ maybeEnd = 0;
128
+ }
129
+ return "meta";
130
+ }
131
+ return {
132
+ startState: function() {
133
+ return {
134
+ tokenize: tokenBase,
135
+ beforeParams: false,
136
+ inParams: false
137
+ };
138
+ },
139
+ token: function(stream, state) {
140
+ if (stream.eatSpace()) return null;
141
+ return state.tokenize(stream, state);
142
+ }
143
+ };
144
+ });
145
+ CodeMirror.defineMIME("text/x-tcl", "tcl");
146
+
147
+ });