diff options
author | Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> | 2024-03-10 01:08:30 +0000 |
---|---|---|
committer | Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> | 2024-03-10 01:08:30 +0000 |
commit | 6d2e2bed67658fb49e225a1c008a6c080ec7511a (patch) | |
tree | e3ac8b41ce89dd490137f54418017d6c9000f70d /app | |
parent | 15f1845aeecf922ce058533d670c716ed4b6b9e0 (diff) | |
download | infinity-for-reddit-6d2e2bed67658fb49e225a1c008a6c080ec7511a.tar infinity-for-reddit-6d2e2bed67658fb49e225a1c008a6c080ec7511a.tar.gz infinity-for-reddit-6d2e2bed67658fb49e225a1c008a6c080ec7511a.tar.bz2 infinity-for-reddit-6d2e2bed67658fb49e225a1c008a6c080ec7511a.tar.lz infinity-for-reddit-6d2e2bed67658fb49e225a1c008a6c080ec7511a.tar.xz infinity-for-reddit-6d2e2bed67658fb49e225a1c008a6c080ec7511a.tar.zst infinity-for-reddit-6d2e2bed67658fb49e225a1c008a6c080ec7511a.zip |
Optimize spoiler richtext_json.
Diffstat (limited to 'app')
-rw-r--r-- | app/src/main/java/ml/docilealligator/infinityforreddit/markdown/RichTextJSONConverter.java | 16 |
1 files changed, 7 insertions, 9 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 8d05bc49..c2ebc35a 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/RichTextJSONConverter.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/markdown/RichTextJSONConverter.java @@ -217,7 +217,7 @@ public class RichTextJSONConverter implements Visitor { @Override public void visit(Document document) { - + //Ignore } @Override @@ -254,7 +254,7 @@ public class RichTextJSONConverter implements Visitor { @Override public void visit(HardLineBreak hardLineBreak) { - + //Ignore } @Override @@ -295,7 +295,7 @@ public class RichTextJSONConverter implements Visitor { @Override public void visit(ThematicBreak thematicBreak) { - + //Not supported by Reddit } @Override @@ -479,7 +479,7 @@ public class RichTextJSONConverter implements Visitor { @Override public void visit(SoftLineBreak softLineBreak) { - + //Ignore } @Override @@ -507,11 +507,11 @@ public class RichTextJSONConverter implements Visitor { @Override public void visit(CustomNode customNode) { - /* + if (customNode instanceof Superscript) { + /* Superscript can still has inline spans, thus checking children's next node until the end. Superscript must use ^(), not ^ right now. */ - if (customNode instanceof Superscript) { Node child = customNode.getFirstChild(); while (child != null) { JSONArray format = getFormatArray(customNode); @@ -529,9 +529,7 @@ public class RichTextJSONConverter implements Visitor { JSONObject nodeJSON = new JSONObject(); nodeJSON.put(TYPE, SPOILER_E); - contentArrayStack.push(new JSONArray()); - - JSONArray cArray = contentArrayStack.pop(); + JSONArray cArray = new JSONArray(); JSONObject contentJSONObject = new JSONObject(); contentJSONObject.put(TYPE, TEXT_E); |