mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-30 21:07:11 +01:00
Add custom superscript processor
This commit is contained in:
parent
2cdf523eff
commit
1960bb5ea1
@ -153,6 +153,7 @@ dependencies {
|
|||||||
implementation "io.noties.markwon:linkify:$markwonVersion"
|
implementation "io.noties.markwon:linkify:$markwonVersion"
|
||||||
implementation "io.noties.markwon:recycler-table:$markwonVersion"
|
implementation "io.noties.markwon:recycler-table:$markwonVersion"
|
||||||
implementation "io.noties.markwon:simple-ext:$markwonVersion"
|
implementation "io.noties.markwon:simple-ext:$markwonVersion"
|
||||||
|
implementation "io.noties.markwon:html:$markwonVersion"
|
||||||
implementation "io.noties.markwon:inline-parser:$markwonVersion"
|
implementation "io.noties.markwon:inline-parser:$markwonVersion"
|
||||||
implementation 'com.atlassian.commonmark:commonmark-ext-gfm-tables:0.14.0'
|
implementation 'com.atlassian.commonmark:commonmark-ext-gfm-tables:0.14.0'
|
||||||
implementation 'me.saket:better-link-movement-method:2.2.0'
|
implementation 'me.saket:better-link-movement-method:2.2.0'
|
||||||
|
@ -50,6 +50,8 @@ import io.noties.markwon.Markwon;
|
|||||||
import io.noties.markwon.MarkwonConfiguration;
|
import io.noties.markwon.MarkwonConfiguration;
|
||||||
import io.noties.markwon.core.MarkwonTheme;
|
import io.noties.markwon.core.MarkwonTheme;
|
||||||
import io.noties.markwon.ext.strikethrough.StrikethroughPlugin;
|
import io.noties.markwon.ext.strikethrough.StrikethroughPlugin;
|
||||||
|
import io.noties.markwon.html.HtmlPlugin;
|
||||||
|
import io.noties.markwon.html.tag.SuperScriptHandler;
|
||||||
import io.noties.markwon.inlineparser.HtmlInlineProcessor;
|
import io.noties.markwon.inlineparser.HtmlInlineProcessor;
|
||||||
import io.noties.markwon.inlineparser.MarkwonInlineParserPlugin;
|
import io.noties.markwon.inlineparser.MarkwonInlineParserPlugin;
|
||||||
import io.noties.markwon.linkify.LinkifyPlugin;
|
import io.noties.markwon.linkify.LinkifyPlugin;
|
||||||
@ -68,7 +70,9 @@ import ml.docilealligator.infinityforreddit.comment.SendComment;
|
|||||||
import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper;
|
import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper;
|
||||||
import ml.docilealligator.infinityforreddit.customviews.LinearLayoutManagerBugFixed;
|
import ml.docilealligator.infinityforreddit.customviews.LinearLayoutManagerBugFixed;
|
||||||
import ml.docilealligator.infinityforreddit.events.SwitchAccountEvent;
|
import ml.docilealligator.infinityforreddit.events.SwitchAccountEvent;
|
||||||
|
import ml.docilealligator.infinityforreddit.utils.ProcessRedditSuperscript;
|
||||||
import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils;
|
import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils;
|
||||||
|
import ml.docilealligator.infinityforreddit.utils.SuperscriptInlineProcessor;
|
||||||
import ml.docilealligator.infinityforreddit.utils.Utils;
|
import ml.docilealligator.infinityforreddit.utils.Utils;
|
||||||
import retrofit2.Retrofit;
|
import retrofit2.Retrofit;
|
||||||
|
|
||||||
@ -163,7 +167,12 @@ public class CommentActivity extends BaseActivity implements UploadImageEnabledA
|
|||||||
Markwon markwon = Markwon.builder(this)
|
Markwon markwon = Markwon.builder(this)
|
||||||
.usePlugin(MarkwonInlineParserPlugin.create(plugin -> {
|
.usePlugin(MarkwonInlineParserPlugin.create(plugin -> {
|
||||||
plugin.excludeInlineProcessor(HtmlInlineProcessor.class);
|
plugin.excludeInlineProcessor(HtmlInlineProcessor.class);
|
||||||
|
plugin.addInlineProcessor(new SuperscriptInlineProcessor());
|
||||||
}))
|
}))
|
||||||
|
.usePlugin(HtmlPlugin.create(plugin -> {
|
||||||
|
plugin.excludeDefaults(true).addHandler(new SuperScriptHandler());
|
||||||
|
}))
|
||||||
|
.usePlugin(new ProcessRedditSuperscript())
|
||||||
.usePlugin(new AbstractMarkwonPlugin() {
|
.usePlugin(new AbstractMarkwonPlugin() {
|
||||||
@Override
|
@Override
|
||||||
public void configureConfiguration(@NonNull MarkwonConfiguration.Builder builder) {
|
public void configureConfiguration(@NonNull MarkwonConfiguration.Builder builder) {
|
||||||
@ -206,7 +215,12 @@ public class CommentActivity extends BaseActivity implements UploadImageEnabledA
|
|||||||
Markwon postBodyMarkwon = Markwon.builder(this)
|
Markwon postBodyMarkwon = Markwon.builder(this)
|
||||||
.usePlugin(MarkwonInlineParserPlugin.create(plugin -> {
|
.usePlugin(MarkwonInlineParserPlugin.create(plugin -> {
|
||||||
plugin.excludeInlineProcessor(HtmlInlineProcessor.class);
|
plugin.excludeInlineProcessor(HtmlInlineProcessor.class);
|
||||||
|
plugin.addInlineProcessor(new SuperscriptInlineProcessor());
|
||||||
}))
|
}))
|
||||||
|
.usePlugin(HtmlPlugin.create(plugin -> {
|
||||||
|
plugin.excludeDefaults(true).addHandler(new SuperScriptHandler());
|
||||||
|
}))
|
||||||
|
.usePlugin(new ProcessRedditSuperscript())
|
||||||
.usePlugin(new AbstractMarkwonPlugin() {
|
.usePlugin(new AbstractMarkwonPlugin() {
|
||||||
@Override
|
@Override
|
||||||
public void beforeSetText(@NonNull TextView textView, @NonNull Spanned markdown) {
|
public void beforeSetText(@NonNull TextView textView, @NonNull Spanned markdown) {
|
||||||
|
@ -47,6 +47,8 @@ import io.noties.markwon.Markwon;
|
|||||||
import io.noties.markwon.MarkwonConfiguration;
|
import io.noties.markwon.MarkwonConfiguration;
|
||||||
import io.noties.markwon.core.MarkwonTheme;
|
import io.noties.markwon.core.MarkwonTheme;
|
||||||
import io.noties.markwon.ext.strikethrough.StrikethroughPlugin;
|
import io.noties.markwon.ext.strikethrough.StrikethroughPlugin;
|
||||||
|
import io.noties.markwon.html.HtmlPlugin;
|
||||||
|
import io.noties.markwon.html.tag.SuperScriptHandler;
|
||||||
import io.noties.markwon.inlineparser.HtmlInlineProcessor;
|
import io.noties.markwon.inlineparser.HtmlInlineProcessor;
|
||||||
import io.noties.markwon.inlineparser.MarkwonInlineParserPlugin;
|
import io.noties.markwon.inlineparser.MarkwonInlineParserPlugin;
|
||||||
import io.noties.markwon.linkify.LinkifyPlugin;
|
import io.noties.markwon.linkify.LinkifyPlugin;
|
||||||
@ -59,7 +61,9 @@ import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper;
|
|||||||
import ml.docilealligator.infinityforreddit.customviews.LinearLayoutManagerBugFixed;
|
import ml.docilealligator.infinityforreddit.customviews.LinearLayoutManagerBugFixed;
|
||||||
import ml.docilealligator.infinityforreddit.customviews.MarkwonLinearLayoutManager;
|
import ml.docilealligator.infinityforreddit.customviews.MarkwonLinearLayoutManager;
|
||||||
import ml.docilealligator.infinityforreddit.events.SwitchAccountEvent;
|
import ml.docilealligator.infinityforreddit.events.SwitchAccountEvent;
|
||||||
|
import ml.docilealligator.infinityforreddit.utils.ProcessRedditSuperscript;
|
||||||
import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils;
|
import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils;
|
||||||
|
import ml.docilealligator.infinityforreddit.utils.SuperscriptInlineProcessor;
|
||||||
|
|
||||||
public class FullMarkdownActivity extends BaseActivity {
|
public class FullMarkdownActivity extends BaseActivity {
|
||||||
|
|
||||||
@ -134,8 +138,14 @@ public class FullMarkdownActivity extends BaseActivity {
|
|||||||
Markwon markwon = Markwon.builder(this)
|
Markwon markwon = Markwon.builder(this)
|
||||||
.usePlugin(MarkwonInlineParserPlugin.create(plugin -> {
|
.usePlugin(MarkwonInlineParserPlugin.create(plugin -> {
|
||||||
plugin.excludeInlineProcessor(HtmlInlineProcessor.class);
|
plugin.excludeInlineProcessor(HtmlInlineProcessor.class);
|
||||||
|
plugin.addInlineProcessor(new SuperscriptInlineProcessor());
|
||||||
}))
|
}))
|
||||||
|
.usePlugin(HtmlPlugin.create(plugin -> {
|
||||||
|
plugin.excludeDefaults(true).addHandler(new SuperScriptHandler());
|
||||||
|
}))
|
||||||
|
.usePlugin(new ProcessRedditSuperscript())
|
||||||
.usePlugin(new AbstractMarkwonPlugin() {
|
.usePlugin(new AbstractMarkwonPlugin() {
|
||||||
|
/*
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public String processMarkdown(@NonNull String markdown) {
|
public String processMarkdown(@NonNull String markdown) {
|
||||||
@ -151,7 +161,7 @@ public class FullMarkdownActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
return super.processMarkdown(markdownStringBuilder.toString());
|
return super.processMarkdown(markdownStringBuilder.toString());
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void afterSetText(@NonNull TextView textView) {
|
public void afterSetText(@NonNull TextView textView) {
|
||||||
textView.setHighlightColor(Color.TRANSPARENT);
|
textView.setHighlightColor(Color.TRANSPARENT);
|
||||||
|
@ -51,6 +51,8 @@ import io.noties.markwon.Markwon;
|
|||||||
import io.noties.markwon.MarkwonConfiguration;
|
import io.noties.markwon.MarkwonConfiguration;
|
||||||
import io.noties.markwon.core.MarkwonTheme;
|
import io.noties.markwon.core.MarkwonTheme;
|
||||||
import io.noties.markwon.ext.strikethrough.StrikethroughPlugin;
|
import io.noties.markwon.ext.strikethrough.StrikethroughPlugin;
|
||||||
|
import io.noties.markwon.html.HtmlPlugin;
|
||||||
|
import io.noties.markwon.html.tag.SuperScriptHandler;
|
||||||
import io.noties.markwon.inlineparser.HtmlInlineProcessor;
|
import io.noties.markwon.inlineparser.HtmlInlineProcessor;
|
||||||
import io.noties.markwon.inlineparser.MarkwonInlineParserPlugin;
|
import io.noties.markwon.inlineparser.MarkwonInlineParserPlugin;
|
||||||
import io.noties.markwon.linkify.LinkifyPlugin;
|
import io.noties.markwon.linkify.LinkifyPlugin;
|
||||||
@ -65,7 +67,9 @@ import ml.docilealligator.infinityforreddit.customviews.LinearLayoutManagerBugFi
|
|||||||
import ml.docilealligator.infinityforreddit.customviews.MarkwonLinearLayoutManager;
|
import ml.docilealligator.infinityforreddit.customviews.MarkwonLinearLayoutManager;
|
||||||
import ml.docilealligator.infinityforreddit.events.SwitchAccountEvent;
|
import ml.docilealligator.infinityforreddit.events.SwitchAccountEvent;
|
||||||
import ml.docilealligator.infinityforreddit.utils.JSONUtils;
|
import ml.docilealligator.infinityforreddit.utils.JSONUtils;
|
||||||
|
import ml.docilealligator.infinityforreddit.utils.ProcessRedditSuperscript;
|
||||||
import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils;
|
import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils;
|
||||||
|
import ml.docilealligator.infinityforreddit.utils.SuperscriptInlineProcessor;
|
||||||
import retrofit2.Call;
|
import retrofit2.Call;
|
||||||
import retrofit2.Callback;
|
import retrofit2.Callback;
|
||||||
import retrofit2.Response;
|
import retrofit2.Response;
|
||||||
@ -159,8 +163,14 @@ public class WikiActivity extends BaseActivity {
|
|||||||
markwon = Markwon.builder(this)
|
markwon = Markwon.builder(this)
|
||||||
.usePlugin(MarkwonInlineParserPlugin.create(plugin -> {
|
.usePlugin(MarkwonInlineParserPlugin.create(plugin -> {
|
||||||
plugin.excludeInlineProcessor(HtmlInlineProcessor.class);
|
plugin.excludeInlineProcessor(HtmlInlineProcessor.class);
|
||||||
|
plugin.addInlineProcessor(new SuperscriptInlineProcessor());
|
||||||
}))
|
}))
|
||||||
|
.usePlugin(HtmlPlugin.create(plugin -> {
|
||||||
|
plugin.excludeDefaults(true).addHandler(new SuperScriptHandler());
|
||||||
|
}))
|
||||||
|
.usePlugin(new ProcessRedditSuperscript())
|
||||||
.usePlugin(new AbstractMarkwonPlugin() {
|
.usePlugin(new AbstractMarkwonPlugin() {
|
||||||
|
/*
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public String processMarkdown(@NonNull String markdown) {
|
public String processMarkdown(@NonNull String markdown) {
|
||||||
@ -176,7 +186,7 @@ public class WikiActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
return super.processMarkdown(markdownStringBuilder.toString());
|
return super.processMarkdown(markdownStringBuilder.toString());
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void afterSetText(@NonNull TextView textView) {
|
public void afterSetText(@NonNull TextView textView) {
|
||||||
textView.setHighlightColor(Color.TRANSPARENT);
|
textView.setHighlightColor(Color.TRANSPARENT);
|
||||||
|
@ -42,6 +42,8 @@ import io.noties.markwon.Markwon;
|
|||||||
import io.noties.markwon.MarkwonConfiguration;
|
import io.noties.markwon.MarkwonConfiguration;
|
||||||
import io.noties.markwon.core.MarkwonTheme;
|
import io.noties.markwon.core.MarkwonTheme;
|
||||||
import io.noties.markwon.ext.strikethrough.StrikethroughPlugin;
|
import io.noties.markwon.ext.strikethrough.StrikethroughPlugin;
|
||||||
|
import io.noties.markwon.html.HtmlPlugin;
|
||||||
|
import io.noties.markwon.html.tag.SuperScriptHandler;
|
||||||
import io.noties.markwon.inlineparser.HtmlInlineProcessor;
|
import io.noties.markwon.inlineparser.HtmlInlineProcessor;
|
||||||
import io.noties.markwon.inlineparser.MarkwonInlineParserPlugin;
|
import io.noties.markwon.inlineparser.MarkwonInlineParserPlugin;
|
||||||
import io.noties.markwon.linkify.LinkifyPlugin;
|
import io.noties.markwon.linkify.LinkifyPlugin;
|
||||||
@ -61,7 +63,9 @@ import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper;
|
|||||||
import ml.docilealligator.infinityforreddit.customviews.CommentIndentationView;
|
import ml.docilealligator.infinityforreddit.customviews.CommentIndentationView;
|
||||||
import ml.docilealligator.infinityforreddit.customviews.SpoilerOnClickTextView;
|
import ml.docilealligator.infinityforreddit.customviews.SpoilerOnClickTextView;
|
||||||
import ml.docilealligator.infinityforreddit.utils.APIUtils;
|
import ml.docilealligator.infinityforreddit.utils.APIUtils;
|
||||||
|
import ml.docilealligator.infinityforreddit.utils.ProcessRedditSuperscript;
|
||||||
import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils;
|
import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils;
|
||||||
|
import ml.docilealligator.infinityforreddit.utils.SuperscriptInlineProcessor;
|
||||||
import ml.docilealligator.infinityforreddit.utils.Utils;
|
import ml.docilealligator.infinityforreddit.utils.Utils;
|
||||||
import retrofit2.Retrofit;
|
import retrofit2.Retrofit;
|
||||||
|
|
||||||
@ -119,8 +123,14 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
|
|||||||
mMarkwon = Markwon.builder(mActivity)
|
mMarkwon = Markwon.builder(mActivity)
|
||||||
.usePlugin(MarkwonInlineParserPlugin.create(plugin -> {
|
.usePlugin(MarkwonInlineParserPlugin.create(plugin -> {
|
||||||
plugin.excludeInlineProcessor(HtmlInlineProcessor.class);
|
plugin.excludeInlineProcessor(HtmlInlineProcessor.class);
|
||||||
|
plugin.addInlineProcessor(new SuperscriptInlineProcessor());
|
||||||
}))
|
}))
|
||||||
|
.usePlugin(HtmlPlugin.create(plugin -> {
|
||||||
|
plugin.excludeDefaults(true).addHandler(new SuperScriptHandler());
|
||||||
|
}))
|
||||||
|
.usePlugin(new ProcessRedditSuperscript())
|
||||||
.usePlugin(new AbstractMarkwonPlugin() {
|
.usePlugin(new AbstractMarkwonPlugin() {
|
||||||
|
/*
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public String processMarkdown(@NonNull String markdown) {
|
public String processMarkdown(@NonNull String markdown) {
|
||||||
@ -136,7 +146,7 @@ public class CommentsListingRecyclerViewAdapter extends PagedListAdapter<Comment
|
|||||||
}
|
}
|
||||||
return super.processMarkdown(markdownStringBuilder.toString());
|
return super.processMarkdown(markdownStringBuilder.toString());
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void afterSetText(@NonNull TextView textView) {
|
public void afterSetText(@NonNull TextView textView) {
|
||||||
textView.setHighlightColor(Color.TRANSPARENT);
|
textView.setHighlightColor(Color.TRANSPARENT);
|
||||||
|
@ -47,6 +47,11 @@ import io.noties.markwon.Markwon;
|
|||||||
import io.noties.markwon.MarkwonConfiguration;
|
import io.noties.markwon.MarkwonConfiguration;
|
||||||
import io.noties.markwon.core.MarkwonTheme;
|
import io.noties.markwon.core.MarkwonTheme;
|
||||||
import io.noties.markwon.ext.strikethrough.StrikethroughPlugin;
|
import io.noties.markwon.ext.strikethrough.StrikethroughPlugin;
|
||||||
|
import io.noties.markwon.html.HtmlEmptyTagReplacement;
|
||||||
|
import io.noties.markwon.html.HtmlPlugin;
|
||||||
|
import io.noties.markwon.html.tag.ImageHandler;
|
||||||
|
import io.noties.markwon.html.tag.LinkHandler;
|
||||||
|
import io.noties.markwon.html.tag.SuperScriptHandler;
|
||||||
import io.noties.markwon.inlineparser.HtmlInlineProcessor;
|
import io.noties.markwon.inlineparser.HtmlInlineProcessor;
|
||||||
import io.noties.markwon.inlineparser.MarkwonInlineParserPlugin;
|
import io.noties.markwon.inlineparser.MarkwonInlineParserPlugin;
|
||||||
import io.noties.markwon.linkify.LinkifyPlugin;
|
import io.noties.markwon.linkify.LinkifyPlugin;
|
||||||
@ -69,7 +74,9 @@ import ml.docilealligator.infinityforreddit.customviews.SpoilerOnClickTextView;
|
|||||||
import ml.docilealligator.infinityforreddit.fragments.ViewPostDetailFragment;
|
import ml.docilealligator.infinityforreddit.fragments.ViewPostDetailFragment;
|
||||||
import ml.docilealligator.infinityforreddit.post.Post;
|
import ml.docilealligator.infinityforreddit.post.Post;
|
||||||
import ml.docilealligator.infinityforreddit.utils.APIUtils;
|
import ml.docilealligator.infinityforreddit.utils.APIUtils;
|
||||||
|
import ml.docilealligator.infinityforreddit.utils.ProcessRedditSuperscript;
|
||||||
import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils;
|
import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils;
|
||||||
|
import ml.docilealligator.infinityforreddit.utils.SuperscriptInlineProcessor;
|
||||||
import ml.docilealligator.infinityforreddit.utils.Utils;
|
import ml.docilealligator.infinityforreddit.utils.Utils;
|
||||||
import retrofit2.Retrofit;
|
import retrofit2.Retrofit;
|
||||||
|
|
||||||
@ -163,8 +170,14 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
|
|||||||
mCommentMarkwon = Markwon.builder(mActivity)
|
mCommentMarkwon = Markwon.builder(mActivity)
|
||||||
.usePlugin(MarkwonInlineParserPlugin.create(plugin -> {
|
.usePlugin(MarkwonInlineParserPlugin.create(plugin -> {
|
||||||
plugin.excludeInlineProcessor(HtmlInlineProcessor.class);
|
plugin.excludeInlineProcessor(HtmlInlineProcessor.class);
|
||||||
|
plugin.addInlineProcessor(new SuperscriptInlineProcessor());
|
||||||
}))
|
}))
|
||||||
|
.usePlugin(HtmlPlugin.create(plugin -> {
|
||||||
|
plugin.excludeDefaults(true).addHandler(new SuperScriptHandler());
|
||||||
|
}))
|
||||||
|
.usePlugin(new ProcessRedditSuperscript())
|
||||||
.usePlugin(new AbstractMarkwonPlugin() {
|
.usePlugin(new AbstractMarkwonPlugin() {
|
||||||
|
/*
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public String processMarkdown(@NonNull String markdown) {
|
public String processMarkdown(@NonNull String markdown) {
|
||||||
@ -180,7 +193,7 @@ public class CommentsRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerVi
|
|||||||
}
|
}
|
||||||
return super.processMarkdown(markdownStringBuilder.toString());
|
return super.processMarkdown(markdownStringBuilder.toString());
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void afterSetText(@NonNull TextView textView) {
|
public void afterSetText(@NonNull TextView textView) {
|
||||||
SpannableStringBuilder markdownStringBuilder = new SpannableStringBuilder(textView.getText());
|
SpannableStringBuilder markdownStringBuilder = new SpannableStringBuilder(textView.getText());
|
||||||
|
@ -34,6 +34,8 @@ import io.noties.markwon.Markwon;
|
|||||||
import io.noties.markwon.MarkwonConfiguration;
|
import io.noties.markwon.MarkwonConfiguration;
|
||||||
import io.noties.markwon.core.MarkwonTheme;
|
import io.noties.markwon.core.MarkwonTheme;
|
||||||
import io.noties.markwon.ext.strikethrough.StrikethroughPlugin;
|
import io.noties.markwon.ext.strikethrough.StrikethroughPlugin;
|
||||||
|
import io.noties.markwon.html.HtmlPlugin;
|
||||||
|
import io.noties.markwon.html.tag.SuperScriptHandler;
|
||||||
import io.noties.markwon.inlineparser.HtmlInlineProcessor;
|
import io.noties.markwon.inlineparser.HtmlInlineProcessor;
|
||||||
import io.noties.markwon.inlineparser.MarkwonInlineParserPlugin;
|
import io.noties.markwon.inlineparser.MarkwonInlineParserPlugin;
|
||||||
import io.noties.markwon.linkify.LinkifyPlugin;
|
import io.noties.markwon.linkify.LinkifyPlugin;
|
||||||
@ -46,6 +48,8 @@ import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper;
|
|||||||
import ml.docilealligator.infinityforreddit.message.FetchMessage;
|
import ml.docilealligator.infinityforreddit.message.FetchMessage;
|
||||||
import ml.docilealligator.infinityforreddit.message.Message;
|
import ml.docilealligator.infinityforreddit.message.Message;
|
||||||
import ml.docilealligator.infinityforreddit.message.ReadMessage;
|
import ml.docilealligator.infinityforreddit.message.ReadMessage;
|
||||||
|
import ml.docilealligator.infinityforreddit.utils.ProcessRedditSuperscript;
|
||||||
|
import ml.docilealligator.infinityforreddit.utils.SuperscriptInlineProcessor;
|
||||||
import retrofit2.Retrofit;
|
import retrofit2.Retrofit;
|
||||||
|
|
||||||
public class MessageRecyclerViewAdapter extends PagedListAdapter<Message, RecyclerView.ViewHolder> {
|
public class MessageRecyclerViewAdapter extends PagedListAdapter<Message, RecyclerView.ViewHolder> {
|
||||||
@ -102,8 +106,14 @@ public class MessageRecyclerViewAdapter extends PagedListAdapter<Message, Recycl
|
|||||||
mMarkwon = Markwon.builder(mContext)
|
mMarkwon = Markwon.builder(mContext)
|
||||||
.usePlugin(MarkwonInlineParserPlugin.create(plugin -> {
|
.usePlugin(MarkwonInlineParserPlugin.create(plugin -> {
|
||||||
plugin.excludeInlineProcessor(HtmlInlineProcessor.class);
|
plugin.excludeInlineProcessor(HtmlInlineProcessor.class);
|
||||||
|
plugin.addInlineProcessor(new SuperscriptInlineProcessor());
|
||||||
}))
|
}))
|
||||||
|
.usePlugin(HtmlPlugin.create(plugin -> {
|
||||||
|
plugin.excludeDefaults(true).addHandler(new SuperScriptHandler());
|
||||||
|
}))
|
||||||
|
.usePlugin(new ProcessRedditSuperscript())
|
||||||
.usePlugin(new AbstractMarkwonPlugin() {
|
.usePlugin(new AbstractMarkwonPlugin() {
|
||||||
|
/*
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public String processMarkdown(@NonNull String markdown) {
|
public String processMarkdown(@NonNull String markdown) {
|
||||||
@ -119,6 +129,7 @@ public class MessageRecyclerViewAdapter extends PagedListAdapter<Message, Recycl
|
|||||||
}
|
}
|
||||||
return super.processMarkdown(markdownStringBuilder.toString());
|
return super.processMarkdown(markdownStringBuilder.toString());
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterSetText(@NonNull TextView textView) {
|
public void afterSetText(@NonNull TextView textView) {
|
||||||
|
@ -73,6 +73,8 @@ import io.noties.markwon.Markwon;
|
|||||||
import io.noties.markwon.MarkwonConfiguration;
|
import io.noties.markwon.MarkwonConfiguration;
|
||||||
import io.noties.markwon.core.MarkwonTheme;
|
import io.noties.markwon.core.MarkwonTheme;
|
||||||
import io.noties.markwon.ext.strikethrough.StrikethroughPlugin;
|
import io.noties.markwon.ext.strikethrough.StrikethroughPlugin;
|
||||||
|
import io.noties.markwon.html.HtmlPlugin;
|
||||||
|
import io.noties.markwon.html.tag.SuperScriptHandler;
|
||||||
import io.noties.markwon.inlineparser.HtmlInlineProcessor;
|
import io.noties.markwon.inlineparser.HtmlInlineProcessor;
|
||||||
import io.noties.markwon.inlineparser.MarkwonInlineParserPlugin;
|
import io.noties.markwon.inlineparser.MarkwonInlineParserPlugin;
|
||||||
import io.noties.markwon.linkify.LinkifyPlugin;
|
import io.noties.markwon.linkify.LinkifyPlugin;
|
||||||
@ -110,7 +112,9 @@ import ml.docilealligator.infinityforreddit.fragments.ViewPostDetailFragment;
|
|||||||
import ml.docilealligator.infinityforreddit.post.Post;
|
import ml.docilealligator.infinityforreddit.post.Post;
|
||||||
import ml.docilealligator.infinityforreddit.post.PostPagingSource;
|
import ml.docilealligator.infinityforreddit.post.PostPagingSource;
|
||||||
import ml.docilealligator.infinityforreddit.utils.APIUtils;
|
import ml.docilealligator.infinityforreddit.utils.APIUtils;
|
||||||
|
import ml.docilealligator.infinityforreddit.utils.ProcessRedditSuperscript;
|
||||||
import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils;
|
import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils;
|
||||||
|
import ml.docilealligator.infinityforreddit.utils.SuperscriptInlineProcessor;
|
||||||
import ml.docilealligator.infinityforreddit.utils.Utils;
|
import ml.docilealligator.infinityforreddit.utils.Utils;
|
||||||
import pl.droidsonroids.gif.GifImageView;
|
import pl.droidsonroids.gif.GifImageView;
|
||||||
import retrofit2.Retrofit;
|
import retrofit2.Retrofit;
|
||||||
@ -229,8 +233,14 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
|
|||||||
mPostDetailMarkwon = Markwon.builder(mActivity)
|
mPostDetailMarkwon = Markwon.builder(mActivity)
|
||||||
.usePlugin(MarkwonInlineParserPlugin.create(plugin -> {
|
.usePlugin(MarkwonInlineParserPlugin.create(plugin -> {
|
||||||
plugin.excludeInlineProcessor(HtmlInlineProcessor.class);
|
plugin.excludeInlineProcessor(HtmlInlineProcessor.class);
|
||||||
|
plugin.addInlineProcessor(new SuperscriptInlineProcessor());
|
||||||
}))
|
}))
|
||||||
|
.usePlugin(HtmlPlugin.create(plugin -> {
|
||||||
|
plugin.excludeDefaults(true).addHandler(new SuperScriptHandler());
|
||||||
|
}))
|
||||||
|
.usePlugin(new ProcessRedditSuperscript())
|
||||||
.usePlugin(new AbstractMarkwonPlugin() {
|
.usePlugin(new AbstractMarkwonPlugin() {
|
||||||
|
/*
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public String processMarkdown(@NonNull String markdown) {
|
public String processMarkdown(@NonNull String markdown) {
|
||||||
@ -246,7 +256,7 @@ public class PostDetailRecyclerViewAdapter extends RecyclerView.Adapter<Recycler
|
|||||||
}
|
}
|
||||||
return super.processMarkdown(markdownStringBuilder.toString());
|
return super.processMarkdown(markdownStringBuilder.toString());
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void afterSetText(@NonNull TextView textView) {
|
public void afterSetText(@NonNull TextView textView) {
|
||||||
textView.setHighlightColor(Color.TRANSPARENT);
|
textView.setHighlightColor(Color.TRANSPARENT);
|
||||||
|
@ -27,6 +27,8 @@ import io.noties.markwon.Markwon;
|
|||||||
import io.noties.markwon.MarkwonConfiguration;
|
import io.noties.markwon.MarkwonConfiguration;
|
||||||
import io.noties.markwon.core.MarkwonTheme;
|
import io.noties.markwon.core.MarkwonTheme;
|
||||||
import io.noties.markwon.ext.strikethrough.StrikethroughPlugin;
|
import io.noties.markwon.ext.strikethrough.StrikethroughPlugin;
|
||||||
|
import io.noties.markwon.html.HtmlPlugin;
|
||||||
|
import io.noties.markwon.html.tag.SuperScriptHandler;
|
||||||
import io.noties.markwon.inlineparser.HtmlInlineProcessor;
|
import io.noties.markwon.inlineparser.HtmlInlineProcessor;
|
||||||
import io.noties.markwon.inlineparser.MarkwonInlineParserPlugin;
|
import io.noties.markwon.inlineparser.MarkwonInlineParserPlugin;
|
||||||
import io.noties.markwon.linkify.LinkifyPlugin;
|
import io.noties.markwon.linkify.LinkifyPlugin;
|
||||||
@ -37,7 +39,9 @@ import ml.docilealligator.infinityforreddit.activities.ViewPrivateMessagesActivi
|
|||||||
import ml.docilealligator.infinityforreddit.activities.ViewUserDetailActivity;
|
import ml.docilealligator.infinityforreddit.activities.ViewUserDetailActivity;
|
||||||
import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper;
|
import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper;
|
||||||
import ml.docilealligator.infinityforreddit.message.Message;
|
import ml.docilealligator.infinityforreddit.message.Message;
|
||||||
|
import ml.docilealligator.infinityforreddit.utils.ProcessRedditSuperscript;
|
||||||
import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils;
|
import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils;
|
||||||
|
import ml.docilealligator.infinityforreddit.utils.SuperscriptInlineProcessor;
|
||||||
import ml.docilealligator.infinityforreddit.utils.Utils;
|
import ml.docilealligator.infinityforreddit.utils.Utils;
|
||||||
|
|
||||||
public class PrivateMessagesDetailRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
public class PrivateMessagesDetailRecyclerViewAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||||
@ -69,7 +73,12 @@ public class PrivateMessagesDetailRecyclerViewAdapter extends RecyclerView.Adapt
|
|||||||
mMarkwon = Markwon.builder(viewPrivateMessagesActivity)
|
mMarkwon = Markwon.builder(viewPrivateMessagesActivity)
|
||||||
.usePlugin(MarkwonInlineParserPlugin.create(plugin -> {
|
.usePlugin(MarkwonInlineParserPlugin.create(plugin -> {
|
||||||
plugin.excludeInlineProcessor(HtmlInlineProcessor.class);
|
plugin.excludeInlineProcessor(HtmlInlineProcessor.class);
|
||||||
|
plugin.addInlineProcessor(new SuperscriptInlineProcessor());
|
||||||
}))
|
}))
|
||||||
|
.usePlugin(HtmlPlugin.create(plugin -> {
|
||||||
|
plugin.excludeDefaults(true).addHandler(new SuperScriptHandler());
|
||||||
|
}))
|
||||||
|
.usePlugin(new ProcessRedditSuperscript())
|
||||||
.usePlugin(new AbstractMarkwonPlugin() {
|
.usePlugin(new AbstractMarkwonPlugin() {
|
||||||
@Override
|
@Override
|
||||||
public void configureConfiguration(@NonNull MarkwonConfiguration.Builder builder) {
|
public void configureConfiguration(@NonNull MarkwonConfiguration.Builder builder) {
|
||||||
|
@ -22,6 +22,8 @@ import io.noties.markwon.Markwon;
|
|||||||
import io.noties.markwon.MarkwonConfiguration;
|
import io.noties.markwon.MarkwonConfiguration;
|
||||||
import io.noties.markwon.core.MarkwonTheme;
|
import io.noties.markwon.core.MarkwonTheme;
|
||||||
import io.noties.markwon.ext.strikethrough.StrikethroughPlugin;
|
import io.noties.markwon.ext.strikethrough.StrikethroughPlugin;
|
||||||
|
import io.noties.markwon.html.HtmlPlugin;
|
||||||
|
import io.noties.markwon.html.tag.SuperScriptHandler;
|
||||||
import io.noties.markwon.inlineparser.HtmlInlineProcessor;
|
import io.noties.markwon.inlineparser.HtmlInlineProcessor;
|
||||||
import io.noties.markwon.inlineparser.MarkwonInlineParserPlugin;
|
import io.noties.markwon.inlineparser.MarkwonInlineParserPlugin;
|
||||||
import io.noties.markwon.linkify.LinkifyPlugin;
|
import io.noties.markwon.linkify.LinkifyPlugin;
|
||||||
@ -32,6 +34,8 @@ import ml.docilealligator.infinityforreddit.Rule;
|
|||||||
import ml.docilealligator.infinityforreddit.activities.LinkResolverActivity;
|
import ml.docilealligator.infinityforreddit.activities.LinkResolverActivity;
|
||||||
import ml.docilealligator.infinityforreddit.bottomsheetfragments.UrlMenuBottomSheetFragment;
|
import ml.docilealligator.infinityforreddit.bottomsheetfragments.UrlMenuBottomSheetFragment;
|
||||||
import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper;
|
import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper;
|
||||||
|
import ml.docilealligator.infinityforreddit.utils.ProcessRedditSuperscript;
|
||||||
|
import ml.docilealligator.infinityforreddit.utils.SuperscriptInlineProcessor;
|
||||||
|
|
||||||
public class RulesRecyclerViewAdapter extends RecyclerView.Adapter<RulesRecyclerViewAdapter.RuleViewHolder> {
|
public class RulesRecyclerViewAdapter extends RecyclerView.Adapter<RulesRecyclerViewAdapter.RuleViewHolder> {
|
||||||
private Markwon markwon;
|
private Markwon markwon;
|
||||||
@ -43,7 +47,12 @@ public class RulesRecyclerViewAdapter extends RecyclerView.Adapter<RulesRecycler
|
|||||||
markwon = Markwon.builder(activity)
|
markwon = Markwon.builder(activity)
|
||||||
.usePlugin(MarkwonInlineParserPlugin.create(plugin -> {
|
.usePlugin(MarkwonInlineParserPlugin.create(plugin -> {
|
||||||
plugin.excludeInlineProcessor(HtmlInlineProcessor.class);
|
plugin.excludeInlineProcessor(HtmlInlineProcessor.class);
|
||||||
|
plugin.addInlineProcessor(new SuperscriptInlineProcessor());
|
||||||
}))
|
}))
|
||||||
|
.usePlugin(HtmlPlugin.create(plugin -> {
|
||||||
|
plugin.excludeDefaults(true).addHandler(new SuperScriptHandler());
|
||||||
|
}))
|
||||||
|
.usePlugin(new ProcessRedditSuperscript())
|
||||||
.usePlugin(new AbstractMarkwonPlugin() {
|
.usePlugin(new AbstractMarkwonPlugin() {
|
||||||
@Override
|
@Override
|
||||||
public void configureConfiguration(@NonNull MarkwonConfiguration.Builder builder) {
|
public void configureConfiguration(@NonNull MarkwonConfiguration.Builder builder) {
|
||||||
|
@ -6,6 +6,7 @@ import android.content.ClipData;
|
|||||||
import android.content.ClipboardManager;
|
import android.content.ClipboardManager;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.text.Html;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
@ -72,7 +73,8 @@ public class CopyTextBottomSheetFragment extends LandscapeExpandedRoundedBottomS
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (markdownText != null) {
|
if (markdownText != null) {
|
||||||
markdownText = markdownText.replaceAll("<sup>", "^").replaceAll("</sup>", "");
|
//markdownText = markdownText.replaceAll("<sup>", "^").replaceAll("</sup>", "");
|
||||||
|
markdownText = markdownText.replaceAll(">", ">");
|
||||||
copyMarkdownTextView.setOnClickListener(view -> {
|
copyMarkdownTextView.setOnClickListener(view -> {
|
||||||
showCopyDialog(markdownText);
|
showCopyDialog(markdownText);
|
||||||
dismiss();
|
dismiss();
|
||||||
|
@ -34,6 +34,8 @@ import io.noties.markwon.Markwon;
|
|||||||
import io.noties.markwon.MarkwonConfiguration;
|
import io.noties.markwon.MarkwonConfiguration;
|
||||||
import io.noties.markwon.core.MarkwonTheme;
|
import io.noties.markwon.core.MarkwonTheme;
|
||||||
import io.noties.markwon.ext.strikethrough.StrikethroughPlugin;
|
import io.noties.markwon.ext.strikethrough.StrikethroughPlugin;
|
||||||
|
import io.noties.markwon.html.HtmlPlugin;
|
||||||
|
import io.noties.markwon.html.tag.SuperScriptHandler;
|
||||||
import io.noties.markwon.inlineparser.HtmlInlineProcessor;
|
import io.noties.markwon.inlineparser.HtmlInlineProcessor;
|
||||||
import io.noties.markwon.inlineparser.MarkwonInlineParserPlugin;
|
import io.noties.markwon.inlineparser.MarkwonInlineParserPlugin;
|
||||||
import io.noties.markwon.linkify.LinkifyPlugin;
|
import io.noties.markwon.linkify.LinkifyPlugin;
|
||||||
@ -55,6 +57,8 @@ import ml.docilealligator.infinityforreddit.customviews.LinearLayoutManagerBugFi
|
|||||||
import ml.docilealligator.infinityforreddit.subreddit.FetchSubredditData;
|
import ml.docilealligator.infinityforreddit.subreddit.FetchSubredditData;
|
||||||
import ml.docilealligator.infinityforreddit.subreddit.SubredditData;
|
import ml.docilealligator.infinityforreddit.subreddit.SubredditData;
|
||||||
import ml.docilealligator.infinityforreddit.subreddit.SubredditViewModel;
|
import ml.docilealligator.infinityforreddit.subreddit.SubredditViewModel;
|
||||||
|
import ml.docilealligator.infinityforreddit.utils.ProcessRedditSuperscript;
|
||||||
|
import ml.docilealligator.infinityforreddit.utils.SuperscriptInlineProcessor;
|
||||||
import retrofit2.Retrofit;
|
import retrofit2.Retrofit;
|
||||||
|
|
||||||
public class SidebarFragment extends Fragment {
|
public class SidebarFragment extends Fragment {
|
||||||
@ -107,7 +111,12 @@ public class SidebarFragment extends Fragment {
|
|||||||
Markwon markwon = Markwon.builder(activity)
|
Markwon markwon = Markwon.builder(activity)
|
||||||
.usePlugin(MarkwonInlineParserPlugin.create(plugin -> {
|
.usePlugin(MarkwonInlineParserPlugin.create(plugin -> {
|
||||||
plugin.excludeInlineProcessor(HtmlInlineProcessor.class);
|
plugin.excludeInlineProcessor(HtmlInlineProcessor.class);
|
||||||
|
plugin.addInlineProcessor(new SuperscriptInlineProcessor());
|
||||||
}))
|
}))
|
||||||
|
.usePlugin(HtmlPlugin.create(plugin -> {
|
||||||
|
plugin.excludeDefaults(true).addHandler(new SuperScriptHandler());
|
||||||
|
}))
|
||||||
|
.usePlugin(new ProcessRedditSuperscript())
|
||||||
.usePlugin(new AbstractMarkwonPlugin() {
|
.usePlugin(new AbstractMarkwonPlugin() {
|
||||||
@Override
|
@Override
|
||||||
public void beforeSetText(@NonNull TextView textView, @NonNull Spanned markdown) {
|
public void beforeSetText(@NonNull TextView textView, @NonNull Spanned markdown) {
|
||||||
|
@ -0,0 +1,46 @@
|
|||||||
|
package ml.docilealligator.infinityforreddit.utils;
|
||||||
|
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import io.noties.markwon.AbstractMarkwonPlugin;
|
||||||
|
|
||||||
|
public class ProcessRedditSuperscript extends AbstractMarkwonPlugin {
|
||||||
|
private static final Pattern re = Pattern.compile("(?:\\^\\((.+?)\\))|(?:\\^(\\S+))");
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String processMarkdown(String markdown) {
|
||||||
|
StringBuilder builder = new StringBuilder();
|
||||||
|
Matcher matcher = re.matcher(markdown);
|
||||||
|
int start = 0;
|
||||||
|
|
||||||
|
while (matcher.find()) {
|
||||||
|
try {
|
||||||
|
String match;
|
||||||
|
if ((match = matcher.group(1)) != null || (match = matcher.group(2)) != null) {
|
||||||
|
builder.append(markdown.substring(start, matcher.start()))
|
||||||
|
.append("<sup>")
|
||||||
|
.append(match)
|
||||||
|
.append("</sup>");
|
||||||
|
start = matcher.end();
|
||||||
|
} else {
|
||||||
|
throw new NullPointerException();
|
||||||
|
}
|
||||||
|
} catch(NullPointerException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (start < markdown.length()) {
|
||||||
|
builder.append(markdown.substring(start));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(builder.length() > 0) {
|
||||||
|
return builder.toString(); }
|
||||||
|
else {
|
||||||
|
return markdown;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,32 @@
|
|||||||
|
package ml.docilealligator.infinityforreddit.utils;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
import org.commonmark.node.HtmlInline;
|
||||||
|
import org.commonmark.node.Node;
|
||||||
|
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
import io.noties.markwon.inlineparser.InlineProcessor;
|
||||||
|
|
||||||
|
public class SuperscriptInlineProcessor extends InlineProcessor {
|
||||||
|
private static final Pattern HTML_TAG = Pattern.compile("</?sup>", Pattern.CASE_INSENSITIVE);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public char specialCharacter() {
|
||||||
|
return '<';
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
protected Node parse() {
|
||||||
|
String m = match(HTML_TAG);
|
||||||
|
if (m != null) {
|
||||||
|
HtmlInline node = new HtmlInline();
|
||||||
|
node.setLiteral(m);
|
||||||
|
return node;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -65,6 +65,8 @@ 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("((?<=[\\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("\\^{2,}", "^")
|
||||||
|
.replaceAll("(</?sup)>", "$1>")
|
||||||
|
.replaceAll(">!", ">!")
|
||||||
.replaceAll("(^|^ *|\\n *)#(?!($|\\s|#))", "$0 ")
|
.replaceAll("(^|^ *|\\n *)#(?!($|\\s|#))", "$0 ")
|
||||||
.replaceAll("(^|^ *|\\n *)##(?!($|\\s|#))", "$0 ")
|
.replaceAll("(^|^ *|\\n *)##(?!($|\\s|#))", "$0 ")
|
||||||
.replaceAll("(^|^ *|\\n *)###(?!($|\\s|#))", "$0 ")
|
.replaceAll("(^|^ *|\\n *)###(?!($|\\s|#))", "$0 ")
|
||||||
@ -72,7 +74,8 @@ public class Utils {
|
|||||||
.replaceAll("(^|^ *|\\n *)#####(?!($|\\s|#))", "$0 ")
|
.replaceAll("(^|^ *|\\n *)#####(?!($|\\s|#))", "$0 ")
|
||||||
.replaceAll("(^|^ *|\\n *)######(?!($|\\s|#))", "$0 "));
|
.replaceAll("(^|^ *|\\n *)######(?!($|\\s|#))", "$0 "));
|
||||||
|
|
||||||
return fixSuperScript(regexed);
|
//return fixSuperScript(regexed);
|
||||||
|
return regexed.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String fixSuperScript(StringBuilder regexed) {
|
private static String fixSuperScript(StringBuilder regexed) {
|
||||||
|
Loading…
Reference in New Issue
Block a user