index.html 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>CodeMirror: Smalltalk mode</title>
  6. <link rel="stylesheet" href="../../lib/codemirror.css">
  7. <script src="../../lib/codemirror.js"></script>
  8. <script src="../../addon/edit/matchbrackets.js"></script>
  9. <script src="smalltalk.js"></script>
  10. <link rel="stylesheet" href="../../doc/docs.css">
  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. </head>
  17. <body>
  18. <h1>CodeMirror: Smalltalk mode</h1>
  19. <form><textarea id="code" name="code">
  20. "
  21. This is a test of the Smalltalk code
  22. "
  23. Seaside.WAComponent subclass: #MyCounter [
  24. | count |
  25. MyCounter class &gt;&gt; canBeRoot [ ^true ]
  26. initialize [
  27. super initialize.
  28. count := 0.
  29. ]
  30. states [ ^{ self } ]
  31. renderContentOn: html [
  32. html heading: count.
  33. html anchor callback: [ count := count + 1 ]; with: '++'.
  34. html space.
  35. html anchor callback: [ count := count - 1 ]; with: '--'.
  36. ]
  37. ]
  38. MyCounter registerAsApplication: 'mycounter'
  39. </textarea></form>
  40. <script>
  41. var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
  42. lineNumbers: true,
  43. matchBrackets: true,
  44. mode: "text/x-stsrc",
  45. indentUnit: 4
  46. });
  47. </script>
  48. <p>Simple Smalltalk mode.</p>
  49. <p><strong>MIME types defined:</strong> <code>text/x-stsrc</code>.</p>
  50. </body>
  51. </html>