mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-09-22 08:30:42 +02:00
🎨 Improve exporting block ref https://github.com/siyuan-note/siyuan/issues/13283
This commit is contained in:
parent
2292f1a0a5
commit
39ddd18616
1 changed files with 10 additions and 5 deletions
|
@ -2174,7 +2174,7 @@ func exportTree(tree *parse.Tree, wysiwyg, keepFold, avHiddenCol bool,
|
||||||
|
|
||||||
if 4 == blockRefMode { // 块引转脚注
|
if 4 == blockRefMode { // 块引转脚注
|
||||||
unlinks = nil
|
unlinks = nil
|
||||||
footnotesDefBlock := resolveFootnotesDefs(&refFootnotes, ret, currentTreeNodeIDs, blockRefTextLeft, blockRefTextRight)
|
footnotesDefBlock := resolveFootnotesDefs(&refFootnotes, ret, currentTreeNodeIDs, blockRefTextLeft, blockRefTextRight, &treeCache)
|
||||||
if nil != footnotesDefBlock {
|
if nil != footnotesDefBlock {
|
||||||
// 如果是聚焦导出,可能存在没有使用的脚注定义块,在这里进行清理
|
// 如果是聚焦导出,可能存在没有使用的脚注定义块,在这里进行清理
|
||||||
// Improve focus export conversion of block refs to footnotes https://github.com/siyuan-note/siyuan/issues/10647
|
// Improve focus export conversion of block refs to footnotes https://github.com/siyuan-note/siyuan/issues/10647
|
||||||
|
@ -2633,7 +2633,7 @@ func exportTree(tree *parse.Tree, wysiwyg, keepFold, avHiddenCol bool,
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
func resolveFootnotesDefs(refFootnotes *[]*refAsFootnotes, currentTree *parse.Tree, currentTreeNodeIDs map[string]bool, blockRefTextLeft, blockRefTextRight string) (footnotesDefBlock *ast.Node) {
|
func resolveFootnotesDefs(refFootnotes *[]*refAsFootnotes, currentTree *parse.Tree, currentTreeNodeIDs map[string]bool, blockRefTextLeft, blockRefTextRight string, treeCache *map[string]*parse.Tree) (footnotesDefBlock *ast.Node) {
|
||||||
if 1 > len(*refFootnotes) {
|
if 1 > len(*refFootnotes) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -2641,10 +2641,15 @@ func resolveFootnotesDefs(refFootnotes *[]*refAsFootnotes, currentTree *parse.Tr
|
||||||
footnotesDefBlock = &ast.Node{Type: ast.NodeFootnotesDefBlock}
|
footnotesDefBlock = &ast.Node{Type: ast.NodeFootnotesDefBlock}
|
||||||
var rendered []string
|
var rendered []string
|
||||||
for _, foot := range *refFootnotes {
|
for _, foot := range *refFootnotes {
|
||||||
t, err := LoadTreeByBlockID(foot.defID)
|
t := (*treeCache)[foot.defID]
|
||||||
if err != nil {
|
if nil == t {
|
||||||
continue
|
var err error
|
||||||
|
if t, err = LoadTreeByBlockID(foot.defID); err != nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
(*treeCache)[t.ID] = t
|
||||||
}
|
}
|
||||||
|
|
||||||
defNode := treenode.GetNodeInTree(t, foot.defID)
|
defNode := treenode.GetNodeInTree(t, foot.defID)
|
||||||
docID := util.GetTreeID(defNode.Path)
|
docID := util.GetTreeID(defNode.Path)
|
||||||
var nodes []*ast.Node
|
var nodes []*ast.Node
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue