diff --git a/app/src/main/java/io/legado/app/utils/CodeViewExtensions.kt b/app/src/main/java/io/legado/app/utils/CodeViewExtensions.kt index d3c450b25..4206afd0d 100644 --- a/app/src/main/java/io/legado/app/utils/CodeViewExtensions.kt +++ b/app/src/main/java/io/legado/app/utils/CodeViewExtensions.kt @@ -3,14 +3,16 @@ package io.legado.app.utils +import android.graphics.Color import io.legado.app.lib.theme.accentColor import io.legado.app.ui.widget.code.CodeView import splitties.init.appCtx import java.util.regex.Pattern val legadoPattern: Pattern = Pattern.compile("\\|\\||&&|%%|@js:|@Json:|@css:|@@|@XPath:") -val jsonPattern: Pattern = Pattern.compile("\".*?\"\\:|\"|\\{|\\}|\\[|\\]") -val jsPattern: Pattern = Pattern.compile("var|\\\\n") +val jsonPattern: Pattern = Pattern.compile("\"[A-Za-z0-9]*?\"\\:|\"|\\{|\\}|\\[|\\]") +val wrapPattern: Pattern = Pattern.compile("\\\\n") +val jsPattern: Pattern = Pattern.compile("var|=") fun CodeView.addLegadoPattern() { addSyntaxPattern(legadoPattern, appCtx.accentColor) @@ -21,5 +23,6 @@ fun CodeView.addJsonPattern() { } fun CodeView.addJsPattern() { + addSyntaxPattern(wrapPattern, Color.DKGRAY) addSyntaxPattern(jsPattern, appCtx.accentColor) } \ No newline at end of file