meta.js 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. // CodeMirror, copyright (c) by Marijn Haverbeke and others
  2. // Distributed under an MIT license: http://codemirror.net/LICENSE
  3. (function(mod) {
  4. if (typeof exports == "object" && typeof module == "object") // CommonJS
  5. mod(require("../lib/codemirror"));
  6. else if (typeof define == "function" && define.amd) // AMD
  7. define(["../lib/codemirror"], mod);
  8. else // Plain browser env
  9. mod(CodeMirror);
  10. })(function(CodeMirror) {
  11. "use strict";
  12. CodeMirror.modeInfo = [
  13. {name: "APL", mime: "text/apl", mode: "apl", ext: ["dyalog", "apl"]},
  14. {name: "Asterisk", mime: "text/x-asterisk", mode: "asterisk"},
  15. {name: "C", mime: "text/x-csrc", mode: "clike", ext: ["c", "h"]},
  16. {name: "C++", mime: "text/x-c++src", mode: "clike", ext: ["cpp", "c++", "hpp", "h++"], alias: ["cpp"]},
  17. {name: "Cobol", mime: "text/x-cobol", mode: "cobol", ext: ["cob", "cpy"]},
  18. {name: "C#", mime: "text/x-csharp", mode: "clike", ext: ["cs"], alias: ["csharp"]},
  19. {name: "Clojure", mime: "text/x-clojure", mode: "clojure", ext: ["clj"]},
  20. {name: "CoffeeScript", mime: "text/x-coffeescript", mode: "coffeescript", ext: ["coffee"], alias: ["coffee", "coffee-script"]},
  21. {name: "Common Lisp", mime: "text/x-common-lisp", mode: "commonlisp", ext: ["cl", "lisp", "el"], alias: ["lisp"]},
  22. {name: "Cypher", mime: "application/x-cypher-query", mode: "cypher"},
  23. {name: "Cython", mime: "text/x-cython", mode: "python", ext: ["pyx", "pxd", "pxi"]},
  24. {name: "CSS", mime: "text/css", mode: "css", ext: ["css"]},
  25. {name: "CQL", mime: "text/x-cassandra", mode: "sql", ext: ["cql"]},
  26. {name: "D", mime: "text/x-d", mode: "d", ext: ["d"]},
  27. {name: "diff", mime: "text/x-diff", mode: "diff", ext: ["diff", "patch"]},
  28. {name: "Django", mime: "text/x-django", mode: "django"},
  29. {name: "Dockerfile", mime: "text/x-dockerfile", mode: "dockerfile"},
  30. {name: "DTD", mime: "application/xml-dtd", mode: "dtd", ext: ["dtd"]},
  31. {name: "Dylan", mime: "text/x-dylan", mode: "dylan", ext: ["dylan", "dyl", "intr"]},
  32. {name: "ECL", mime: "text/x-ecl", mode: "ecl", ext: ["ecl"]},
  33. {name: "Eiffel", mime: "text/x-eiffel", mode: "eiffel", ext: ["e"]},
  34. {name: "Embedded Javascript", mime: "application/x-ejs", mode: "htmlembedded", ext: ["ejs"]},
  35. {name: "Erlang", mime: "text/x-erlang", mode: "erlang", ext: ["erl"]},
  36. {name: "Fortran", mime: "text/x-fortran", mode: "fortran", ext: ["f", "for", "f77", "f90"]},
  37. {name: "F#", mime: "text/x-fsharp", mode: "mllike", ext: ["fs"], alias: ["fsharp"]},
  38. {name: "Gas", mime: "text/x-gas", mode: "gas", ext: ["s"]},
  39. {name: "Gherkin", mime: "text/x-feature", mode: "gherkin", ext: ["feature"]},
  40. {name: "GitHub Flavored Markdown", mime: "text/x-gfm", mode: "gfm"},
  41. {name: "Go", mime: "text/x-go", mode: "go", ext: ["go"]},
  42. {name: "Groovy", mime: "text/x-groovy", mode: "groovy", ext: ["groovy"]},
  43. {name: "HAML", mime: "text/x-haml", mode: "haml", ext: ["haml"]},
  44. {name: "Haskell", mime: "text/x-haskell", mode: "haskell", ext: ["hs"]},
  45. {name: "Haxe", mime: "text/x-haxe", mode: "haxe", ext: ["hx"]},
  46. {name: "HXML", mime: "text/x-hxml", mode: "haxe", ext: ["hxml"]},
  47. {name: "ASP.NET", mime: "application/x-aspx", mode: "htmlembedded", ext: ["aspx"], alias: ["asp", "aspx"]},
  48. {name: "HTML", mime: "text/html", mode: "htmlmixed", ext: ["html", "htm"], alias: ["xhtml"]},
  49. {name: "HTTP", mime: "message/http", mode: "http"},
  50. {name: "IDL", mime: "text/x-idl", mode: "idl", ext: ["pro"]},
  51. {name: "Jade", mime: "text/x-jade", mode: "jade", ext: ["jade"]},
  52. {name: "Java", mime: "text/x-java", mode: "clike", ext: ["java"]},
  53. {name: "Java Server Pages", mime: "application/x-jsp", mode: "htmlembedded", ext: ["jsp"], alias: ["jsp"]},
  54. {name: "JavaScript", mimes: ["text/javascript", "text/ecmascript", "application/javascript", "application/x-javascript", "application/ecmascript"],
  55. mode: "javascript", ext: ["js"], alias: ["ecmascript", "js", "node"]},
  56. {name: "JSON", mimes: ["application/json", "application/x-json"], mode: "javascript", ext: ["json", "map"], alias: ["json5"]},
  57. {name: "JSON-LD", mime: "application/ld+json", mode: "javascript", alias: ["jsonld"]},
  58. {name: "Jinja2", mime: "null", mode: "jinja2"},
  59. {name: "Julia", mime: "text/x-julia", mode: "julia", ext: ["jl"]},
  60. {name: "Kotlin", mime: "text/x-kotlin", mode: "kotlin", ext: ["kt"]},
  61. {name: "LESS", mime: "text/x-less", mode: "css", ext: ["less"]},
  62. {name: "LiveScript", mime: "text/x-livescript", mode: "livescript", ext: ["ls"], alias: ["ls"]},
  63. {name: "Lua", mime: "text/x-lua", mode: "lua", ext: ["lua"]},
  64. {name: "Markdown (GitHub-flavour)", mime: "text/x-markdown", mode: "markdown", ext: ["markdown", "md", "mkd"]},
  65. {name: "mIRC", mime: "text/mirc", mode: "mirc"},
  66. {name: "MariaDB SQL", mime: "text/x-mariadb", mode: "sql"},
  67. {name: "Modelica", mime: "text/x-modelica", mode: "modelica", ext: ["mo"]},
  68. {name: "MS SQL", mime: "text/x-mssql", mode: "sql"},
  69. {name: "MySQL", mime: "text/x-mysql", mode: "sql"},
  70. {name: "Nginx", mime: "text/x-nginx-conf", mode: "nginx"},
  71. {name: "NTriples", mime: "text/n-triples", mode: "ntriples", ext: ["nt"]},
  72. {name: "Objective C", mime: "text/x-objectivec", mode: "clike", ext: ["m", "mm"]},
  73. {name: "OCaml", mime: "text/x-ocaml", mode: "mllike", ext: ["ml", "mli", "mll", "mly"]},
  74. {name: "Octave", mime: "text/x-octave", mode: "octave", ext: ["m"]},
  75. {name: "Pascal", mime: "text/x-pascal", mode: "pascal", ext: ["p", "pas"]},
  76. {name: "PEG.js", mime: "null", mode: "pegjs"},
  77. {name: "Perl", mime: "text/x-perl", mode: "perl", ext: ["pl", "pm"]},
  78. {name: "PHP", mime: "application/x-httpd-php", mode: "php", ext: ["php", "php3", "php4", "php5", "phtml"]},
  79. {name: "Pig", mime: "text/x-pig", mode: "pig"},
  80. {name: "Plain Text", mime: "text/plain", mode: "null", ext: ["txt", "text", "conf", "def", "list", "log"]},
  81. {name: "PLSQL", mime: "text/x-plsql", mode: "sql"},
  82. {name: "Properties files", mime: "text/x-properties", mode: "properties", ext: ["properties", "ini", "in"], alias: ["ini", "properties"]},
  83. {name: "Python", mime: "text/x-python", mode: "python", ext: ["py", "pyw"]},
  84. {name: "Puppet", mime: "text/x-puppet", mode: "puppet", ext: ["pp"]},
  85. {name: "Q", mime: "text/x-q", mode: "q", ext: ["q"]},
  86. {name: "R", mime: "text/x-rsrc", mode: "r", ext: ["r"], alias: ["rscript"]},
  87. {name: "reStructuredText", mime: "text/x-rst", mode: "rst", ext: ["rst"], alias: ["rst"]},
  88. {name: "RPM Changes", mime: "text/x-rpm-changes", mode: "rpm"},
  89. {name: "RPM Spec", mime: "text/x-rpm-spec", mode: "rpm", ext: ["spec"]},
  90. {name: "Ruby", mime: "text/x-ruby", mode: "ruby", ext: ["rb"], alias: ["jruby", "macruby", "rake", "rb", "rbx"]},
  91. {name: "Rust", mime: "text/x-rustsrc", mode: "rust", ext: ["rs"]},
  92. {name: "Sass", mime: "text/x-sass", mode: "sass", ext: ["sass"]},
  93. {name: "Scala", mime: "text/x-scala", mode: "clike", ext: ["scala"]},
  94. {name: "Scheme", mime: "text/x-scheme", mode: "scheme", ext: ["scm", "ss"]},
  95. {name: "SCSS", mime: "text/x-scss", mode: "css", ext: ["scss"]},
  96. {name: "Shell", mime: "text/x-sh", mode: "shell", ext: ["sh", "ksh", "bash"], alias: ["bash", "sh", "zsh"]},
  97. {name: "Sieve", mime: "application/sieve", mode: "sieve"},
  98. {name: "Slim", mimes: ["text/x-slim", "application/x-slim"], mode: "slim"},
  99. {name: "Smalltalk", mime: "text/x-stsrc", mode: "smalltalk", ext: ["st"]},
  100. {name: "Smarty", mime: "text/x-smarty", mode: "smarty", ext: ["tpl"]},
  101. {name: "SmartyMixed", mime: "text/x-smarty", mode: "smartymixed"},
  102. {name: "Solr", mime: "text/x-solr", mode: "solr"},
  103. {name: "SPARQL", mime: "application/sparql-query", mode: "sparql", ext: ["rq", "sparql"], alias: ["sparul"]},
  104. {name: "SQL", mime: "text/x-sql", mode: "sql", ext: ["sql"]},
  105. {name: "MariaDB", mime: "text/x-mariadb", mode: "sql"},
  106. {name: "sTeX", mime: "text/x-stex", mode: "stex"},
  107. {name: "LaTeX", mime: "text/x-latex", mode: "stex", ext: ["text", "ltx"], alias: ["tex"]},
  108. {name: "SystemVerilog", mime: "text/x-systemverilog", mode: "verilog", ext: ["v"]},
  109. {name: "Tcl", mime: "text/x-tcl", mode: "tcl", ext: ["tcl"]},
  110. {name: "Textile", mime: "text/x-textile", mode: "textile"},
  111. {name: "TiddlyWiki ", mime: "text/x-tiddlywiki", mode: "tiddlywiki"},
  112. {name: "Tiki wiki", mime: "text/tiki", mode: "tiki"},
  113. {name: "TOML", mime: "text/x-toml", mode: "toml"},
  114. {name: "Tornado", mime: "text/x-tornado", mode: "tornado"},
  115. {name: "Turtle", mime: "text/turtle", mode: "turtle", ext: ["ttl"]},
  116. {name: "TypeScript", mime: "application/typescript", mode: "javascript", ext: ["ts"], alias: ["ts"]},
  117. {name: "VB.NET", mime: "text/x-vb", mode: "vb", ext: ["vb"]},
  118. {name: "VBScript", mime: "text/vbscript", mode: "vbscript"},
  119. {name: "Velocity", mime: "text/velocity", mode: "velocity", ext: ["vtl"]},
  120. {name: "Verilog", mime: "text/x-verilog", mode: "verilog", ext: ["v"]},
  121. {name: "XML", mimes: ["application/xml", "text/xml"], mode: "xml", ext: ["xml", "xsl", "xsd"], alias: ["rss", "wsdl", "xsd"]},
  122. {name: "XQuery", mime: "application/xquery", mode: "xquery", ext: ["xy", "xquery"]},
  123. {name: "YAML", mime: "text/x-yaml", mode: "yaml", ext: ["yaml"], alias: ["yml"]},
  124. {name: "Z80", mime: "text/x-z80", mode: "z80", ext: ["z80"]}
  125. ];
  126. // Ensure all modes have a mime property for backwards compatibility
  127. for (var i = 0; i < CodeMirror.modeInfo.length; i++) {
  128. var info = CodeMirror.modeInfo[i];
  129. if (info.mimes) info.mime = info.mimes[0];
  130. }
  131. CodeMirror.findModeByMIME = function(mime) {
  132. for (var i = 0; i < CodeMirror.modeInfo.length; i++) {
  133. var info = CodeMirror.modeInfo[i];
  134. if (info.mime == mime) return info;
  135. if (info.mimes) for (var j = 0; j < info.mimes.length; j++)
  136. if (info.mimes[j] == mime) return info;
  137. }
  138. };
  139. CodeMirror.findModeByExtension = function(ext) {
  140. for (var i = 0; i < CodeMirror.modeInfo.length; i++) {
  141. var info = CodeMirror.modeInfo[i];
  142. if (info.ext) for (var j = 0; j < info.ext.length; j++)
  143. if (info.ext[j] == ext) return info;
  144. }
  145. };
  146. CodeMirror.findModeByName = function(name) {
  147. name = name.toLowerCase();
  148. for (var i = 0; i < CodeMirror.modeInfo.length; i++) {
  149. var info = CodeMirror.modeInfo[i];
  150. if (info.name.toLowerCase() == name) return info;
  151. if (info.alias) for (var j = 0; j < info.alias.length; j++)
  152. if (info.alias[j].toLowerCase() == name) return info;
  153. }
  154. };
  155. });