diff options
author | Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> | 2024-03-09 15:06:29 +0000 |
---|---|---|
committer | Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> | 2024-03-09 15:06:29 +0000 |
commit | 3ef64e2a170f91617d9e86a866d39b4ba4aa13e9 (patch) | |
tree | 4660db9f2b10f9e085c9a84d2719c08bc3409f97 | |
parent | 14a451bdc871e263b6a015e6c570b446e11e7af5 (diff) | |
download | infinity-for-reddit-3ef64e2a170f91617d9e86a866d39b4ba4aa13e9.tar infinity-for-reddit-3ef64e2a170f91617d9e86a866d39b4ba4aa13e9.tar.gz infinity-for-reddit-3ef64e2a170f91617d9e86a866d39b4ba4aa13e9.tar.bz2 infinity-for-reddit-3ef64e2a170f91617d9e86a866d39b4ba4aa13e9.tar.lz infinity-for-reddit-3ef64e2a170f91617d9e86a866d39b4ba4aa13e9.tar.xz infinity-for-reddit-3ef64e2a170f91617d9e86a866d39b4ba4aa13e9.tar.zst infinity-for-reddit-3ef64e2a170f91617d9e86a866d39b4ba4aa13e9.zip |
BlockQuote richtext_json.
Diffstat (limited to '')
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/markdown/RichTextJSONConverter.java | 19 |
1 files changed, 18 insertions, 1 deletions
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 |