aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2021-01-18 02:45:08 +0000
committerAlex Ning <chineseperson5@gmail.com>2021-01-18 02:45:08 +0000
commit453b56d4855f396954904ddcb2cf1941e64b3a02 (patch)
treee1285e4b0477859516763c413277ce6ff3aca21c /app
parentc2abe90ba26c45173d91cbc77d80ccfd0a79bc40 (diff)
downloadinfinity-for-reddit-453b56d4855f396954904ddcb2cf1941e64b3a02.tar
infinity-for-reddit-453b56d4855f396954904ddcb2cf1941e64b3a02.tar.gz
infinity-for-reddit-453b56d4855f396954904ddcb2cf1941e64b3a02.tar.bz2
infinity-for-reddit-453b56d4855f396954904ddcb2cf1941e64b3a02.tar.lz
infinity-for-reddit-453b56d4855f396954904ddcb2cf1941e64b3a02.tar.xz
infinity-for-reddit-453b56d4855f396954904ddcb2cf1941e64b3a02.tar.zst
infinity-for-reddit-453b56d4855f396954904ddcb2cf1941e64b3a02.zip
Fix regex matcher for # heading.
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/utils/Utils.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/Utils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/Utils.java
index b71d3d0f..b460a240 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/Utils.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/Utils.java
@@ -41,7 +41,12 @@ public class Utils {
.replaceAll("((?<=[\\s])|^)/[rRuU]/[\\w-]+/{0,1}", "[$0](https://www.reddit.com$0)")
.replaceAll("((?<=[\\s])|^)[rRuU]/[\\w-]+/{0,1}", "[$0](https://www.reddit.com/$0)")
.replaceAll("\\^{2,}", "^")
- .replaceAll("(?<![\\[\\(])#(?![# ])(?![\\w\\s]*[\\]\\)])", "# "));
+ .replaceAll("^#(?!($|\\s))", "# ")
+ .replaceAll("^##(?!($|\\s))", "## ")
+ .replaceAll("^###(?!($|\\s))", "### ")
+ .replaceAll("^####(?!($|\\s))", "#### ")
+ .replaceAll("^#####(?!($|\\s))", "##### ")
+ .replaceAll("^######(?!($|\\s))", "###### "));
//Fix superscript
int startIndex = regexed.indexOf("^");