You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
1.9 KiB

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