Selaa lähdekoodia

:bug: Blockquote in list turn into paragraph causes internal error https://github.com/siyuan-note/siyuan/issues/9920

Daniel 1 vuosi sitten
vanhempi
commit
106ffb292b
3 muutettua tiedostoa jossa 12 lisäystä ja 10 poistoa
  1. 4 7
      kernel/sql/database.go
  2. 1 1
      kernel/treenode/node.go
  3. 7 2
      kernel/util/tesseract.go

+ 4 - 7
kernel/sql/database.go

@@ -798,15 +798,14 @@ func buildBlockFromNode(n *ast.Node, tree *parse.Tree) (block *Block, attributes
 		length = utf8.RuneCountInString(fcontent)
 		length = utf8.RuneCountInString(fcontent)
 	} else if n.IsContainerBlock() {
 	} else if n.IsContainerBlock() {
 		markdown = treenode.ExportNodeStdMd(n, luteEngine)
 		markdown = treenode.ExportNodeStdMd(n, luteEngine)
-
 		if !treenode.IsNodeOCRed(n) {
 		if !treenode.IsNodeOCRed(n) {
-			util.PushNodeOCRQueue(n.ID)
+			util.PushNodeOCRQueue(n)
 		}
 		}
 		content = treenode.NodeStaticContent(n, nil, true, indexAssetPath)
 		content = treenode.NodeStaticContent(n, nil, true, indexAssetPath)
-		fc := treenode.FirstLeafBlock(n)
 
 
+		fc := treenode.FirstLeafBlock(n)
 		if !treenode.IsNodeOCRed(fc) {
 		if !treenode.IsNodeOCRed(fc) {
-			util.PushNodeOCRQueue(fc.ID)
+			util.PushNodeOCRQueue(fc)
 		}
 		}
 		fcontent = treenode.NodeStaticContent(fc, nil, true, false)
 		fcontent = treenode.NodeStaticContent(fc, nil, true, false)
 
 
@@ -818,11 +817,9 @@ func buildBlockFromNode(n *ast.Node, tree *parse.Tree) (block *Block, attributes
 		length = utf8.RuneCountInString(fcontent)
 		length = utf8.RuneCountInString(fcontent)
 	} else {
 	} else {
 		markdown = treenode.ExportNodeStdMd(n, luteEngine)
 		markdown = treenode.ExportNodeStdMd(n, luteEngine)
-
 		if !treenode.IsNodeOCRed(n) {
 		if !treenode.IsNodeOCRed(n) {
-			util.PushNodeOCRQueue(n.ID)
+			util.PushNodeOCRQueue(n)
 		}
 		}
-
 		content = treenode.NodeStaticContent(n, nil, true, indexAssetPath)
 		content = treenode.NodeStaticContent(n, nil, true, indexAssetPath)
 
 
 		parentID = n.Parent.ID
 		parentID = n.Parent.ID

+ 1 - 1
kernel/treenode/node.go

@@ -138,7 +138,7 @@ func ExportNodeStdMd(node *ast.Node, luteEngine *lute.Lute) string {
 
 
 func IsNodeOCRed(node *ast.Node) (ret bool) {
 func IsNodeOCRed(node *ast.Node) (ret bool) {
 	if !util.TesseractEnabled || nil == node {
 	if !util.TesseractEnabled || nil == node {
-		return
+		return true
 	}
 	}
 
 
 	ret = true
 	ret = true

+ 7 - 2
kernel/util/tesseract.go

@@ -30,6 +30,7 @@ import (
 	"time"
 	"time"
 
 
 	"github.com/88250/gulu"
 	"github.com/88250/gulu"
+	"github.com/88250/lute/ast"
 	"github.com/88250/lute/html"
 	"github.com/88250/lute/html"
 	"github.com/dustin/go-humanize"
 	"github.com/dustin/go-humanize"
 	"github.com/siyuan-note/logging"
 	"github.com/siyuan-note/logging"
@@ -279,8 +280,12 @@ var (
 	NodeOCRQueueLock = sync.Mutex{}
 	NodeOCRQueueLock = sync.Mutex{}
 )
 )
 
 
-func PushNodeOCRQueue(id string) {
+func PushNodeOCRQueue(n *ast.Node) {
+	if nil == n {
+		return
+	}
+
 	NodeOCRQueueLock.Lock()
 	NodeOCRQueueLock.Lock()
 	defer NodeOCRQueueLock.Unlock()
 	defer NodeOCRQueueLock.Unlock()
-	NodeOCRQueue = append(NodeOCRQueue, id)
+	NodeOCRQueue = append(NodeOCRQueue, n.ID)
 }
 }