From 3ef64e2a170f91617d9e86a866d39b4ba4aa13e9 Mon Sep 17 00:00:00 2001 From: Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> Date: Sat, 9 Mar 2024 10:06:29 -0500 Subject: BlockQuote richtext_json. --- .../markdown/RichTextJSONConverter.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'app/src/main/java/ml') diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/RichTextJSONConverter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/RichTextJSONConverter.java index a2a3efb5..1b55eb6c 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/RichTextJSONConverter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/RichTextJSONConverter.java @@ -98,7 +98,6 @@ public class RichTextJSONConverter implements Visitor { } richText.put(DOCUMENT, document); - return richText; } @@ -138,7 +137,25 @@ public class RichTextJSONConverter implements Visitor { @Override public void visit(BlockQuote blockQuote) { + try { + JSONObject nodeJSON = new JSONObject(); + nodeJSON.put(TYPE, BLOCKQUOTE_E); + + contentArrayStack.push(new JSONArray()); + Node child = blockQuote.getFirstChild(); + while (child != null) { + child.accept(this); + child = child.getNext(); + } + + JSONArray cArray = contentArrayStack.pop(); + + nodeJSON.put(CONTENT, cArray); + contentArrayStack.peek().put(nodeJSON); + } catch (JSONException e) { + throw new RuntimeException(e); + } } @Override -- cgit v1.2.3