aboutsummaryrefslogtreecommitdiff
path: root/imports/codemirror/mode/stex
diff options
context:
space:
mode:
authorValerio Virgillito2012-07-17 11:28:39 -0700
committerValerio Virgillito2012-07-17 11:28:39 -0700
commit4f737b24c19ddc02d20f9783b8b080fc6ef11142 (patch)
tree212d164c0f83d80394e34f1df532ea0461ad328d /imports/codemirror/mode/stex
parent5146f224258929415adf4a8022e492454b4e2476 (diff)
parent0e04fff0ea80fa5cbe96b8354db38bd334aea83a (diff)
downloadninja-4f737b24c19ddc02d20f9783b8b080fc6ef11142.tar.gz
Merge pull request #396 from ananyasen/codemirror2.3-upgrade
upgrade to codemirror 2.3
Diffstat (limited to 'imports/codemirror/mode/stex')
-rw-r--r--imports/codemirror/mode/stex/stex.js10
-rw-r--r--imports/codemirror/mode/stex/test.html12
2 files changed, 18 insertions, 4 deletions
diff --git a/imports/codemirror/mode/stex/stex.js b/imports/codemirror/mode/stex/stex.js
index b89e619e..c0739ded 100644
--- a/imports/codemirror/mode/stex/stex.js
+++ b/imports/codemirror/mode/stex/stex.js
@@ -85,10 +85,12 @@ CodeMirror.defineMode("stex", function(cmCfg, modeCfg)
85 if (source.match(/^\\[a-zA-Z@]+/)) { 85 if (source.match(/^\\[a-zA-Z@]+/)) {
86 var cmdName = source.current(); 86 var cmdName = source.current();
87 cmdName = cmdName.substr(1, cmdName.length-1); 87 cmdName = cmdName.substr(1, cmdName.length-1);
88 var plug = plugins[cmdName]; 88 var plug;
89 if (typeof(plug) == 'undefined') { 89 if (plugins.hasOwnProperty(cmdName)) {
90 plug = plugins["DEFAULT"]; 90 plug = plugins[cmdName];
91 } 91 } else {
92 plug = plugins["DEFAULT"];
93 }
92 plug = new plug(); 94 plug = new plug();
93 pushCommand(state, plug); 95 pushCommand(state, plug);
94 setState(state, beginParams); 96 setState(state, beginParams);
diff --git a/imports/codemirror/mode/stex/test.html b/imports/codemirror/mode/stex/test.html
index b53a6a24..a60f4184 100644
--- a/imports/codemirror/mode/stex/test.html
+++ b/imports/codemirror/mode/stex/test.html
@@ -241,6 +241,18 @@
241 241
242 </script> 242 </script>
243 243
244 <h2>New Commands</h2>
245
246 Should be able to define a new command that happens to be a method on Array
247 (e.g. <tt>pop</tt>):
248 <script language="javascript">
249 MT.test('\\newcommand{\\pop}',
250 'tag', '\\newcommand',
251 'bracket', '{',
252 'tag', '\\pop',
253 'bracket', '}');
254 </script>
255
244 <h2>Summary</h2> 256 <h2>Summary</h2>
245 <script language="javascript"> 257 <script language="javascript">
246 MT.printSummary(); 258 MT.printSummary();