From 5c70e155ef1f7f2b1697a1e3ea39b90818ac1b55 Mon Sep 17 00:00:00 2001 From: gedoor Date: Tue, 5 Oct 2021 02:08:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/legado/app/utils/CodeViewExtensions.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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