codemirror-rails 4.7 → 4.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (26) hide show
  1. checksums.yaml +4 -4
  2. data/lib/codemirror/rails/version.rb +2 -2
  3. data/vendor/assets/javascripts/codemirror.js +229 -137
  4. data/vendor/assets/javascripts/codemirror/addons/edit/closebrackets.js +1 -1
  5. data/vendor/assets/javascripts/codemirror/addons/hint/javascript-hint.js +9 -9
  6. data/vendor/assets/javascripts/codemirror/addons/hint/xml-hint.js +9 -1
  7. data/vendor/assets/javascripts/codemirror/addons/mode/loadmode.js +19 -16
  8. data/vendor/assets/javascripts/codemirror/addons/mode/overlay.js +3 -3
  9. data/vendor/assets/javascripts/codemirror/keymaps/emacs.js +19 -28
  10. data/vendor/assets/javascripts/codemirror/keymaps/sublime.js +14 -15
  11. data/vendor/assets/javascripts/codemirror/keymaps/vim.js +694 -752
  12. data/vendor/assets/javascripts/codemirror/modes/clike.js +15 -0
  13. data/vendor/assets/javascripts/codemirror/modes/css.js +1 -1
  14. data/vendor/assets/javascripts/codemirror/modes/dockerfile.js +80 -0
  15. data/vendor/assets/javascripts/codemirror/modes/gfm.js +2 -1
  16. data/vendor/assets/javascripts/codemirror/modes/htmlmixed.js +2 -2
  17. data/vendor/assets/javascripts/codemirror/modes/idl.js +290 -0
  18. data/vendor/assets/javascripts/codemirror/modes/markdown.js +62 -55
  19. data/vendor/assets/javascripts/codemirror/modes/sparql.js +19 -5
  20. data/vendor/assets/javascripts/codemirror/modes/sql.js +0 -2
  21. data/vendor/assets/javascripts/codemirror/modes/stex.js +184 -193
  22. data/vendor/assets/javascripts/codemirror/modes/yaml.js +6 -1
  23. data/vendor/assets/stylesheets/codemirror.css +11 -2
  24. data/vendor/assets/stylesheets/codemirror/themes/3024-day.css +1 -1
  25. data/vendor/assets/stylesheets/codemirror/themes/solarized.css +0 -5
  26. metadata +3 -1
@@ -471,4 +471,19 @@ CodeMirror.defineMode("clike", function(config, parserConfig) {
471
471
  modeProps: {fold: ["brace", "include"]}
472
472
  });
473
473
 
474
+ def("text/x-objectivec", {
475
+ name: "clike",
476
+ keywords: words(cKeywords + "inline restrict _Bool _Complex _Imaginery BOOL Class bycopy byref id IMP in " +
477
+ "inout nil oneway out Protocol SEL self super atomic nonatomic retain copy readwrite readonly"),
478
+ atoms: words("YES NO NULL NILL ON OFF"),
479
+ hooks: {
480
+ "@": function(stream) {
481
+ stream.eatWhile(/[\w\$]/);
482
+ return "keyword";
483
+ },
484
+ "#": cppHook
485
+ },
486
+ modeProps: {fold: "brace"}
487
+ });
488
+
474
489
  });
@@ -182,7 +182,7 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
182
182
  override = "string-2";
183
183
  return "maybeprop";
