mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
♻️ Improve av structure
This commit is contained in:
parent
f75d5e50b4
commit
373bce9791
10 changed files with 819 additions and 1165 deletions
|
|
@ -30,6 +30,7 @@ import (
|
|||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
"text/template"
|
||||
"time"
|
||||
"unicode/utf8"
|
||||
|
||||
|
|
@ -824,13 +825,13 @@ func buildBlockFromNode(n *ast.Node, tree *parse.Tree) (block *Block, attributes
|
|||
if !treenode.IsNodeOCRed(n) {
|
||||
util.PushNodeOCRQueue(n)
|
||||
}
|
||||
content = treenode.NodeStaticContent(n, nil, true, indexAssetPath, true)
|
||||
content = NodeStaticContent(n, nil, true, indexAssetPath, true, nil)
|
||||
|
||||
fc := treenode.FirstLeafBlock(n)
|
||||
if !treenode.IsNodeOCRed(fc) {
|
||||
util.PushNodeOCRQueue(fc)
|
||||
}
|
||||
fcontent = treenode.NodeStaticContent(fc, nil, true, false, true)
|
||||
fcontent = NodeStaticContent(fc, nil, true, false, true, nil)
|
||||
|
||||
parentID = n.Parent.ID
|
||||
if h := heading(n); nil != h { // 如果在标题块下方,则将标题块作为父节点
|
||||
|
|
@ -842,7 +843,7 @@ func buildBlockFromNode(n *ast.Node, tree *parse.Tree) (block *Block, attributes
|
|||
if !treenode.IsNodeOCRed(n) {
|
||||
util.PushNodeOCRQueue(n)
|
||||
}
|
||||
content = treenode.NodeStaticContent(n, nil, true, indexAssetPath, true)
|
||||
content = NodeStaticContent(n, nil, true, indexAssetPath, true, nil)
|
||||
|
||||
parentID = n.Parent.ID
|
||||
if h := heading(n); nil != h {
|
||||
|
|
@ -1461,3 +1462,20 @@ func closeDatabase() (err error) {
|
|||
runtime.GC() // 没有这句的话文件句柄不会释放,后面就无法删除文件
|
||||
return
|
||||
}
|
||||
|
||||
func SQLTemplateFuncs(templateFuncMap *template.FuncMap) {
|
||||
(*templateFuncMap)["queryBlocks"] = func(stmt string, args ...string) (retBlocks []*Block) {
|
||||
for _, arg := range args {
|
||||
stmt = strings.Replace(stmt, "?", arg, 1)
|
||||
}
|
||||
retBlocks = SelectBlocksRawStmt(stmt, 1, 512)
|
||||
return
|
||||
}
|
||||
(*templateFuncMap)["querySpans"] = func(stmt string, args ...string) (retSpans []*Span) {
|
||||
for _, arg := range args {
|
||||
stmt = strings.Replace(stmt, "?", arg, 1)
|
||||
}
|
||||
retSpans = SelectSpansRawStmt(stmt, 512)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue