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.

61 lines
1.6 KiB

7 months ago
  1. <!doctype html>
  2. <title>CodeMirror: Elm 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="elm.js"></script>
  8. <style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
  9. <div id=nav>
  10. <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
  11. <ul>
  12. <li><a href="../../index.html">Home</a>
  13. <li><a href="../../doc/manual.html">Manual</a>
  14. <li><a href="https://github.com/codemirror/codemirror5">Code</a>
  15. </ul>
  16. <ul>
  17. <li><a href="../index.html">Language modes</a>
  18. <li><a class=active href="#">Elm</a>
  19. </ul>
  20. </div>
  21. <article>
  22. <h2>Elm mode</h2>
  23. <div><textarea id="code" name="code">
  24. import Color exposing (..)
  25. import Graphics.Collage exposing (..)
  26. import Graphics.Element exposing (..)
  27. import Time exposing (..)
  28. main =
  29. Signal.map clock (every second)
  30. clock t =
  31. collage 400 400
  32. [ filled lightGrey (ngon 12 110)
  33. , outlined (solid grey) (ngon 12 110)
  34. , hand orange 100 t
  35. , hand charcoal 100 (t/60)
  36. , hand charcoal 60 (t/720)
  37. ]
  38. hand clr len time =
  39. let angle = degrees (90 - 6 * inSeconds time)
  40. in
  41. segment (0,0) (fromPolar (len,angle))
  42. |> traced (solid clr)
  43. </textarea></div>
  44. <script>
  45. var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
  46. lineNumbers: true,
  47. mode: "text/x-elm"
  48. });
  49. </script>
  50. <p><strong>MIME types defined:</strong> <code>text/x-elm</code>.</p>
  51. </article>