diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/ui/BrowserApp.java | 28 |
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. */ |