Skip to content

Commit 094138b

Browse files
committed
Merge remote-tracking branch 'origin/dev' into dev
2 parents ba4c3d4 + 17de3bc commit 094138b

File tree

4 files changed

+20
-10
lines changed

4 files changed

+20
-10
lines changed

kernel/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ require (
1010
github.com/88250/epub v0.0.0-20230830085737-c19055cd1f48
1111
github.com/88250/go-humanize v0.0.0-20240424102817-4f78fac47ea7
1212
github.com/88250/gulu v1.2.3-0.20250227144607-7f4570b0d689
13-
github.com/88250/lute v1.7.7-0.20250403053607-31b58724a8c7
13+
github.com/88250/lute v1.7.7-0.20250403074251-fd2d4ffa705c
1414
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1
1515
github.com/ClarkThan/ahocorasick v0.0.0-20231011042242-30d1ef1347f4
1616
github.com/ConradIrwin/font v0.2.1

kernel/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ github.com/88250/go-sqlite3 v1.14.13-0.20231214121541-e7f54c482950 h1:Pa5hMiBceT
1414
github.com/88250/go-sqlite3 v1.14.13-0.20231214121541-e7f54c482950/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
1515
github.com/88250/gulu v1.2.3-0.20250227144607-7f4570b0d689 h1:39y5g7vnFAIcXhTN3IXPk7h2xBhC4a9hBTykDhHJqRY=
1616
github.com/88250/gulu v1.2.3-0.20250227144607-7f4570b0d689/go.mod h1:c8uVw25vW2W4dhJ/j4iYsX5H1hc19spim266jO5x2hU=
17-
github.com/88250/lute v1.7.7-0.20250403053607-31b58724a8c7 h1:EzmUVWBZdJ2V3vm/HjsG2+JiXCL3OLorT+MIHPB1/FQ=
18-
github.com/88250/lute v1.7.7-0.20250403053607-31b58724a8c7/go.mod h1:WYyUw//5yVw9BJnoVjx7rI/3szsISxNZCYGOqTIrV0o=
17+
github.com/88250/lute v1.7.7-0.20250403074251-fd2d4ffa705c h1:WdGQUp3fmBzlFqalFDO7LdkOXamNZ3p1zZJh604vM2s=
18+
github.com/88250/lute v1.7.7-0.20250403074251-fd2d4ffa705c/go.mod h1:WYyUw//5yVw9BJnoVjx7rI/3szsISxNZCYGOqTIrV0o=
1919
github.com/88250/pdfcpu v0.3.14-0.20241201033812-5a93b7586a01 h1:AcFe63RXjIh1XtX/dc4Es3U8bYKjlEkvavHd1nFBOHM=
2020
github.com/88250/pdfcpu v0.3.14-0.20241201033812-5a93b7586a01/go.mod h1:fVfOloBzs2+W2VJCCbq60XIxc3yJHAZ0Gahv1oO0gyI=
2121
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1 h1:48T899JQDwyyRu9yXHePYlPdHtpJfrJEUGBMH3SMBWY=

kernel/model/search.go

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -667,8 +667,11 @@ func FindReplace(keyword, replacement string, replaceTypes map[string]bool, ids
667667
} else if n.IsTextMarkType("a") {
668668
if replaceTypes["aText"] {
669669
if 0 == method {
670-
if strings.Contains(n.TextMarkTextContent, keyword) {
671-
n.TextMarkTextContent = strings.ReplaceAll(n.TextMarkTextContent, keyword, replacement)
670+
content := util.UnescapeHTML(n.TextMarkTextContent)
671+
if strings.Contains(content, escapedKey) {
672+
n.TextMarkTextContent = strings.ReplaceAll(content, escapedKey, replacement)
673+
} else if strings.Contains(content, keyword) {
674+
n.TextMarkTextContent = strings.ReplaceAll(content, keyword, replacement)
672675
}
673676
} else if 3 == method {
674677
if nil != r && r.MatchString(n.TextMarkTextContent) {
@@ -683,8 +686,11 @@ func FindReplace(keyword, replacement string, replaceTypes map[string]bool, ids
683686

684687
if replaceTypes["aTitle"] {
685688
if 0 == method {
686-
if strings.Contains(n.TextMarkATitle, keyword) {
687-
n.TextMarkATitle = strings.ReplaceAll(n.TextMarkATitle, keyword, replacement)
689+
title := util.UnescapeHTML(n.TextMarkATitle)
690+
if strings.Contains(title, escapedKey) {
691+
n.TextMarkATitle = strings.ReplaceAll(title, escapedKey, replacement)
692+
} else if strings.Contains(n.TextMarkATitle, keyword) {
693+
n.TextMarkATitle = strings.ReplaceAll(title, keyword, replacement)
688694
}
689695
} else if 3 == method {
690696
if nil != r && r.MatchString(n.TextMarkATitle) {
@@ -695,8 +701,11 @@ func FindReplace(keyword, replacement string, replaceTypes map[string]bool, ids
695701

696702
if replaceTypes["aHref"] {
697703
if 0 == method {
698-
if strings.Contains(n.TextMarkAHref, keyword) {
699-
n.TextMarkAHref = strings.ReplaceAll(n.TextMarkAHref, keyword, strings.TrimSpace(replacement))
704+
href := util.UnescapeHTML(n.TextMarkAHref)
705+
if strings.Contains(href, escapedKey) {
706+
n.TextMarkAHref = strings.ReplaceAll(href, escapedKey, util.EscapeHTML(replacement))
707+
} else if strings.Contains(href, keyword) {
708+
n.TextMarkAHref = strings.ReplaceAll(href, keyword, strings.TrimSpace(replacement))
700709
}
701710
} else if 3 == method {
702711
if nil != r && r.MatchString(n.TextMarkAHref) {

kernel/sql/block.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,8 @@ func nodeStaticContent(node *ast.Node, excludeTypes []string, includeTextMarkATi
257257
}
258258

259259
if !strings.HasPrefix(n.TextMarkAHref, "assets/") || includeAssetPath {
260-
buf.WriteString(" " + util.UnescapeHTML(n.TextMarkAHref))
260+
href := util.UnescapeHTML(n.TextMarkAHref)
261+
buf.WriteString(" " + util.UnescapeHTML(href))
261262
}
262263
}
263264
case ast.NodeBackslashContent:

0 commit comments

Comments
 (0)