Commit 9e62a03a authored by Liang Ding's avatar Liang Ding

🎨 #12787 改进 Emoji 处理过程

parent d15224d5
...@@ -43,7 +43,6 @@ import org.b3log.solo.event.EventTypes; ...@@ -43,7 +43,6 @@ import org.b3log.solo.event.EventTypes;
import org.b3log.solo.model.*; import org.b3log.solo.model.*;
import org.b3log.solo.processor.console.ConsoleRenderer; import org.b3log.solo.processor.console.ConsoleRenderer;
import org.b3log.solo.service.*; import org.b3log.solo.service.*;
import org.b3log.solo.util.Emotions;
import org.b3log.solo.util.Markdowns; import org.b3log.solo.util.Markdowns;
import org.b3log.solo.util.Skins; import org.b3log.solo.util.Skins;
import org.b3log.solo.util.Solos; import org.b3log.solo.util.Solos;
...@@ -170,8 +169,7 @@ public class ArticleProcessor { ...@@ -170,8 +169,7 @@ public class ArticleProcessor {
} }
try { try {
String html = Emotions.convert(markdownText); final String html = Markdowns.toHTML(markdownText);
html = Markdowns.toHTML(html);
result.put(Common.DATA, html); result.put(Common.DATA, html);
} catch (final Exception e) { } catch (final Exception e) {
LOGGER.log(Level.ERROR, e.getMessage(), e); LOGGER.log(Level.ERROR, e.getMessage(), e);
......
...@@ -883,7 +883,6 @@ public class ArticleQueryService { ...@@ -883,7 +883,6 @@ public class ArticleQueryService {
// Markdown to HTML for content and abstract // Markdown to HTML for content and abstract
Stopwatchs.start("Get Article Content [Markdown]"); Stopwatchs.start("Get Article Content [Markdown]");
String content = article.optString(Article.ARTICLE_CONTENT); String content = article.optString(Article.ARTICLE_CONTENT);
content = Emotions.convert(content);
content = Markdowns.toHTML(content); content = Markdowns.toHTML(content);
article.put(Article.ARTICLE_CONTENT, content); article.put(Article.ARTICLE_CONTENT, content);
Stopwatchs.end(); Stopwatchs.end();
...@@ -917,14 +916,12 @@ public class ArticleQueryService { ...@@ -917,14 +916,12 @@ public class ArticleQueryService {
Stopwatchs.start("Markdown Article [id=" + article.optString(Keys.OBJECT_ID) + "]"); Stopwatchs.start("Markdown Article [id=" + article.optString(Keys.OBJECT_ID) + "]");
String content = article.optString(Article.ARTICLE_CONTENT); String content = article.optString(Article.ARTICLE_CONTENT);
content = Emotions.convert(content);
content = Markdowns.toHTML(content); content = Markdowns.toHTML(content);
article.put(Article.ARTICLE_CONTENT, content); article.put(Article.ARTICLE_CONTENT, content);
String abstractContent = article.optString(Article.ARTICLE_ABSTRACT); String abstractContent = article.optString(Article.ARTICLE_ABSTRACT);
if (StringUtils.isNotBlank(abstractContent)) { if (StringUtils.isNotBlank(abstractContent)) {
Stopwatchs.start("Abstract"); Stopwatchs.start("Abstract");
abstractContent = Emotions.convert(abstractContent);
abstractContent = Markdowns.toHTML(abstractContent); abstractContent = Markdowns.toHTML(abstractContent);
article.put(Article.ARTICLE_ABSTRACT, abstractContent); article.put(Article.ARTICLE_ABSTRACT, abstractContent);
Stopwatchs.end(); Stopwatchs.end();
......
...@@ -284,8 +284,7 @@ public class CommentMgmtService { ...@@ -284,8 +284,7 @@ public class CommentMgmtService {
ret.put(Common.COMMENTABLE, preference.getBoolean(Option.ID_C_COMMENTABLE) && article.getBoolean(Article.ARTICLE_COMMENTABLE)); ret.put(Common.COMMENTABLE, preference.getBoolean(Option.ID_C_COMMENTABLE) && article.getBoolean(Article.ARTICLE_COMMENTABLE));
ret.put(Common.PERMALINK, article.getString(Article.ARTICLE_PERMALINK)); ret.put(Common.PERMALINK, article.getString(Article.ARTICLE_PERMALINK));
ret.put(Comment.COMMENT_NAME, commentName); ret.put(Comment.COMMENT_NAME, commentName);
String cmtContent = Emotions.convert(commentContent); String cmtContent = Markdowns.toHTML(commentContent);
cmtContent = Markdowns.toHTML(cmtContent);
cmtContent = Markdowns.clean(cmtContent); cmtContent = Markdowns.clean(cmtContent);
ret.put(Comment.COMMENT_CONTENT, cmtContent); ret.put(Comment.COMMENT_CONTENT, cmtContent);
ret.put(Comment.COMMENT_URL, commentURL); ret.put(Comment.COMMENT_URL, commentURL);
......
...@@ -186,7 +186,6 @@ public class CommentQueryService { ...@@ -186,7 +186,6 @@ public class CommentQueryService {
comment.put(Common.COMMENT_TITLE, title); comment.put(Common.COMMENT_TITLE, title);
String commentContent = comment.optString(Comment.COMMENT_CONTENT); String commentContent = comment.optString(Comment.COMMENT_CONTENT);
commentContent = Emotions.convert(commentContent);
commentContent = Markdowns.toHTML(commentContent); commentContent = Markdowns.toHTML(commentContent);
commentContent = Markdowns.clean(commentContent); commentContent = Markdowns.clean(commentContent);
comment.put(Comment.COMMENT_CONTENT, commentContent); comment.put(Comment.COMMENT_CONTENT, commentContent);
...@@ -246,7 +245,6 @@ public class CommentQueryService { ...@@ -246,7 +245,6 @@ public class CommentQueryService {
} }
String commentContent = comment.optString(Comment.COMMENT_CONTENT); String commentContent = comment.optString(Comment.COMMENT_CONTENT);
commentContent = Emotions.convert(commentContent);
commentContent = Markdowns.toHTML(commentContent); commentContent = Markdowns.toHTML(commentContent);
commentContent = Markdowns.clean(commentContent); commentContent = Markdowns.clean(commentContent);
comment.put(Comment.COMMENT_CONTENT, commentContent); comment.put(Comment.COMMENT_CONTENT, commentContent);
......
...@@ -516,7 +516,6 @@ public class DataModelService { ...@@ -516,7 +516,6 @@ public class DataModelService {
final List<JSONObject> recentComments = commentRepository.getRecentComments(recentCommentDisplayCnt); final List<JSONObject> recentComments = commentRepository.getRecentComments(recentCommentDisplayCnt);
for (final JSONObject comment : recentComments) { for (final JSONObject comment : recentComments) {
String commentContent = comment.optString(Comment.COMMENT_CONTENT); String commentContent = comment.optString(Comment.COMMENT_CONTENT);
commentContent = Emotions.convert(commentContent);
commentContent = Markdowns.toHTML(commentContent); commentContent = Markdowns.toHTML(commentContent);
commentContent = Jsoup.clean(commentContent, Whitelist.relaxed()); commentContent = Jsoup.clean(commentContent, Whitelist.relaxed());
comment.put(Comment.COMMENT_CONTENT, commentContent); comment.put(Comment.COMMENT_CONTENT, commentContent);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment