aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorj-james2022-10-18 22:33:25 +0000
committerj-james2022-10-18 22:33:25 +0000
commit9a512732accf6869764fedc7c5d1abad57c6cb28 (patch)
treeceae1afda8bc4c0e16dcb156162f4753b9b268c6 /src/main
parentcea4d2b83f68ed2223ab1b07061dd7a7b709d2af (diff)
Pass checkstyle
Diffstat (limited to 'src/main')
-rw-r--r--src/main/ui/BrowserApp.java28
1 files changed, 18 insertions, 10 deletions
diff --git a/src/main/ui/BrowserApp.java b/src/main/ui/BrowserApp.java
index fa47f48..8a50ea4 100644
--- a/src/main/ui/BrowserApp.java
+++ b/src/main/ui/BrowserApp.java
@@ -33,22 +33,30 @@ public class BrowserApp {
println(border);
ArrayList<String> rawHtml = new ArrayList<>();
rawHtml.add(file);
- while (true) {
- println("Page rendered. Input additional raw HTML if desired.");
- rawHtml.add(input.next());
- println(border);
- for (String s : rawHtml) {
- parser = new HtmlParser();
- renderHtml(parser.parseHtml(s));
- }
- println(border);
- }
+ mainLoop(rawHtml, border, parser);
} catch (Exception e) {
println("Reading from the file failed with " + e.toString());
println("Please try again.");
}
}
+
+ /**
+ * EFFECTS: Runs the main loop
+ */
+ private void mainLoop(ArrayList<String> rawHtml, String border, HtmlParser parser) {
+ while (true) {
+ println("Page rendered. Input additional raw HTML if desired.");
+ rawHtml.add(input.next());
+ println(border);
+ for (String s : rawHtml) {
+ parser = new HtmlParser();
+ renderHtml(parser.parseHtml(s));
+ }
+ println(border);
+ }
+ }
+
/**
* EFFECTS: Barebones HTML rendering. Iterates through a list of Nodes and their children and prints any text.
*/