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

Commit

Permalink
Add support for language parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
Siavash Safi committed Sep 15, 2017
1 parent 8751751 commit ceb0718
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/main/java/com/catawiki/jira/prism/Code.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ public String execute(Map<String, Object> parameters, String body, RenderContext

ImmutableMap.Builder<String, Object> templateParams = ImmutableMap.builder();

// Default language
String language = "ruby";

// Code body
templateParams.put("content", body);

Expand All @@ -47,6 +50,13 @@ public String execute(Map<String, Object> parameters, String body, RenderContext

for (Map.Entry<String, Object> entry : parameters.entrySet()) {
switch (entry.getKey()) {
case "language":
case "lang":
String parameter = (String) entry.getValue();
if (checkLanguage(parameter)) {
language = parameter;
}
break;
case "highlight":
case "hl":
templateParams.put("highlight", (String) entry.getValue());
Expand All @@ -68,7 +78,7 @@ public String execute(Map<String, Object> parameters, String body, RenderContext
}
}

String language = "ruby";
// Check for language as first parameter
if (parameters.containsKey("0")) {
String parameter = (String) parameters.get("0");
if (checkLanguage(parameter)) {
Expand Down

0 comments on commit ceb0718

Please sign in to comment.