| 1 | <!doctype html> |
| 2 | |
| 3 | <title>CodeMirror: Smalltalk mode</title> |
| 4 | <meta charset="utf-8"/> |
| 5 | <link rel=stylesheet href="../../doc/docs.css"> |
| 6 | |
| 7 | <link rel="stylesheet" href="../../lib/codemirror.css"> |
| 8 | <script src="../../lib/codemirror.js"></script> |
| 9 | <script src="../../addon/edit/matchbrackets.js"></script> |
| 10 | <script src="smalltalk.js"></script> |
| 11 | <style> |
| 12 | .CodeMirror {border: 2px solid #dee; border-right-width: 10px;} |
| 13 | .CodeMirror-gutter {border: none; background: #dee;} |
| 14 | .CodeMirror-gutter pre {color: white; font-weight: bold;} |
| 15 | </style> |
| 16 | <div id=nav> |
| 17 | <a href="https://codemirror.net"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"></a> |
| 18 | |
| 19 | <ul> |
| 20 | <li><a href="../../index.html">Home</a> |
| 21 | <li><a href="../../doc/manual.html">Manual</a> |
| 22 | <li><a href="https://github.com/codemirror/codemirror">Code</a> |
| 23 | </ul> |
| 24 | <ul> |
| 25 | <li><a href="../index.html">Language modes</a> |
| 26 | <li><a class=active href="#">Smalltalk</a> |
| 27 | </ul> |
| 28 | </div> |
| 29 | |
| 30 | <article> |
| 31 | <h2>Smalltalk mode</h2> |
| 32 | <form><textarea id="code" name="code"> |
| 33 | " |
| 34 | This is a test of the Smalltalk code |
| 35 | " |
| 36 | Seaside.WAComponent subclass: #MyCounter [ |
| 37 | | count | |
| 38 | MyCounter class >> canBeRoot [ ^true ] |
| 39 | |
| 40 | initialize [ |
| 41 | super initialize. |
| 42 | count := 0. |
| 43 | ] |
| 44 | states [ ^{ self } ] |
| 45 | renderContentOn: html [ |
| 46 | html heading: count. |
| 47 | html anchor callback: [ count := count + 1 ]; with: '++'. |
| 48 | html space. |
| 49 | html anchor callback: [ count := count - 1 ]; with: '--'. |
| 50 | ] |
| 51 | ] |
| 52 | |
| 53 | MyCounter registerAsApplication: 'mycounter' |
| 54 | </textarea></form> |
| 55 | |
| 56 | <script> |
| 57 | var editor = CodeMirror.fromTextArea(document.getElementById("code"), { |
| 58 | lineNumbers: true, |
| 59 | matchBrackets: true, |
| 60 | mode: "text/x-stsrc", |
| 61 | indentUnit: 4 |
| 62 | }); |
| 63 | </script> |
| 64 | |
| 65 | <p>Simple Smalltalk mode.</p> |
| 66 | |
| 67 | <p><strong>MIME types defined:</strong> <code>text/x-stsrc</code>.</p> |
| 68 | </article> |