SideBySide2: Add syntax highlighting for 18 more languages
Include more languages into the CM3 mapping supported by Gerrit:
* coffeescript
* d
* diff
* dtd
* erlang
* gas
* gfm (GitHub Flavored Markdown)
* haskell
* lua
* markdown
* php
* pig
* r
* scheme
* smalltalk
* tcl
* verilog
* yaml
Change-Id: Ie3cc3657183a475fb71a71e0fe35be848deb985f
(cherry picked from commit 5478148f6f25db215424f51d6a5e88f7bf78f164)
diff --git a/gerrit-gwtui/src/main/java/net/codemirror/lib/ModeInjector.java b/gerrit-gwtui/src/main/java/net/codemirror/lib/ModeInjector.java
index 02faccb..5cd88b4 100644
--- a/gerrit-gwtui/src/main/java/net/codemirror/lib/ModeInjector.java
+++ b/gerrit-gwtui/src/main/java/net/codemirror/lib/ModeInjector.java
@@ -43,19 +43,36 @@
Modes.I.clike(),
Modes.I.clojure(),
Modes.I.commonlisp(),
+ Modes.I.coffeescript(),
Modes.I.css(),
+ Modes.I.d(),
+ Modes.I.diff(),
+ Modes.I.dtd(),
+ Modes.I.erlang(),
+ Modes.I.gas(),
+ Modes.I.gfm(),
Modes.I.go(),
Modes.I.groovy(),
+ Modes.I.haskell(),
Modes.I.htmlmixed(),
Modes.I.javascript(),
+ Modes.I.lua(),
+ Modes.I.markdown(),
Modes.I.perl(),
+ Modes.I.php(),
+ Modes.I.pig(),
Modes.I.properties(),
Modes.I.python(),
+ Modes.I.r(),
Modes.I.ruby(),
+ Modes.I.scheme(),
Modes.I.shell(),
+ Modes.I.smalltalk(),
Modes.I.sql(),
Modes.I.velocity(),
+ Modes.I.verilog(),
Modes.I.xml(),
+ Modes.I.yaml(),
};
mimeAlias = new HashMap<>();
diff --git a/gerrit-gwtui/src/main/java/net/codemirror/mode/Modes.java b/gerrit-gwtui/src/main/java/net/codemirror/mode/Modes.java
index 307403a..547c4a1 100644
--- a/gerrit-gwtui/src/main/java/net/codemirror/mode/Modes.java
+++ b/gerrit-gwtui/src/main/java/net/codemirror/mode/Modes.java
@@ -27,19 +27,37 @@
@Source("clike/clike.js") @DoNotEmbed DataResource clike();
@Source("clojure/clojure.js") @DoNotEmbed DataResource clojure();
@Source("commonlisp/commonlisp.js") @DoNotEmbed DataResource commonlisp();
+ @Source("coffeescript/coffeescript.js") @DoNotEmbed DataResource coffeescript();
@Source("css/css.js") @DoNotEmbed DataResource css();
+ @Source("d/d.js") @DoNotEmbed DataResource d();
+ @Source("diff/diff.js") @DoNotEmbed DataResource diff();
+ @Source("dtd/dtd.js") @DoNotEmbed DataResource dtd();
+ @Source("erlang/erlang.js") @DoNotEmbed DataResource erlang();
+ @Source("gas/gas.js") @DoNotEmbed DataResource gas();
+ @Source("gfm/gfm.js") @DoNotEmbed DataResource gfm();
@Source("go/go.js") @DoNotEmbed DataResource go();
@Source("groovy/groovy.js") @DoNotEmbed DataResource groovy();
+ @Source("haskell/haskell.js") @DoNotEmbed DataResource haskell();
@Source("htmlmixed/htmlmixed.js") @DoNotEmbed DataResource htmlmixed();
@Source("javascript/javascript.js") @DoNotEmbed DataResource javascript();
+ @Source("lua/lua.js") @DoNotEmbed DataResource lua();
+ @Source("markdown/markdown.js") @DoNotEmbed DataResource markdown();
@Source("perl/perl.js") @DoNotEmbed DataResource perl();
+ @Source("php/php.js") @DoNotEmbed DataResource php();
+ @Source("pig/pig.js") @DoNotEmbed DataResource pig();
@Source("properties/properties.js") @DoNotEmbed DataResource properties();
@Source("python/python.js") @DoNotEmbed DataResource python();
+ @Source("r/r.js") @DoNotEmbed DataResource r();
@Source("ruby/ruby.js") @DoNotEmbed DataResource ruby();
+ @Source("scheme/scheme.js") @DoNotEmbed DataResource scheme();
@Source("shell/shell.js") @DoNotEmbed DataResource shell();
+ @Source("smalltalk/smalltalk.js") @DoNotEmbed DataResource smalltalk();
@Source("sql/sql.js") @DoNotEmbed DataResource sql();
+ @Source("tcl/tcl.js") @DoNotEmbed DataResource tcl();
@Source("velocity/velocity.js") @DoNotEmbed DataResource velocity();
+ @Source("verilog/verilog.js") @DoNotEmbed DataResource verilog();
@Source("xml/xml.js") @DoNotEmbed DataResource xml();
+ @Source("yaml/yaml.js") @DoNotEmbed DataResource yaml();
// When adding a resource, update static initializer in ModeInjector.
}
diff --git a/gerrit-gwtui/src/main/java/net/codemirror/mode/mode_map b/gerrit-gwtui/src/main/java/net/codemirror/mode/mode_map
index c62920d..8c8a0cd 100644
--- a/gerrit-gwtui/src/main/java/net/codemirror/mode/mode_map
+++ b/gerrit-gwtui/src/main/java/net/codemirror/mode/mode_map
@@ -11,6 +11,9 @@
clojure:
text/x-clojure
+coffeescript:
+text/x-coffeescript
+
commonlisp:
text/x-common-lisp
@@ -18,12 +21,33 @@
text/css
text/x-scss
+d:
+text/x-d
+
+diff:
+text/x-diff
+
+dtd:
+application/xml-dtd
+
+erlang:
+text/x-erlang
+
+gas:
+text/x-gas
+
+gfm:
+text/x-github-markdown
+
go:
text/x-go
groovy:
text/x-groovy
+haskell:
+text/x-haskell
+
htmlmixed:
text/html
@@ -37,6 +61,12 @@
text/typescript
application/typescript
+lua:
+text/x-lua
+
+markdown:
+text/x-markdown
+
perl:
text/x-perl
@@ -47,30 +77,58 @@
perl:
text/x-perl
+php:
+application/x-httpd-php
+application/x-httpd-php-open
+text/x-php
+
+pig:
+text/x-pig
+
python:
text/x-python
+r:
+text/r-src
+
ruby:
text/x-ruby
+scheme:
+text/x-scheme
+
shell:
text/x-sh
application/x-shellscript
+smalltalk:
+text/x-stsrc
+
sql:
text/x-sql
text/x-mariadb
text/x-mysql
text/x-plsql
+tcl:
+text/x-tcl
+
velocity:
text/velocity
+verilog:
+text/x-verilog
+
xml:
text/xml
application/xml
+yaml:
+text/x-yaml
+
application/x-javascript = application/javascript
application/x-shellscript = text/x-sh
+application/x-tcl = text/x-tcl
text/x-h = text/x-c++hdr
text/x-java-source = text/x-java
+text/x-scripttcl = text/x-tcl
diff --git a/gerrit-server/src/main/resources/com/google/gerrit/server/mime-types.properties b/gerrit-server/src/main/resources/com/google/gerrit/server/mime-types.properties
index baeb34d..aac1e5a 100644
--- a/gerrit-server/src/main/resources/com/google/gerrit/server/mime-types.properties
+++ b/gerrit-server/src/main/resources/com/google/gerrit/server/mime-types.properties
@@ -1,19 +1,38 @@
+as = text/x-gas
bucklet = text/x-python
BUCK = text/x-python
clj = text/x-clojure
cl = text/x-common-lisp
+coffee = text/x-coffeescript
cxx = text/x-c++src
+d = text/x-d
defs = text/x-python
+diff = text/x-diff
+dtd = application/xml-dtd
el = text/x-common-lisp
+erl = text/x-erlang
gitmodules = text/x-ini
go = text/x-go
groovy = text/x-groovy
+hs = text/x-haskell
hxx = text/x-c++hdr
lisp = text/x-common-lisp
lsp = text/x-common-lisp
+lua = text/x-lua
+md = text/x-markdown
+patch = text/x-diff
+php = text/x-php
+pig = text/x-pig
pl = text/x-perl
pm = text/x-perl
project.config = text/x-ini
+properties = text/x-ini
py = text/x-python
+r = text/r-src
rb = text/x-ruby
scala = text/x-scala
+st = text/x-stsrc
+v = text/x-verilog
+vh = text/x-verilog
+vm = text/velocity
+yaml = text/x-yaml
diff --git a/lib/codemirror/cm3.defs b/lib/codemirror/cm3.defs
index 9679b1b..84f09c3 100644
--- a/lib/codemirror/cm3.defs
+++ b/lib/codemirror/cm3.defs
@@ -25,18 +25,36 @@
CM3_MODES = [
'clike/clike.js',
'clojure/clojure.js',
+ 'coffeescript/coffeescript.js',
'commonlisp/commonlisp.js',
'css/css.js',
+ 'd/d.js',
+ 'diff/diff.js',
+ 'dtd/dtd.js',
+ 'erlang/erlang.js',
+ 'gas/gas.js',
+ 'gfm/gfm.js',
'go/go.js',
'groovy/groovy.js',
+ 'haskell/haskell.js',
'htmlmixed/htmlmixed.js',
'javascript/javascript.js',
+ 'lua/lua.js',
+ 'markdown/markdown.js',
'perl/perl.js',
+ 'php/php.js',
+ 'pig/pig.js',
'properties/properties.js',
'python/python.js',
+ 'r/r.js',
'ruby/ruby.js',
+ 'scheme/scheme.js',
'shell/shell.js',
+ 'smalltalk/smalltalk.js',
'sql/sql.js',
+ 'tcl/tcl.js',
'velocity/velocity.js',
+ 'verilog/verilog.js',
'xml/xml.js',
+ 'yaml/yaml.js',
]