pull/1395/head
gedoor 3 years ago
parent d30dc44aa9
commit 5c70e155ef
  1. 7
      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)
}
Loading…
Cancel
Save