Skip to content

Commit

Permalink
update codeSnippet
Browse files Browse the repository at this point in the history
  • Loading branch information
gkwan-ibm committed Feb 14, 2022
1 parent 64d1c62 commit 5bb3583
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/main/java/Functions.java
Original file line number Diff line number Diff line change
Expand Up @@ -866,21 +866,22 @@ public static ArrayList<String> mains(ArrayList<String> listOfLines, Properties
//inserts code snippet (Finds the right code snippet and inserts it into the text
public static ArrayList<String> codeSnippet(ArrayList<String> listOfLines, String guideName, String branch,
int i, String path, ArrayList<String> hideList) {
String p = path.trim();
try {
ArrayList<String> code = new ArrayList<String>();
URL url = new URL("https://raw.githubusercontent.com/openliberty/" + guideName + "/" + branch + "/" + path);
URL url = new URL("https://raw.githubusercontent.com/openliberty/" + guideName + "/" + branch + "/" + p);
Scanner s = new Scanner(url.openStream());
String inputLine = null;
code.add("\n");
if (path.endsWith(".java")) {
if (p.endsWith(".java")) {
code.add("```java\n");
} else if((path.endsWith(".js"))) {
} else if((p.endsWith(".js"))) {
code.add("```javascript\n");
} else if((path.endsWith(".json"))) {
} else if((p.endsWith(".json"))) {
code.add("```json\n");
} else if((path.endsWith(".xml"))) {
} else if((p.endsWith(".xml"))) {
code.add("```xml\n");
} else if((path.endsWith(".yaml"))) {
} else if((p.endsWith(".yaml"))) {
code.add("```yaml\n");
} else {
code.add("```\n");
Expand Down

0 comments on commit 5bb3583

Please # to comment.