diff --git a/.github/workflows/testing-GuideConverter.yml b/.github/workflows/testing-GuideConverter.yml index e45cb6e..7618439 100644 --- a/.github/workflows/testing-GuideConverter.yml +++ b/.github/workflows/testing-GuideConverter.yml @@ -11,7 +11,7 @@ jobs: steps: # Any prerequisite steps - - uses: actions/checkout@master + - uses: actions/checkout@main - name: Checkout guide-getting-started uses: actions/checkout@v2 @@ -29,7 +29,7 @@ jobs: uses: actions/checkout@v2 with: repository: OpenLiberty/guides-common - path: Guides-common + path: guides-common - uses: actions/setup-java@v1 with: @@ -39,3 +39,11 @@ jobs: - name: Testing with Maven run: mvn -Dtest=TestMain test + + - name: Post tests + if: always() + run: | + echo ===testing-clone-method.md=== + cat testing-clone-method.md + echo ===clone.md=== + cat clone.md diff --git a/src/main/java/CloudHostedGuideConverter.java b/src/main/java/CloudHostedGuideConverter.java index 375febb..f053791 100644 --- a/src/main/java/CloudHostedGuideConverter.java +++ b/src/main/java/CloudHostedGuideConverter.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2020, 2021 IBM Corporation and others. + * Copyright (c) 2020, 2022 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -22,115 +22,112 @@ public static void main(String[] args) throws Exception { String guideName = args[0]; String branch = args[1]; - getMD(guideName, branch); + String gitLab = args.length > 2 ? args[2] : "cloud-hosted-" + guideName; + System.out.println("Converting " + guideName + " on branch " + branch + " to lab " + gitLab); + convertToMD(guideName, branch, gitLab); System.out.println("Guide converted"); System.out.println("Find markdown in " + guideName + ".md"); } // Reads the adoc from github, and writes it to an arraylist - public static void getMD(String guideName, String branch) throws IOException { - Scanner s = null; - FileInputStream ip = null; - FileInputStream ips = null; + public static void convertToMD(String guideName, String branch, String gitLab) throws IOException { + Scanner scanner = null; + FileInputStream lrpfis = null; + FileInputStream rpfis = null; try { //read adoc file from the open liberty guide File guide = new File(guideName + "/README.adoc"); -// URL url = new URL("https://raw.githubusercontent.com/openliberty/" + guideName + "/" + branch + "/README.adoc"); - s = new Scanner(guide); -// ArrayList for whole text file - ArrayList listOfLines = new ArrayList<>(); + scanner = new Scanner(guide); + // ArrayList to hold the whole converted markdown format content + ArrayList mdContent = new ArrayList<>(); + + int m = Functions.addSNLMetadata(mdContent, guideName, gitLab); - String GuideTitle = null; - String GuideDescription = null; + String guideTitle = null; + String guideDescription = null; - Properties prop = new Properties(); - Properties props = new Properties(); + Properties loopReplacementsProps = new Properties(); + Properties replacementsProps = new Properties(); - ip = new FileInputStream("loopReplacements.properties"); - ips = new FileInputStream("replacements.properties"); + lrpfis = new FileInputStream("loopReplacements.properties"); + rpfis = new FileInputStream("replacements.properties"); - prop.load(ip); - props.load(ips); + loopReplacementsProps.load(lrpfis); + replacementsProps.load(rpfis); + // write each line into the file + while (scanner.hasNextLine()) { + String inputLine = scanner.nextLine() + "\n"; -// write each line into the file - while (s.hasNextLine()) { - String inputLine = s.nextLine() + "\n"; - + // process the guide title and description if (inputLine.startsWith("= ")) { - GuideTitle = inputLine; - if (!s.nextLine().isEmpty() || !s.nextLine().isBlank()) { - s.nextLine(); - s.nextLine(); - GuideDescription = s.nextLine(); - GuideDescription = GuideDescription.substring(GuideDescription.lastIndexOf(":") + 1, GuideDescription.length()); - } - continue; + guideTitle = inputLine; + if (!scanner.nextLine().isEmpty() || !scanner.nextLine().isBlank()) { + scanner.nextLine(); + scanner.nextLine(); + guideDescription = scanner.nextLine(); + guideDescription = guideDescription.substring(guideDescription.lastIndexOf(":") + 1, guideDescription.length()); } - - if (inputLine.equals(GuideDescription)) { - inputLine = ""; + continue; } + // skip the Windows and Mac specific content if (inputLine.startsWith("[.tab_content.windows_section.mac_section]")) { - - while (!s.nextLine().startsWith("[.tab_content.linux_section]")) { + while (!scanner.nextLine().startsWith("[.tab_content.linux_section]")) { continue; } } - + // skip the Windows specific content if (inputLine.startsWith("[.tab_content.windows_section]")) { - while (!s.nextLine().startsWith("[.tab_content.mac_section")) { + while (!scanner.nextLine().startsWith("[.tab_content.mac_section")) { continue; } } - + // skip the static guide content that marked by ifndef::cloud-hosted if (inputLine.startsWith("ifndef::cloud-hosted[]")) { - while (!s.nextLine().startsWith("endif::[]")) { + while (!scanner.nextLine().startsWith("endif::[]")) { continue; } } - listOfLines.add(inputLine); + mdContent.add(inputLine); } - - Functions.addPriorStep1(listOfLines, 0, guideName, GuideTitle, GuideDescription); // Runs the src.main.java.Functions.class - Functions.ConditionsMethod(listOfLines, guideName, branch, prop, props); -// Functions.Next(listOfLines); - Functions.end(listOfLines, guideName, GuideTitle); + Functions.addPriorStep1(mdContent, m, guideName, guideTitle, guideDescription); + Functions.ConditionsMethod(mdContent, guideName, branch, loopReplacementsProps, replacementsProps); + Functions.end(mdContent, guideName, guideTitle); - //String builder to format the arraylist + // Convert the listOfLines to StringBuilder StringBuilder builder = new StringBuilder(); - for (String value : listOfLines) { + for (String value : mdContent) { + if (value.contains("{: codeblock}")) + continue; builder.append(value); } - String text = builder.toString(); - - writeToFile(text, guideName); + // Write the converted content to the file + writeToFile(builder.toString(), guideName); } catch (IOException ex) { System.out.println(ex); } finally { - if (s != null) { - s.close(); - ip.close(); - ips.close(); + if (scanner != null) { + scanner.close(); + lrpfis.close(); + rpfis.close(); } } } // append to md file - public static void writeToFile(String str, String guideName) - throws IOException { + public static void writeToFile(String str, String guideName) throws IOException { BufferedWriter writer = new BufferedWriter(new FileWriter(guideName + ".md")); - writer.append("\n" + str); + writer.append(str + "\n"); writer.close(); } } diff --git a/src/main/java/Functions.java b/src/main/java/Functions.java index 1f68d09..b760f9a 100644 --- a/src/main/java/Functions.java +++ b/src/main/java/Functions.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2020, 2021 IBM Corporation and others. + * Copyright (c) 2020, 2022 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -9,15 +9,15 @@ * IBM Corporation - Initial implementation *******************************************************************************/ +import java.io.File; +import java.io.FileInputStream; import java.io.IOException; -import java.net.PasswordAuthentication; import java.net.URL; import java.util.ArrayList; import java.util.Properties; import java.util.Scanner; import java.util.regex.Matcher; import java.util.regex.Pattern; -import java.util.Arrays; class LinkSets { String linkName; @@ -136,6 +136,8 @@ public static void addCodeblockAfterMVN(ArrayList listOfLines, int i) { } return; } + // To be removed: - no need to add {: cdodeblock} + /* if (!listOfLines.get(i + 2).startsWith("mvn")) { for (int l = i; l < listOfLines.size(); l++) { if (listOfLines.get(l).contains("----")) { @@ -143,6 +145,7 @@ public static void addCodeblockAfterMVN(ArrayList listOfLines, int i) { } } } + */ } } } @@ -182,7 +185,7 @@ public static ArrayList relatedGuides(ArrayList listOfLines, int String relatedGuidesName = e.substring(1, e.length() - 1); String getTitle = null; try { - URL url = new URL("https://raw.githubusercontent.com/openliberty/guide-" + relatedGuidesName + "/master/README.adoc"); + URL url = new URL("https://raw.githubusercontent.com/openliberty/guide-" + relatedGuidesName + "/prod/README.adoc"); Scanner s = new Scanner(url.openStream()); String inputLine = null; while (s.hasNextLine()) { @@ -193,7 +196,6 @@ public static ArrayList relatedGuides(ArrayList listOfLines, int } } } catch (IOException ex) { - System.out.println("Guide contains iGuide reference"); } if (getTitle != null) { @@ -214,7 +216,6 @@ public static ArrayList relatedGuides(ArrayList listOfLines, int } } } catch (IOException ex) { - System.out.println(ex); } getTitle = getTitle.substring(+8, getTitle.length() - 2); @@ -241,7 +242,7 @@ public static String Next(ArrayList listOfLines) { String text = builder.toString(); - String whereToNext = "\n\n
\n## **Where to next?**\n\n" + text; + String whereToNext = "\n\n### Where to next?\n\n" + text; return whereToNext; @@ -267,7 +268,9 @@ public static void removeDiagramReference(ArrayList listOfLines, int i) } } + // To be removed - no need to add {: cdodeblock} // This is a function that inserts {: cdodeblock} after a codeblock + /* public static void insertCopyButton(ArrayList listOfLines, int i) { ArrayList check = new ArrayList<>(); int y = 0; @@ -289,7 +292,8 @@ public static void insertCopyButton(ArrayList listOfLines, int i) { } } } - + */ + // This removes any windows commands that are use in the guides. This is because we use a pre installed environment given to the users online. This environment is a linux OS so there for windwows commands are not required. public static void removeWindowsCommand(ArrayList listOfLines, int i) { int counters = 0; @@ -445,7 +449,7 @@ public static void codeInsert(String atIndex, ArrayList listOfLines, Str } } - update(listOfLines, guideName, branch, g, position, hideList); + openFile("Update", "start", listOfLines, guideName, branch, g, position, hideList); } else if (atIndex.startsWith("#Replace")) { @@ -491,7 +495,7 @@ public static void codeInsert(String atIndex, ArrayList listOfLines, Str } } - replace(listOfLines, guideName, branch, g, position, hideList); + openFile("Replace", "start", listOfLines, guideName, branch, g, position, hideList); } else if (atIndex.startsWith("#Update") && position == "finishUpdate") { @@ -537,7 +541,7 @@ public static void codeInsert(String atIndex, ArrayList listOfLines, Str } } - updateFinish(listOfLines, guideName, branch, g, position, hideList); + openFile("Update", "finish", listOfLines, guideName, branch, g, position, hideList); } } @@ -567,6 +571,24 @@ public static void removeLast(String guideName) { System.out.println(ex); } } + + public static int addSNLMetadata(ArrayList listOfLines, String guideName, String gitLab) { + ArrayList temp = new ArrayList<>(); + Properties vhsdProperties = new Properties(); + try { + vhsdProperties.load(new FileInputStream("version-history-start-date.properties")); + } catch (Exception ex) { + System.out.println(ex); + } + temp.add("---\n"); + temp.add("markdown-version: v1\n"); + temp.add("title: instructions\n"); + temp.add("branch: " + vhsdProperties.getProperty(gitLab + ".branch","lab-204-instruction") + "\n"); + temp.add("version-history-start-date: " + vhsdProperties.getProperty(gitLab + ".start-date", "2022-02-09T14:19:17.000Z") + "\n"); + temp.add("---\n"); + listOfLines.addAll(temp); + return temp.size(); + } public static void addPriorStep1(ArrayList listOfLines, int i, String guideName, String GuideTitle, String GuideDescription) { @@ -612,8 +634,9 @@ public static void commons(ArrayList listOfLines, String guideName, int // This function adds in the last steps of a guide. public static void finish(ArrayList listOfLines, String lastLine, String guideName, int i) { - String Summery = "# **Summary**\n\n## **Nice Work!**\n\n" + lastLine; - listOfLines.set(i, Summery); + //String summary = "::page{title=\"Summary\"}\n\n## **Nice Work!**\n\n" + lastLine; + String summary = "# **Summary**\n\n### Nice Work!\n\n" + lastLine; + listOfLines.set(i, summary); } public static void end(ArrayList listOfLines, String guideName, String GuideTitle) { @@ -626,13 +649,58 @@ public static void end(ArrayList listOfLines, String guideName, String G System.out.println(FeedbackLink); - listOfLines.add("\n
\n## **Clean up your environment**\n\n\nClean up your online environment so that it is ready to be used with the next guide:\n\nDelete the **" + guideName + "** project by running the following commands:\n\n```\ncd /home/project\nrm -fr " + guideName + "\n```\n{: codeblock}\n\n" + - "
\n## **What did you think of this guide?**\n\nWe want to hear from you. To provide feedback, click the following link.\n\n" + "* [Give us feedback](" + FeedbackLink + ")" + "\n\nOr, click the **Support/Feedback** button in the IDE and select the **Give feedback** option. Fill in the fields, choose the **General** category, and click the **Post Idea** button.\n\n" + - "
\n## **What could make this guide better?**\n\nYou can also provide feedback or contribute to this guide from GitHub.\n* [Raise an issue to share feedback.](https://github.com/OpenLiberty/" + guideName + "/issues)\n" + "* [Create a pull request to contribute to this guide.](https://github.com/OpenLiberty/" + guideName + "/pulls)\n\n" + + listOfLines.add("\n### Clean up your environment\n\n\nClean up your online environment so that it is ready to be used with the next guide:\n\nDelete the ***" + guideName + "*** project by running the following commands:\n\n```bash\ncd /home/project\nrm -fr " + guideName + "\n```\n\n" + + "### What did you think of this guide?\n\nWe want to hear from you. To provide feedback, click the following link.\n\n" + "* [Give us feedback](" + FeedbackLink + ")" + "\n\nOr, click the **Support/Feedback** button in the IDE and select the **Give feedback** option. Fill in the fields, choose the **General** category, and click the **Post Idea** button.\n\n" + + "### What could make this guide better?\n\nYou can also provide feedback or contribute to this guide from GitHub.\n* [Raise an issue to share feedback.](https://github.com/OpenLiberty/" + guideName + "/issues)\n" + "* [Create a pull request to contribute to this guide.](https://github.com/OpenLiberty/" + guideName + "/pulls)\n\n" + Next(listOfLines) + "\n\n" + - "
\n## **Log out of the session**\n\nLog out of the cloud-hosted guides by selecting **Account** > **Logout** from the Skills Network menu."); + "### Log out of the session\n\nLog out of the cloud-hosted guides by selecting **Account** > **Logout** from the Skills Network menu."); } + private static String getFilePath(ArrayList listOfLines, int i) { + String filePath = null; + for (int x = i; x <= i + 10; x++) { + if (listOfLines.get(x).startsWith("include") && !listOfLines.get(x).startsWith("include::{common-includes}")) { + filePath = listOfLines.get(x); + filePath = filePath.substring(9, filePath.length() - 3); + } + } + return filePath == null ? "unknown" : listOfLines.get(i).replaceAll("`", "").trim(); + } + + private static String getIncludeFile(ArrayList listOfLines, int i) { + String filePath = null; + for (int x = i; x <= i + 10; x++) { + if (listOfLines.get(x).startsWith("include") && !listOfLines.get(x).startsWith("include::{common-includes}")) { + filePath = listOfLines.get(x); + filePath = filePath.substring(9, filePath.length() - 3); + return filePath.trim(); + } + } + return "unknown"; + } + + private static String openFile(String guideName, String filePath, String fromDir) { + File f = new File(filePath); + return "\n> To open the " + f .getName() + " file in your IDE, select\n" + + "> **File** > **Open** > " + guideName + "/" + fromDir + "/" + filePath.replaceAll("\\*\\*", "") + + ", or click the following button\n\n" + + "::openFile{path=\"/home/project/" + guideName + "/" + fromDir + "/" + filePath + "\"}" + + "\n\n\n"; + } + + //configures instructions to open file for replace and update + public static String openFile(String instruction, String fromDir, ArrayList listOfLines, String guideName, String branch, int i, String + position, ArrayList hideList) { + String filePath = getFilePath(listOfLines, i); + String includeFile = getIncludeFile(listOfLines, i); + lowercaseKeyword(instruction, listOfLines, i); + listOfLines.set(i, openFile(guideName, filePath, fromDir)); + codeSnippet(listOfLines, guideName, branch, i + 2, includeFile, hideList); + position = "main"; + return position; + } + + /* To be removed //configures instructions to replace file public static String replace(ArrayList listOfLines, String guideName, String branch, int i, String position, ArrayList hideList) { @@ -651,7 +719,7 @@ public static String replace(ArrayList listOfLines, String guideName, St listOfLines.set(i, listOfLines.get(i).replaceAll("#", "")); listOfLines.set(i, listOfLines.get(i).replaceAll("`", "**")); - listOfLines.set(i, "\n> From the menu of the IDE, select \n" + "> **File** > **Open** > " + guideName + "/start/" + listOfLines.get(i).replaceAll("\\*\\*", "") + "\n\n\n"); + listOfLines.set(i, "\n> From the menu of the IDE, select\n" + "> **File** > **Open** > " + guideName + "/start/" + listOfLines.get(i).replaceAll("\\*\\*", "") + "\n\n\n"); listOfLines.set(i, listOfLines.get(i).replaceAll("touch ", "")); codeSnippet(listOfLines, guideName, branch, i + 2, str, hideList); position = "main"; @@ -678,7 +746,7 @@ public static String update(ArrayList listOfLines, String guideName, Str } listOfLines.set(i, listOfLines.get(i).replaceAll("#", "")); listOfLines.set(i, listOfLines.get(i).replaceAll("`", "**")); - listOfLines.set(i, "\n> From the menu of the IDE, select \n" + "> **File** > **Open** > " + guideName + "/start/" + listOfLines.get(i).replaceAll("\\*\\*", "") + "\n\n\n"); + listOfLines.set(i, "\n> From the menu of the IDE, select\n" + "> **File** > **Open** > " + guideName + "/start/" + listOfLines.get(i).replaceAll("\\*\\*", "") + "\n\n\n"); listOfLines.set(i, listOfLines.get(i).replaceAll("touch ", "")); codeSnippet(listOfLines, guideName, branch, i + 2, str, hideList); position = "main"; @@ -704,32 +772,33 @@ public static String updateFinish(ArrayList listOfLines, String guideNam } listOfLines.set(i, listOfLines.get(i).replaceAll("#", "")); listOfLines.set(i, listOfLines.get(i).replaceAll("`", "**")); - listOfLines.set(i, "\n> From the menu of the IDE, select \n" + "> **File** > **Open** > " + guideName + "/finish/" + listOfLines.get(i).replaceAll("\\*\\*", "") + "\n\n\n"); + listOfLines.set(i, "\n> From the menu of the IDE, select\n" + "> **File** > **Open** > " + guideName + "/finish/" + listOfLines.get(i).replaceAll("\\*\\*", "") + "\n\n\n"); listOfLines.set(i, listOfLines.get(i).replaceAll("touch ", "")); codeSnippet(listOfLines, guideName, branch, i + 2, str, hideList); position = "main"; return position; } + */ //configures instructions to create file public static String touch(ArrayList listOfLines, String guideName, String branch, int i, String position, ArrayList hideList) { - String str = null; - for (int x = i; x <= i + 10; x++) { - if (listOfLines.get(x).startsWith("include") && !listOfLines.get(x).startsWith("include::{common-includes}")) { - - str = listOfLines.get(x); - str = str.substring(9, str.length() - 3); - } - } + + String filePath = getFilePath(listOfLines, i); + String includeFile = getIncludeFile(listOfLines, i); + File f = new File(filePath); lowercaseKeyword("Create", listOfLines, i); - if (str == null) { - str = "finish/" + listOfLines.get(i).replaceAll("`", ""); - } - listOfLines.set(i, "\n> Run the following touch command in your terminal\n" + "```\ntouch /home/project/" + guideName + "/start/" + listOfLines.get(i).replaceAll("`", "") + "```\n{: codeblock}\n\n" + "\n> Then from the menu of the IDE, select **File** > **Open** > " + guideName + "/start/" + listOfLines.get(i).replaceAll("`", "") + "\n\n\n"); - codeSnippet(listOfLines, guideName, branch, i + 2, str, hideList); + listOfLines.set(i, + "\n> Run the following touch command in your terminal\n" + + "```bash\ntouch /home/project/" + guideName + "/start/" + listOfLines.get(i).replaceAll("`", "") + "```\n\n" + + "\n> Then, to open the " + f.getName() + " file in your IDE, select" + + "\n> **File** > **Open** > " + guideName + "/start/" + filePath + + ", or click the following button\n\n" + + "::openFile{path=\"/home/project/" + guideName + "/start/" + filePath + "\"}" + + "\n\n\n"); + codeSnippet(listOfLines, guideName, branch, i + 2, includeFile, hideList); position = "main"; return position; } @@ -758,17 +827,17 @@ public static void link(ArrayList listOfLines, int i) { listOfLines.set(i, listOfLines.get(i).replaceAll(link + "\\[" + description + "\\^\\]", "")); if (listOfLines.get(i).contains("admin")) { localhostSplit[0] = localhostSplit[0].replaceAll("\\[(.*?)\\^\\]", ""); - listOfLines.set(i, "\n" + fullText + ("\n\n_To see the output for this URL in the IDE, run the following command at a terminal:_\n\n```\ncurl -k -u admin " + appendJQ(link) + "\n```\n{: codeblock}\n\n\n")); + listOfLines.set(i, "\n" + fullText + ("\n\n_To see the output for this URL in the IDE, run the following command at a terminal:_\n\n```bash\ncurl -k -u admin " + appendJQ(link) + "\n```\n\n\n")); ifAdminLink(listOfLines, listOfLines.size(), link); } else if (localhostSplit.length >= 2) { - listOfLines.set(i, "\n" + fullText + ("\n\n_To see the output for this URL in the IDE, run the following command at a terminal:_\n\n```\ncurl " + appendJQ(link) + "\n```\n{: codeblock}\n\n\n")); + listOfLines.set(i, "\n" + fullText + ("\n\n_To see the output for this URL in the IDE, run the following command at a terminal:_\n\n```bash\ncurl " + appendJQ(link) + "\n```\n\n\n")); } else { - listOfLines.set(i, "\n" + fullText + ("\n\n_To see the output for this URL in the IDE, run the following command at a terminal:_\n\n```\ncurl " + appendJQ(link) + "\n```\n{: codeblock}\n\n\n")); + listOfLines.set(i, "\n" + fullText + ("\n\n_To see the output for this URL in the IDE, run the following command at a terminal:_\n\n```bash\ncurl " + appendJQ(link) + "\n```\n\n\n")); } return; } else { if (!listOfLines.get(i).contains("curl")) { - listOfLines.set(i, "\n" + listOfLines.get(i).replaceAll(link + "\\[" + description + "\\^\\]", link) + "\n\n_To see the output for this URL in the IDE, run the following command at a terminal:_\n\n```\ncurl " + appendJQ(link) + "\n```\n{: codeblock}\n\n\n"); + listOfLines.set(i, "\n" + listOfLines.get(i).replaceAll(link + "\\[" + description + "\\^\\]", link) + "\n\n_To see the output for this URL in the IDE, run the following command at a terminal:_\n\n```bash\ncurl " + appendJQ(link) + "\n```\n\n"); } } } @@ -844,13 +913,28 @@ public static ArrayList mains(ArrayList listOfLines, Properties //inserts code snippet (Finds the right code snippet and inserts it into the text public static ArrayList codeSnippet(ArrayList listOfLines, String guideName, String branch, int i, String path, ArrayList hideList) { + String p = path.trim(); try { ArrayList code = new ArrayList(); - 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"); - code.add("```\n"); + if (p.endsWith(".java")) { + code.add("```java\n"); + } else if((p.endsWith(".js"))) { + code.add("```javascript\n"); + } else if((p.endsWith(".json"))) { + code.add("```json\n"); + } else if((p.endsWith(".xml"))) { + code.add("```xml\n"); + } else if((p.endsWith(".yaml"))) { + code.add("```yaml\n"); + } else if((p.endsWith(".html"))) { + code.add("```html\n"); + } else { + code.add("```\n"); + } while (s.hasNextLine()) { inputLine = s.nextLine() + "\n"; @@ -869,7 +953,6 @@ public static ArrayList codeSnippet(ArrayList listOfLines, Strin if (hideList != null) { for (String e : newList) { - if (inputLine.contains("tag::" + e)) { while (!s.nextLine().contains("end::" + e)) { continue; @@ -892,6 +975,13 @@ public static ArrayList codeSnippet(ArrayList listOfLines, Strin if (inputLine.contains("# end::")) { inputLine = ""; } + + if (inputLine.contains("