Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Vanessa 2023-12-19 12:20:38 +08:00
commit 190761a8ff
4 changed files with 19 additions and 13 deletions

File diff suppressed because one or more lines are too long

View file

@ -9,7 +9,7 @@ require (
github.com/88250/clipboard v0.1.5
github.com/88250/epub v0.0.0-20230830085737-c19055cd1f48
github.com/88250/gulu v1.2.3-0.20231209020950-b7b6994e395c
github.com/88250/lute v1.7.6-0.20231215140815-899eaf6868e4
github.com/88250/lute v1.7.6-0.20231219041316-775fdaf49900
github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1
github.com/ClarkThan/ahocorasick v0.0.0-20231011042242-30d1ef1347f4

View file

@ -10,8 +10,8 @@ github.com/88250/go-sqlite3 v1.14.13-0.20231214121541-e7f54c482950 h1:Pa5hMiBceT
github.com/88250/go-sqlite3 v1.14.13-0.20231214121541-e7f54c482950/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
github.com/88250/gulu v1.2.3-0.20231209020950-b7b6994e395c h1:Fas3hxqP33xA9KKDV50jUmppiiOukk5bdV00Hk5VSSk=
github.com/88250/gulu v1.2.3-0.20231209020950-b7b6994e395c/go.mod h1:pTWnjt+6qUqNnP9xltswsJxgCBVu3C7eW09u48LWX0k=
github.com/88250/lute v1.7.6-0.20231215140815-899eaf6868e4 h1:/M4Au0UFIgYPxJ9RGmqonYF+9E+v2E20POUNIzW587s=
github.com/88250/lute v1.7.6-0.20231215140815-899eaf6868e4/go.mod h1:+wUqx/1kdFDbWtxn9LYJlaCOAeol2pjSO6w+WJTVQsg=
github.com/88250/lute v1.7.6-0.20231219041316-775fdaf49900 h1:fhfSJw90z5SDbNma8RNqrSqFRmnm9DlImPwN5g9i9fg=
github.com/88250/lute v1.7.6-0.20231219041316-775fdaf49900/go.mod h1:+wUqx/1kdFDbWtxn9LYJlaCOAeol2pjSO6w+WJTVQsg=
github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c h1:Dl/8S9iLyPMTElnWIBxmjaLiWrkI5P4a21ivwAn5pU0=
github.com/88250/pdfcpu v0.3.14-0.20230401044135-c7369a99720c/go.mod h1:S5YT38L/GCjVjmB4PB84PymA1qfopjEhfhTNQilLpv4=
github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1 h1:48T899JQDwyyRu9yXHePYlPdHtpJfrJEUGBMH3SMBWY=

View file

@ -137,6 +137,10 @@ func ExportNodeStdMd(node *ast.Node, luteEngine *lute.Lute) string {
}
func IsNodeOCRed(node *ast.Node) (ret bool) {
if !util.TesseractEnabled || nil == node {
return
}
ret = true
ast.Walk(node, func(n *ast.Node, entering bool) ast.WalkStatus {
if !entering {
@ -145,16 +149,18 @@ func IsNodeOCRed(node *ast.Node) (ret bool) {
if ast.NodeImage == n.Type {
linkDest := n.ChildByType(ast.NodeLinkDest)
if nil != linkDest {
linkDestStr := linkDest.TokensStr()
if !cache.ExistAsset(linkDestStr) {
return ast.WalkContinue
}
if nil == linkDest {
return ast.WalkContinue
}
if !util.ExistsAssetText(linkDestStr) {
ret = false
return ast.WalkStop
}
linkDestStr := linkDest.TokensStr()
if !cache.ExistAsset(linkDestStr) {
return ast.WalkContinue
}
if !util.ExistsAssetText(linkDestStr) {
ret = false
return ast.WalkStop
}
}
return ast.WalkContinue