aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2024-03-10 01:08:30 +0000
committerDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2024-03-10 01:08:30 +0000
commit6d2e2bed67658fb49e225a1c008a6c080ec7511a (patch)
treee3ac8b41ce89dd490137f54418017d6c9000f70d
parent15f1845aeecf922ce058533d670c716ed4b6b9e0 (diff)
downloadinfinity-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.
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/markdown/RichTextJSONConverter.java16
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);