index.html 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>CodeMirror: Lua mode</title>
  6. <link rel="stylesheet" href="../../lib/codemirror.css">
  7. <script src="../../addon/edit/matchbrackets.js"></script>
  8. <script src="../../lib/codemirror.js"></script>
  9. <script src="lua.js"></script>
  10. <link rel="stylesheet" href="../../theme/neat.css">
  11. <style>.CodeMirror {border: 1px solid black;}</style>
  12. <link rel="stylesheet" href="../../doc/docs.css">
  13. </head>
  14. <body>
  15. <h1>CodeMirror: Lua mode</h1>
  16. <form><textarea id="code" name="code">
  17. --[[
  18. example useless code to show lua syntax highlighting
  19. this is multiline comment
  20. ]]
  21. function blahblahblah(x)
  22. local table = {
  23. "asd" = 123,
  24. "x" = 0.34,
  25. }
  26. if x ~= 3 then
  27. print( x )
  28. elseif x == "string"
  29. my_custom_function( 0x34 )
  30. else
  31. unknown_function( "some string" )
  32. end
  33. --single line comment
  34. end
  35. function blablabla3()
  36. for k,v in ipairs( table ) do
  37. --abcde..
  38. y=[=[
  39. x=[[
  40. x is a multi line string
  41. ]]
  42. but its definition is iside a highest level string!
  43. ]=]
  44. print(" \"\" ")
  45. s = math.sin( x )
  46. end
  47. end
  48. </textarea></form>
  49. <script>
  50. var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
  51. tabMode: "indent",
  52. matchBrackets: true,
  53. theme: "neat"
  54. });
  55. </script>
  56. <p>Loosely based on Franciszek
  57. Wawrzak's <a href="http://codemirror.net/1/contrib/lua">CodeMirror
  58. 1 mode</a>. One configuration parameter is
  59. supported, <code>specials</code>, to which you can provide an
  60. array of strings to have those identifiers highlighted with
  61. the <code>lua-special</code> style.</p>
  62. <p><strong>MIME types defined:</strong> <code>text/x-lua</code>.</p>
  63. </body>
  64. </html>