2
0

index.html 1.7 KB

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