fix condition of xml-like code detection

This commit is contained in:
houxg
2016-12-15 19:31:43 +08:00
parent d3c5fc55dd
commit 9d263e12a9

View File

@@ -18,6 +18,7 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.regex.Pattern;
import okio.BufferedSink; import okio.BufferedSink;
import okio.Okio; import okio.Okio;
@@ -93,7 +94,7 @@ public class HtmlImporter {
preElement.addClass("ace-tomorrow"); preElement.addClass("ace-tomorrow");
removeClassLike(preElement, "brush:\\w+"); removeClassLike(preElement, "brush:\\w+");
//to be compatible with desktop app, https://github.com/leanote/desktop-app/issues/192 //to be compatible with desktop app, https://github.com/leanote/desktop-app/issues/192
if (codeHtml.matches("<.+>")) { if (Pattern.compile("<.+>").matcher(codeHtml).find()) {
preElement.addClass("brush:html"); preElement.addClass("brush:html");
} else { } else {
preElement.addClass("brush:convert"); preElement.addClass("brush:convert");