refactor: markdown parse emoji type.

pull/435/head
ruibaby 2019-12-19 19:20:34 +08:00
parent f5d957edc1
commit 5c6d2abc00
3 changed files with 9 additions and 7 deletions

View File

@ -453,7 +453,7 @@ public class AdminServiceImpl implements AdminService {
public String getApplicationConfig() {
File file = new File(haloProperties.getWorkDir(), APPLICATION_CONFIG_NAME);
if (!file.exists()) {
return "";
return StringUtils.EMPTY;
}
FileReader reader = new FileReader(file);
return reader.readString();

View File

@ -34,7 +34,7 @@ public class FilenameUtils {
int separatorLastIndex = StringUtils.lastIndexOf(filename, File.separatorChar);
if (separatorLastIndex == filename.length() - 1) {
return "";
return StringUtils.EMPTY;
}
if (separatorLastIndex >= 0 && separatorLastIndex < filename.length() - 1) {
@ -70,7 +70,7 @@ public class FilenameUtils {
int separatorLastIndex = StringUtils.lastIndexOf(filename, File.separatorChar);
if (separatorLastIndex == filename.length() - 1) {
return "";
return StringUtils.EMPTY;
}
if (separatorLastIndex >= 0 && separatorLastIndex < filename.length() - 1) {
@ -81,7 +81,7 @@ public class FilenameUtils {
int dotLastIndex = StringUtils.lastIndexOf(filename, '.');
if (dotLastIndex < 0) {
return "";
return StringUtils.EMPTY;
}
return filename.substring(dotLastIndex + 1);

View File

@ -23,6 +23,8 @@ import com.vladsch.flexmark.util.ast.Node;
import com.vladsch.flexmark.util.options.DataHolder;
import com.vladsch.flexmark.util.options.MutableDataSet;
import org.apache.commons.lang3.StringUtils;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import run.halo.app.model.support.HaloConst;
import java.util.Arrays;
@ -61,8 +63,8 @@ public class MarkdownUtils {
.set(TablesExtension.APPEND_MISSING_COLUMNS, true)
.set(TablesExtension.DISCARD_EXTRA_COLUMNS, true)
.set(TablesExtension.HEADER_SEPARATOR_COLUMN_MATCH, true)
.set(EmojiExtension.USE_SHORTCUT_TYPE, EmojiShortcutType.GITHUB)
.set(EmojiExtension.USE_IMAGE_TYPE, EmojiImageType.IMAGE_ONLY);
.set(EmojiExtension.USE_SHORTCUT_TYPE, EmojiShortcutType.EMOJI_CHEAT_SHEET)
.set(EmojiExtension.USE_IMAGE_TYPE, EmojiImageType.UNICODE_ONLY);
private static final Parser PARSER = Parser.builder(OPTIONS).build();
@ -76,7 +78,7 @@ public class MarkdownUtils {
*/
public static String renderHtml(String markdown) {
if (StringUtils.isBlank(markdown)) {
return "";
return StringUtils.EMPTY;
}
// Render netease music short url.