Skip to content
This repository has been archived by the owner on Oct 26, 2022. It is now read-only.

Commit

Permalink
Remove language checks from Java code (#32)
Browse files Browse the repository at this point in the history
We don't need the language checks in Java code since the code with render with
no highlighting if a unsupported language is specified.
This also remove the requirement of updating the Java code each time a
new language is added to upstream.
  • Loading branch information
siavashs authored Feb 29, 2020
1 parent db68046 commit 2dedc12
Showing 1 changed file with 2 additions and 208 deletions.
210 changes: 2 additions & 208 deletions src/main/java/com/catawiki/jira/prism/Code.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,7 @@ public String execute(Map<String, Object> parameters, String body, RenderContext
switch (entry.getKey()) {
case "language":
case "lang":
String parameter = (String) entry.getValue();
if (checkLanguage(parameter)) {
language = parameter;
}
language = (String) entry.getValue();
break;
case "title":
templateParams.put("title", (String) entry.getValue());
Expand Down Expand Up @@ -93,10 +90,7 @@ public String execute(Map<String, Object> parameters, String body, RenderContext

// Check for language as first parameter
if (parameters.containsKey("0")) {
String parameter = (String) parameters.get("0");
if (checkLanguage(parameter)) {
language = parameter;
}
language = (String) parameters.get("0");
}
templateParams.put("language", language);

Expand All @@ -109,204 +103,4 @@ public String execute(Map<String, Object> parameters, String body, RenderContext
return String.format(FALLBACK_RENDER_OUTPUT, body);
}
}

private Boolean checkLanguage(String language) {
switch (language) {
case "abap":
case "actionscript":
case "ada":
case "adoc":
case "apacheconf":
case "apl":
case "applescript":
case "arduino":
case "arff":
case "asciidoc":
case "asm6502":
case "aspnet":
case "autohotkey":
case "autoit":
case "bash":
case "basic":
case "batch":
case "bison":
case "bnf":
case "abnf":
case "ebnf":
case "rbnf":
case "brainfuck":
case "bro":
case "c":
case "cil":
case "clike":
case "clojure":
case "cmake":
case "coffee":
case "coffeescript":
case "cpp":
case "crystal":
case "csharp":
case "csp":
case "css":
case "d":
case "dart":
case "diff":
case "django":
case "docker":
case "dockerfile":
case "dotnet":
case "eiffel":
case "ejs":
case "elisp":
case "elixir":
case "elm":
case "emacs":
case "erb":
case "erlang":
case "flow":
case "fortran":
case "fsharp":
case "gamemakerlanguage":
case "gcode":
case "gedcom":
case "gherkin":
case "git":
case "glsl":
case "go":
case "graphql":
case "groovy":
case "haml":
case "handlebars":
case "haskell":
case "haxe":
case "hcl":
case "hpkp":
case "hs":
case "hsts":
case "html":
case "http":
case "ichigojam":
case "icon":
case "inform7":
case "ini":
case "io":
case "j":
case "javadoclike":
case "javadoc":
case "java":
case "javascript":
case "javastacktrace":
case "jinja2":
case "jolie":
case "jsdoc":
case "json":
case "json5":
case "jsonp":
case "js":
case "jsx":
case "julia":
case "keyman":
case "kotlin":
case "latex":
case "less":
case "liquid":
case "lisp":
case "livescript":
case "lolcode":
case "lua":
case "makefile":
case "markdown":
case "markup":
case "mathml":
case "matlab":
case "md":
case "mel":
case "mizar":
case "monkey":
case "n1ql":
case "n4jsd":
case "n4js":
case "nasm":
case "nginx":
case "nim":
case "nix":
case "nsis":
case "objectivec":
case "objectpascal":
case "ocaml":
case "opencl":
case "oz":
case "parigp":
case "parser":
case "pascal":
case "perl":
case "php":
case "phpdoc":
case "plsql":
case "powershell":
case "processing":
case "prolog":
case "properties":
case "protobuf":
case "pug":
case "puppet":
case "pure":
case "py":
case "python":
case "q":
case "qore":
case "r":
case "rb":
case "reason":
case "regex":
case "renpy":
case "rest":
case "rip":
case "roboconf":
case "ruby":
case "rust":
case "sas":
case "sass":
case "scala":
case "scheme":
case "scss":
case "shell":
case "smalltalk":
case "smarty":
case "soy":
case "sql":
case "stylus":
case "svg":
case "swift":
case "t4":
case "tap":
case "tcl":
case "textile":
case "toml":
case "ts":
case "tsx":
case "tt2":
case "twig":
case "typescript":
case "vala":
case "vbnet":
case "vb":
case "velocity":
case "verilog":
case "vhdl":
case "vim":
case "wasm":
case "wiki":
case "xeoracube":
case "xeora":
case "xml":
case "xojo":
case "xquery":
case "yaml":
case "yml":
return true;
default:
return false;
}
}
}

0 comments on commit 2dedc12

Please sign in to comment.