184
184
  } else if (allowNested) {
185
- override = stream.match(/^\s*:/, false) ? "property" : "tag";
185
+ override = stream.match(/^\s*:(?:\s|$)/, false) ? "property" : "tag";
186
186
  return "block";
187
187
  } else {
188
188
  override += " error";
@@ -0,0 +1,80 @@
1
+ // CodeMirror, copyright (c) by Marijn Haverbeke and others
2
+ // Distributed under an MIT license: http://codemirror.net/LICENSE
3
+
4
+ (function(mod) {
5
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
6
+ mod(require("../../lib/codemirror"), require("../../addon/mode/simple"));
7
+ else if (typeof define == "function" && define.amd) // AMD
8
+ define(["../../lib/codemirror", "../../addon/mode/simple"], mod);
9
+ else // Plain browser env
10
+ mod(CodeMirror);
11
+ })(function(CodeMirror) {
12
+ "use strict";
13
+
14
+ // Collect all Dockerfile directives
15
+ var instructions = ["from", "maintainer", "run", "cmd", "expose", "env",
16
+ "add", "copy", "entrypoint", "volume", "user",
17
+ "workdir", "onbuild"],
18
+ instructionRegex = "(" + instructions.join('|') + ")",
19
+ instructionOnlyLine = new RegExp(instructionRegex + "\\s*$", "i"),
20
+ instructionWithArguments = new RegExp(instructionRegex + "(\\s+)", "i");
21
+
22
+ CodeMirror.defineSimpleMode("dockerfile", {
23
+ start: [
24
+ // Block comment: This is a line starting with a comment
25
+ {
26
+ regex: /#.*$/,
27
+ token: "comment",
28
+ next: "start"
29
+ },
30
+ // Highlight an instruction without any arguments (for convenience)
31
+ {
32
+ regex: instructionOnlyLine,
33
+ token: "variable-2",
34
+ next: "start"
35
+ },
36
+ // Highlight an instruction followed by arguments
37
+ {
38
+ regex: instructionWithArguments,
39
+ token: ["variable-2", null],
40
+ next: "arguments"
41
+ },
42
+ // Fail-safe return to start
43
+ {
44
+ token: null,
45
+ next: "start"
46
+ }
47
+ ],
48
+ arguments: [
49
+ {
50
+ // Line comment without instruction arguments is an error
51
+ regex: /#.*$/,
52
+ token: "error",
53
+ next: "start"
54
+ },
55
+ {
56
+ regex: /[^#]+\\$/,
57
+ token: null,
58
+ next: "arguments"
59
+ },
60
+ {
61
+ // Match everything except for the inline comment
62
+ regex: /[^#]+/,
63
+ token: null,
64
+ next: "start"
65
+ },
66
+ {
67
+ regex: /$/,
68
+ token: null,
69
+ next: "start"
70
+ },
71
+ // Fail safe return to start
72
+ {
73
+ token: null,
74
+ next: "start"
75
+ }
76
+ ]
77
+ });
78
+
79
+ CodeMirror.defineMIME("text/x-dockerfile", "dockerfile");
80
+ });
@@ -109,7 +109,8 @@ CodeMirror.defineMode("gfm", function(config, modeConfig) {
109
109
  var markdownConfig = {
110
110
  underscoresBreakWords: false,
111
111
  taskLists: true,
112
- fencedCodeBlocks: true
112
+ fencedCodeBlocks: true,
113
+ strikethrough: true
113
114
  };
114
115
  for (var attr in modeConfig) {
115
116
  markdownConfig[attr] = modeConfig[attr];
@@ -69,7 +69,7 @@ CodeMirror.defineMode("htmlmixed", function(config, parserConfig) {
69
69
  if (stream.match(/^<\/\s*script\s*>/i, false)) {
70
70
  state.token = html;
71
71
  state.localState = state.localMode = null;
72
- return html(stream, state);
72
+ return null;
73
73
  }
74
74
  return maybeBackup(stream, /<\/\s*script\s*>/,
75
75
  state.localMode.token(stream, state.localState));
@@ -78,7 +78,7 @@ CodeMirror.defineMode("htmlmixed", function(config, parserConfig) {
78
78
  if (stream.match(/^<\/\s*style\s*>/i, false)) {
79
79
  state.token = html;
80
80
  state.localState = state.localMode = null;
81
- return html(stream, state);
81
+ return null;
82
82
  }
83
83
  return maybeBackup(stream, /<\/\s*style\s*>/,
84
84
  cssMode.token(stream, state.localState));
@@ -0,0 +1,290 @@
1
+ // CodeMirror, copyright (c) by Marijn Haverbeke and others
2
+ // Distributed under an MIT license: http://codemirror.net/LICENSE
3
+
4
+ (function(mod) {
5
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
6
+ mod(require("../../lib/codemirror"));
7
+ else if (typeof define == "function" && define.amd) // AMD
8
+ define(["../../lib/codemirror"], mod);
9
+ else // Plain browser env
10
+ mod(CodeMirror);
11
+ })(function(CodeMirror) {
12
+ "use strict";
13
+
14
+ function wordRegexp(words) {
15
+ return new RegExp('^((' + words.join(')|(') + '))\\b', 'i');
16
+ };
17
+
18
+ var builtinArray = [
19
+ 'a_correlate', 'abs', 'acos', 'adapt_hist_equal', 'alog',
20
+ 'alog2', 'alog10', 'amoeba', 'annotate', 'app_user_dir',
21
+ 'app_user_dir_query', 'arg_present', 'array_equal', 'array_indices',
22
+ 'arrow', 'ascii_template', 'asin', 'assoc', 'atan',
23
+ 'axis', 'axis', 'bandpass_filter', 'bandreject_filter', 'barplot',
24
+ 'bar_plot', 'beseli', 'beselj', 'beselk', 'besely',
25
+ 'beta', 'biginteger', 'bilinear', 'bin_date', 'binary_template',
26
+ 'bindgen', 'binomial', 'bit_ffs', 'bit_population', 'blas_axpy',
27
+ 'blk_con', 'boolarr', 'boolean', 'boxplot', 'box_cursor',
28
+ 'breakpoint', 'broyden', 'bubbleplot', 'butterworth', 'bytarr',
29
+ 'byte', 'byteorder', 'bytscl', 'c_correlate', 'calendar',
30
+ 'caldat', 'call_external', 'call_function', 'call_method',
31
+ 'call_procedure', 'canny', 'catch', 'cd', 'cdf', 'ceil',
32
+ 'chebyshev', 'check_math', 'chisqr_cvf', 'chisqr_pdf', 'choldc',
33
+ 'cholsol', 'cindgen', 'cir_3pnt', 'clipboard', 'close',
34
+ 'clust_wts', 'cluster', 'cluster_tree', 'cmyk_convert', 'code_coverage',
35
+ 'color_convert', 'color_exchange', 'color_quan', 'color_range_map',
36
+ 'colorbar', 'colorize_sample', 'colormap_applicable',
37
+ 'colormap_gradient', 'colormap_rotation', 'colortable',
38
+ 'comfit', 'command_line_args', 'common', 'compile_opt', 'complex',
39
+ 'complexarr', 'complexround', 'compute_mesh_normals', 'cond', 'congrid',
40
+ 'conj', 'constrained_min', 'contour', 'contour', 'convert_coord',
41
+ 'convol', 'convol_fft', 'coord2to3', 'copy_lun', 'correlate',
42
+ 'cos', 'cosh', 'cpu', 'cramer', 'createboxplotdata',
43
+ 'create_cursor', 'create_struct', 'create_view', 'crossp', 'crvlength',
44
+ 'ct_luminance', 'cti_test', 'cursor', 'curvefit', 'cv_coord',
45
+ 'cvttobm', 'cw_animate', 'cw_animate_getp', 'cw_animate_load',
46
+ 'cw_animate_run', 'cw_arcball', 'cw_bgroup', 'cw_clr_index',
47
+ 'cw_colorsel', 'cw_defroi', 'cw_field', 'cw_filesel', 'cw_form',
48
+ 'cw_fslider', 'cw_light_editor', 'cw_light_editor_get',
49
+ 'cw_light_editor_set', 'cw_orient', 'cw_palette_editor',
50
+ 'cw_palette_editor_get', 'cw_palette_editor_set', 'cw_pdmenu',
51
+ 'cw_rgbslider', 'cw_tmpl', 'cw_zoom', 'db_exists',
52
+ 'dblarr', 'dcindgen', 'dcomplex', 'dcomplexarr', 'define_key',
53
+ 'define_msgblk', 'define_msgblk_from_file', 'defroi', 'defsysv',
54
+ 'delvar', 'dendro_plot', 'dendrogram', 'deriv', 'derivsig',
55
+ 'determ', 'device', 'dfpmin', 'diag_matrix', 'dialog_dbconnect',
56
+ 'dialog_message', 'dialog_pickfile', 'dialog_printersetup',
57
+ 'dialog_printjob', 'dialog_read_image',
58
+ 'dialog_write_image', 'dictionary', 'digital_filter', 'dilate', 'dindgen',
59
+ 'dissolve', 'dist', 'distance_measure', 'dlm_load', 'dlm_register',
60
+ 'doc_library', 'double', 'draw_roi', 'edge_dog', 'efont',
61
+ 'eigenql', 'eigenvec', 'ellipse', 'elmhes', 'emboss',
62
+ 'empty', 'enable_sysrtn', 'eof', 'eos', 'erase',
63
+ 'erf', 'erfc', 'erfcx', 'erode', 'errorplot',
64
+ 'errplot', 'estimator_filter', 'execute', 'exit', 'exp',
65
+ 'expand', 'expand_path', 'expint', 'extrac', 'extract_slice',
66
+ 'f_cvf', 'f_pdf', 'factorial', 'fft', 'file_basename',
67
+ 'file_chmod', 'file_copy', 'file_delete', 'file_dirname',
68
+ 'file_expand_path', 'file_gunzip', 'file_gzip', 'file_info',
69
+ 'file_lines', 'file_link', 'file_mkdir', 'file_move',
70
+ 'file_poll_input', 'file_readlink', 'file_same',
71
+ 'file_search', 'file_tar', 'file_test', 'file_untar', 'file_unzip',
72
+ 'file_which', 'file_zip', 'filepath', 'findgen', 'finite',
73
+ 'fix', 'flick', 'float', 'floor', 'flow3',
74
+ 'fltarr', 'flush', 'format_axis_values', 'forward_function', 'free_lun',
75
+ 'fstat', 'fulstr', 'funct', 'function', 'fv_test',
76
+ 'fx_root', 'fz_roots', 'gamma', 'gamma_ct', 'gauss_cvf',
77
+ 'gauss_pdf', 'gauss_smooth', 'gauss2dfit', 'gaussfit',
78
+ 'gaussian_function', 'gaussint', 'get_drive_list', 'get_dxf_objects',
79
+ 'get_kbrd', 'get_login_info',
80
+ 'get_lun', 'get_screen_size', 'getenv', 'getwindows', 'greg2jul',
81
+ 'grib', 'grid_input', 'grid_tps', 'grid3', 'griddata',
82
+ 'gs_iter', 'h_eq_ct', 'h_eq_int', 'hanning', 'hash',
83
+ 'hdf', 'hdf5', 'heap_free', 'heap_gc', 'heap_nosave',
84
+ 'heap_refcount', 'heap_save', 'help', 'hilbert', 'hist_2d',
85
+ 'hist_equal', 'histogram', 'hls', 'hough', 'hqr',
86
+ 'hsv', 'i18n_multibytetoutf8',
87
+ 'i18n_multibytetowidechar', 'i18n_utf8tomultibyte',
88
+ 'i18n_widechartomultibyte',
89
+ 'ibeta', 'icontour', 'iconvertcoord', 'idelete', 'identity',
90
+ 'idl_base64', 'idl_container', 'idl_validname',
91
+ 'idlexbr_assistant', 'idlitsys_createtool',
92
+ 'idlunit', 'iellipse', 'igamma', 'igetcurrent', 'igetdata',
93
+ 'igetid', 'igetproperty', 'iimage', 'image', 'image_cont',
94
+ 'image_statistics', 'image_threshold', 'imaginary', 'imap', 'indgen',
95
+ 'int_2d', 'int_3d', 'int_tabulated', 'intarr', 'interpol',
96
+ 'interpolate', 'interval_volume', 'invert', 'ioctl', 'iopen',
97
+ 'ir_filter', 'iplot', 'ipolygon', 'ipolyline', 'iputdata',
98
+ 'iregister', 'ireset', 'iresolve', 'irotate', 'isa',
99
+ 'isave', 'iscale', 'isetcurrent', 'isetproperty', 'ishft',
100
+ 'isocontour', 'isosurface', 'isurface', 'itext', 'itranslate',
101
+ 'ivector', 'ivolume', 'izoom', 'journal', 'json_parse',
102
+ 'json_serialize', 'jul2greg', 'julday', 'keyword_set', 'krig2d',
103
+ 'kurtosis', 'kw_test', 'l64indgen', 'la_choldc', 'la_cholmprove',
104
+ 'la_cholsol', 'la_determ', 'la_eigenproblem', 'la_eigenql', 'la_eigenvec',
105
+ 'la_elmhes', 'la_gm_linear_model', 'la_hqr', 'la_invert',
106
+ 'la_least_square_equality', 'la_least_squares', 'la_linear_equation',
107
+ 'la_ludc', 'la_lumprove', 'la_lusol',
108
+ 'la_svd', 'la_tridc', 'la_trimprove', 'la_triql', 'la_trired',
109
+ 'la_trisol', 'label_date', 'label_region', 'ladfit', 'laguerre',
110
+ 'lambda', 'lambdap', 'lambertw', 'laplacian', 'least_squares_filter',
111
+ 'leefilt', 'legend', 'legendre', 'linbcg', 'lindgen',
112
+ 'linfit', 'linkimage', 'list', 'll_arc_distance', 'lmfit',
113
+ 'lmgr', 'lngamma', 'lnp_test', 'loadct', 'locale_get',
114
+ 'logical_and', 'logical_or', 'logical_true', 'lon64arr', 'lonarr',
115
+ 'long', 'long64', 'lsode', 'lu_complex', 'ludc',
116
+ 'lumprove', 'lusol', 'm_correlate', 'machar', 'make_array',
117
+ 'make_dll', 'make_rt', 'map', 'mapcontinents', 'mapgrid',
118
+ 'map_2points', 'map_continents', 'map_grid', 'map_image', 'map_patch',
119
+ 'map_proj_forward', 'map_proj_image', 'map_proj_info',
120
+ 'map_proj_init', 'map_proj_inverse',
121
+ 'map_set', 'matrix_multiply', 'matrix_power', 'max', 'md_test',
122
+ 'mean', 'meanabsdev', 'mean_filter', 'median', 'memory',
123
+ 'mesh_clip', 'mesh_decimate', 'mesh_issolid',
124
+ 'mesh_merge', 'mesh_numtriangles',
125
+ 'mesh_obj', 'mesh_smooth', 'mesh_surfacearea',
126
+ 'mesh_validate', 'mesh_volume',
127
+ 'message', 'min', 'min_curve_surf', 'mk_html_help', 'modifyct',
128
+ 'moment', 'morph_close', 'morph_distance',
129
+ 'morph_gradient', 'morph_hitormiss',
130
+ 'morph_open', 'morph_thin', 'morph_tophat', 'multi', 'n_elements',
131
+ 'n_params', 'n_tags', 'ncdf', 'newton', 'noise_hurl',
132
+ 'noise_pick', 'noise_scatter', 'noise_slur', 'norm', 'obj_class',
133
+ 'obj_destroy', 'obj_hasmethod', 'obj_isa', 'obj_new', 'obj_valid',
134
+ 'objarr', 'on_error', 'on_ioerror', 'online_help', 'openr',
135
+ 'openu', 'openw', 'oplot', 'oploterr', 'orderedhash',
136
+ 'p_correlate', 'parse_url', 'particle_trace', 'path_cache', 'path_sep',
137
+ 'pcomp', 'plot', 'plot3d', 'plot', 'plot_3dbox',
138
+ 'plot_field', 'ploterr', 'plots', 'polar_contour', 'polar_surface',
139
+ 'polyfill', 'polyshade', 'pnt_line', 'point_lun', 'polarplot',
140
+ 'poly', 'poly_2d', 'poly_area', 'poly_fit', 'polyfillv',
141
+ 'polygon', 'polyline', 'polywarp', 'popd', 'powell',
142
+ 'pref_commit', 'pref_get', 'pref_set', 'prewitt', 'primes',
143
+ 'print', 'printf', 'printd', 'pro', 'product',
144
+ 'profile', 'profiler', 'profiles', 'project_vol', 'ps_show_fonts',
145
+ 'psafm', 'pseudo', 'ptr_free', 'ptr_new', 'ptr_valid',
146
+ 'ptrarr', 'pushd', 'qgrid3', 'qhull', 'qromb',
147
+ 'qromo', 'qsimp', 'query_*', 'query_ascii', 'query_bmp',
148
+ 'query_csv', 'query_dicom', 'query_gif', 'query_image', 'query_jpeg',
149
+ 'query_jpeg2000', 'query_mrsid', 'query_pict', 'query_png', 'query_ppm',
150
+ 'query_srf', 'query_tiff', 'query_video', 'query_wav', 'r_correlate',
151
+ 'r_test', 'radon', 'randomn', 'randomu', 'ranks',
152
+ 'rdpix', 'read', 'readf', 'read_ascii', 'read_binary',
153
+ 'read_bmp', 'read_csv', 'read_dicom', 'read_gif', 'read_image',
154
+ 'read_interfile', 'read_jpeg', 'read_jpeg2000', 'read_mrsid', 'read_pict',
155
+ 'read_png', 'read_ppm', 'read_spr', 'read_srf', 'read_sylk',
156
+ 'read_tiff', 'read_video', 'read_wav', 'read_wave', 'read_x11_bitmap',
157
+ 'read_xwd', 'reads', 'readu', 'real_part', 'rebin',
158
+ 'recall_commands', 'recon3', 'reduce_colors', 'reform', 'region_grow',
159
+ 'register_cursor', 'regress', 'replicate',
160
+ 'replicate_inplace', 'resolve_all',
161
+ 'resolve_routine', 'restore', 'retall', 'return', 'reverse',
162
+ 'rk4', 'roberts', 'rot', 'rotate', 'round',
163
+ 'routine_filepath', 'routine_info', 'rs_test', 's_test', 'save',
164
+ 'savgol', 'scale3', 'scale3d', 'scatterplot', 'scatterplot3d',
165
+ 'scope_level', 'scope_traceback', 'scope_varfetch',
166
+ 'scope_varname', 'search2d',
167
+ 'search3d', 'sem_create', 'sem_delete', 'sem_lock', 'sem_release',
168
+ 'set_plot', 'set_shading', 'setenv', 'sfit', 'shade_surf',
169
+ 'shade_surf_irr', 'shade_volume', 'shift', 'shift_diff', 'shmdebug',
170
+ 'shmmap', 'shmunmap', 'shmvar', 'show3', 'showfont',
171
+ 'signum', 'simplex', 'sin', 'sindgen', 'sinh',
172
+ 'size', 'skewness', 'skip_lun', 'slicer3', 'slide_image',
173
+ 'smooth', 'sobel', 'socket', 'sort', 'spawn',
174
+ 'sph_4pnt', 'sph_scat', 'spher_harm', 'spl_init', 'spl_interp',
175
+ 'spline', 'spline_p', 'sprsab', 'sprsax', 'sprsin',
176
+ 'sprstp', 'sqrt', 'standardize', 'stddev', 'stop',
177
+ 'strarr', 'strcmp', 'strcompress', 'streamline', 'streamline',
178
+ 'stregex', 'stretch', 'string', 'strjoin', 'strlen',
179
+ 'strlowcase', 'strmatch', 'strmessage', 'strmid', 'strpos',
180
+ 'strput', 'strsplit', 'strtrim', 'struct_assign', 'struct_hide',
181
+ 'strupcase', 'surface', 'surface', 'surfr', 'svdc',
182
+ 'svdfit', 'svsol', 'swap_endian', 'swap_endian_inplace', 'symbol',
183
+ 'systime', 't_cvf', 't_pdf', 't3d', 'tag_names',
184
+ 'tan', 'tanh', 'tek_color', 'temporary', 'terminal_size',
185
+ 'tetra_clip', 'tetra_surface', 'tetra_volume', 'text', 'thin',
186
+ 'thread', 'threed', 'tic', 'time_test2', 'timegen',
187
+ 'timer', 'timestamp', 'timestamptovalues', 'tm_test', 'toc',
188
+ 'total', 'trace', 'transpose', 'tri_surf', 'triangulate',
189
+ 'trigrid', 'triql', 'trired', 'trisol', 'truncate_lun',
190
+ 'ts_coef', 'ts_diff', 'ts_fcast', 'ts_smooth', 'tv',
191
+ 'tvcrs', 'tvlct', 'tvrd', 'tvscl', 'typename',
192
+ 'uindgen', 'uint', 'uintarr', 'ul64indgen', 'ulindgen',
193
+ 'ulon64arr', 'ulonarr', 'ulong', 'ulong64', 'uniq',
194
+ 'unsharp_mask', 'usersym', 'value_locate', 'variance', 'vector',
195
+ 'vector_field', 'vel', 'velovect', 'vert_t3d', 'voigt',
196
+ 'volume', 'voronoi', 'voxel_proj', 'wait', 'warp_tri',
197
+ 'watershed', 'wdelete', 'wf_draw', 'where', 'widget_base',
198
+ 'widget_button', 'widget_combobox', 'widget_control',
199
+ 'widget_displaycontextmenu', 'widget_draw',
200
+ 'widget_droplist', 'widget_event', 'widget_info',
201
+ 'widget_label', 'widget_list',
202
+ 'widget_propertysheet', 'widget_slider', 'widget_tab',
203
+ 'widget_table', 'widget_text',
204
+ 'widget_tree', 'widget_tree_move', 'widget_window',
205
+ 'wiener_filter', 'window',
206
+ 'window', 'write_bmp', 'write_csv', 'write_gif', 'write_image',
207
+ 'write_jpeg', 'write_jpeg2000', 'write_nrif', 'write_pict', 'write_png',
208
+ 'write_ppm', 'write_spr', 'write_srf', 'write_sylk', 'write_tiff',
209
+ 'write_video', 'write_wav', 'write_wave', 'writeu', 'wset',
210
+ 'wshow', 'wtn', 'wv_applet', 'wv_cwt', 'wv_cw_wavelet',
211
+ 'wv_denoise', 'wv_dwt', 'wv_fn_coiflet',
212
+ 'wv_fn_daubechies', 'wv_fn_gaussian',
213
+ 'wv_fn_haar', 'wv_fn_morlet', 'wv_fn_paul',
214
+ 'wv_fn_symlet', 'wv_import_data',
215
+ 'wv_import_wavelet', 'wv_plot3d_wps', 'wv_plot_multires',
216
+ 'wv_pwt', 'wv_tool_denoise',
217
+ 'xbm_edit', 'xdisplayfile', 'xdxf', 'xfont', 'xinteranimate',
218
+ 'xloadct', 'xmanager', 'xmng_tmpl', 'xmtool', 'xobjview',
219
+ 'xobjview_rotate', 'xobjview_write_image',
220
+ 'xpalette', 'xpcolor', 'xplot3d',
221
+ 'xregistered', 'xroi', 'xsq_test', 'xsurface', 'xvaredit',
222
+ 'xvolume', 'xvolume_rotate', 'xvolume_write_image',
223
+ 'xyouts', 'zlib_compress', 'zlib_uncompress', 'zoom', 'zoom_24'
224
+ ];
225
+ var builtins = wordRegexp(builtinArray);
226
+
227
+ var keywordArray = [
228
+ 'begin', 'end', 'endcase', 'endfor',
229
+ 'endwhile', 'endif', 'endrep', 'endforeach',
230
+ 'break', 'case', 'continue', 'for',
231
+ 'foreach', 'goto', 'if', 'then', 'else',
232
+ 'repeat', 'until', 'switch', 'while',
233
+ 'do', 'pro', 'function'
234
+ ];
235
+ var keywords = wordRegexp(keywordArray);
236
+
237
+ CodeMirror.registerHelper("hintWords", "idl", builtinArray.concat(keywordArray));
238
+
239
+ var identifiers = new RegExp('^[_a-z\xa1-\uffff][_a-z0-9\xa1-\uffff]*', 'i');
240
+
241
+ var singleOperators = /[+\-*&=<>\/@#~$]/;
242
+ var boolOperators = new RegExp('(and|or|eq|lt|le|gt|ge|ne|not)', 'i');
243
+
244
+ function tokenBase(stream) {
245
+ // whitespaces
246
+ if (stream.eatSpace()) return null;
247
+
248
+ // Handle one line Comments
249
+ if (stream.match(';')) {
250
+ stream.skipToEnd();
251
+ return 'comment';
252
+ }
253
+
254
+ // Handle Number Literals
255
+ if (stream.match(/^[0-9\.+-]/, false)) {
256
+ if (stream.match(/^[+-]?0x[0-9a-fA-F]+/))
257
+ return 'number';
258
+ if (stream.match(/^[+-]?\d*\.\d+([EeDd][+-]?\d+)?/))
259
+ return 'number';
260
+ if (stream.match(/^[+-]?\d+([EeDd][+-]?\d+)?/))
261
+ return 'number';
262
+ }
263
+
264
+ // Handle Strings
265
+ if (stream.match(/^"([^"]|(""))*"/)) { return 'string'; }
266
+ if (stream.match(/^'([^']|(''))*'/)) { return 'string'; }
267
+
268
+ // Handle words
269
+ if (stream.match(keywords)) { return 'keyword'; }
270
+ if (stream.match(builtins)) { return 'builtin'; }
271
+ if (stream.match(identifiers)) { return 'variable'; }
272
+
273
+ if (stream.match(singleOperators) || stream.match(boolOperators)) {
274
+ return 'operator'; }
275
+
276
+ // Handle non-detected items
277
+ stream.next();
278
+ return 'error';
279
+ };
280
+
281
+ CodeMirror.defineMode('idl', function() {
282
+ return {
283
+ token: function(stream) {
284
+ return tokenBase(stream);
285
+ }
286
+ };
287
+ });
288
+
289
+ CodeMirror.defineMIME('text/x-idl', 'idl');
290
+ });
@@ -3,9 +3,9 @@
3
3
 
4
4
  (function(mod) {
5
5
  if (typeof exports == "object" && typeof module == "object") // CommonJS
6
- mod(require("../../lib/codemirror", require("../xml/xml")));
6
+ mod(require("../../lib/codemirror", require("../xml/xml"), require("../meta")));
7
7
  else if (typeof define == "function" && define.amd) // AMD
8
- define(["../../lib/codemirror", "../xml/xml"], mod);
8
+ define(["../../lib/codemirror", "../xml/xml", "../meta"], mod);
9
9
  else // Plain browser env
10
10
  mod(CodeMirror);
11
11
  })(function(CodeMirror) {
@@ -15,45 +15,15 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
15
15
 
16
16
  var htmlFound = CodeMirror.modes.hasOwnProperty("xml");
17
17
  var htmlMode = CodeMirror.getMode(cmCfg, htmlFound ? {name: "xml", htmlMode: true} : "text/plain");
18
- var aliases = {
19
- html: "htmlmixed",
20
- js: "javascript",
21
- json: "application/json",
22
- c: "text/x-csrc",
23
- "c++": "text/x-c++src",
24
- java: "text/x-java",
25
- csharp: "text/x-csharp",
26
- "c#": "text/x-csharp",
27
- scala: "text/x-scala"
28
- };
29
-
30
- var getMode = (function () {
31
- var i, modes = {}, mimes = {}, mime;
32
18
 
33
- var list = [];
34
- for (var m in CodeMirror.modes)
35
- if (CodeMirror.modes.propertyIsEnumerable(m)) list.push(m);
36
- for (i = 0; i < list.length; i++) {
37
- modes[list[i]] = list[i];
19
+ function getMode(name) {
20
+ if (CodeMirror.findModeByName) {
21
+ var found = CodeMirror.findModeByName(name);
22
+ if (found) name = found.mime || found.mimes[0];
38
23
  }
39
- var mimesList = [];
40
- for (var m in CodeMirror.mimeModes)
41
- if (CodeMirror.mimeModes.propertyIsEnumerable(m))
42
- mimesList.push({mime: m, mode: CodeMirror.mimeModes[m]});
43
- for (i = 0; i < mimesList.length; i++) {
44
- mime = mimesList[i].mime;
45
- mimes[mime] = mimesList[i].mime;
46
- }
47
-
48
- for (var a in aliases) {
49
- if (aliases[a] in modes || aliases[a] in mimes)
50
- modes[a] = aliases[a];
51
- }
52
-
53
- return function (lang) {
54
- return modes[lang] ? CodeMirror.getMode(cmCfg, modes[lang]) : null;
55
- };
56
- }());
24
+ var mode = CodeMirror.getMode(cmCfg, name);
25
+ return mode.name == "null" ? null : mode;
26
+ }
57
27
 
58
28
  // Should characters that affect highlighting be highlighted separate?
59
29
  // Does not include characters that will be output (such as `1.` and `-` for lists)
@@ -75,6 +45,10 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
75
45
  // Turn on task lists? ("- [ ] " and "- [x] ")
76
46
  if (modeCfg.taskLists === undefined) modeCfg.taskLists = false;
77
47
 
48
+ // Turn on strikethrough syntax
49
+ if (modeCfg.strikethrough === undefined)
50
+ modeCfg.strikethrough = false;
51
+
78
52
  var codeDepth = 0;
79
53
 
80
54
  var header = 'header'
@@ -91,7 +65,8 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
91
65
  , linktext = 'link'
92
66
  , linkhref = 'string'
93
67
  , em = 'em'
94
- , strong = 'strong';
68
+ , strong = 'strong'
69
+ , strikethrough = 'strikethrough';
95
70
 
96
71
  var hrRE = /^([*\-=_])(?:\s*\1){2,}\s*$/
97
72
  , ulRE = /^[*\-+]\s+/
@@ -99,7 +74,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
99
74
  , taskListRE = /^\[(x| )\](?=\s)/ // Must follow ulRE or olRE
100
75
  , atxHeaderRE = /^#+/
101
76
  , setextHeaderRE = /^(?:\={1,}|-{1,})$/
102
- , textRE = /^[^#!\[\]*_\\<>` "'(]+/;
77
+ , textRE = /^[^#!\[\]*_\\<>` "'(~]+/;
103
78
 
104
79
  function switchInline(stream, state, f) {
105
80
  state.f = state.inline = f;
@@ -121,6 +96,8 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
121
96
  state.em = false;
122
97
  // Reset STRONG state
123
98
  state.strong = false;
99
+ // Reset strikethrough state
100
+ state.strikethrough = false;
124
101
  // Reset state.quote
125
102
  state.quote = 0;
126
103
  if (!htmlFound && state.f == htmlBlock) {
@@ -197,11 +174,11 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
197
174
  state.f = state.inline;
198
175
  if (modeCfg.highlightFormatting) state.formatting = ["list", "list-" + listType];
199
176
  return getType(state);
200
- } else if (modeCfg.fencedCodeBlocks && stream.match(/^```([\w+#]*)/, true)) {
177
+ } else if (modeCfg.fencedCodeBlocks && stream.match(/^```[ \t]*([\w+#]*)/, true)) {
201
178
  // try switching mode
202
179
  state.localMode = getMode(RegExp.$1);
203
180
  if (state.localMode) state.localState = state.localMode.startState();
204
- switchBlock(stream, state, local);
181
+ state.f = state.block = local;
205
182
  if (modeCfg.highlightFormatting) state.formatting = "code-block";
206
183
  state.code = true;
207
184
  return getType(state);
@@ -222,15 +199,10 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
222
199
  }
223
200
 
224
201
  function local(stream, state) {
225
- if (stream.sol() && stream.match(/^```/, true)) {
202
+ if (stream.sol() && stream.match("```", false)) {
226
203
  state.localMode = state.localState = null;
227
- state.f = inlineNormal;
228
- state.block = blockNormal;
229
- if (modeCfg.highlightFormatting) state.formatting = "code-block";
230
- state.code = true;
231
- var returnType = getType(state);
232
- state.code = false;
233
- return returnType;
204
+ state.f = state.block = leavingLocal;
205
+ return null;
234
206
  } else if (state.localMode) {
235
207
  return state.localMode.token(stream, state.localState);
236
208
  } else {
@@ -239,6 +211,17 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
239
211
  }
240
212
  }
241
213
 
214
+ function leavingLocal(stream, state) {
215
+ stream.match("```");
216
+ state.block = blockNormal;
217
+ state.f = inlineNormal;
218
+ if (modeCfg.highlightFormatting) state.formatting = "code-block";
219
+ state.code = true;
220
+ var returnType = getType(state);
221
+ state.code = false;
222
+ return returnType;
223
+ }
224
+
242
225
  // Inline
243
226
  function getType(state) {
244
227
  var styles = [];
@@ -283,6 +266,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
283
266
 
284
267
  if (state.strong) { styles.push(strong); }
285
268
  if (state.em) { styles.push(em); }
269
+ if (state.strikethrough) { styles.push(strikethrough); }
286
270
 
287
271
  if (state.linkText) { styles.push(linktext); }
288
272
 
@@ -511,6 +495,29 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
511
495
  }
512
496
  }
513
497
 
498
+ if (modeCfg.strikethrough) {
499
+ if (ch === '~' && stream.eatWhile(ch)) {
500
+ if (state.strikethrough) {// Remove strikethrough
501
+ if (modeCfg.highlightFormatting) state.formatting = "strikethrough";
502
+ var t = getType(state);
503
+ state.strikethrough = false;
504
+ return t;
505
+ } else if (stream.match(/^[^\s]/, false)) {// Add strikethrough
506
+ state.strikethrough = true;
507
+ if (modeCfg.highlightFormatting) state.formatting = "strikethrough";
508
+ return getType(state);
509
+ }
510
+ } else if (ch === ' ') {
511
+ if (stream.match(/^~~/, true)) { // Probably surrounded by space
512
+ if (stream.peek() === ' ') { // Surrounded by spaces, ignore
513
+ return getType(state);
514
+ } else { // Not surrounded by spaces, back up pointer
515
+ stream.backUp(2);
516
+ }
517
+ }
518
+ }
519
+ }
520
+
514
521
  if (ch === ' ') {
515
522
  if (stream.match(/ +$/, false)) {
516
523
  state.trailingSpace++;
@@ -659,7 +666,8 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
659
666
  listDepth: 0,
660
667
  quote: 0,
661
668
  trailingSpace: 0,
662
- trailingSpaceNewLine: false
669
+ trailingSpaceNewLine: false,
670
+ strikethrough: false
663
671
  };
664
672
  },
665
673
 
@@ -683,6 +691,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
683
691
  linkTitle: s.linkTitle,
684
692
  em: s.em,
685
693
  strong: s.strong,
694
+ strikethrough: s.strikethrough,
686
695
  header: s.header,
687
696
  taskList: s.taskList,
688
697
  list: s.list,
@@ -733,9 +742,7 @@ CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
733
742
  state.indentation = adjustedIndentation;
734
743
  if (indentation > 0) return null;
735
744
  }
736
- var result = state.f(stream, state);
737
- if (stream.start == stream.pos) return this.token(stream, state);
738
- else return result;
745
+ return state.f(stream, state);
739
746
  },
740
747
 
741
748
  innerMode: function(state) {