From 36c6d7005eaa09741e506c5c4982a35da98e4820 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Fri, 23 Sep 2022 19:42:27 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E5=90=8C=E6=96=87=E6=A1=A3=E5=9D=97?= =?UTF-8?q?=E5=BC=95=E8=BD=AC=E8=84=9A=E6=B3=A8=E7=BC=A9=E7=95=A5=E5=AE=9A?= =?UTF-8?q?=E4=B9=89=E8=80=83=E8=99=91=E6=A0=87=E9=A2=98=E5=9D=97=20Fix=20?= =?UTF-8?q?https://github.com/siyuan-note/siyuan/issues/5917?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/model/export.go | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/kernel/model/export.go b/kernel/model/export.go index 20c2da936..90e621bbf 100644 --- a/kernel/model/export.go +++ b/kernel/model/export.go @@ -1265,11 +1265,15 @@ func resolveFootnotesDefs(refFootnotes *[]*refAsFootnotes, rootID string) (footn continue } defNode := treenode.GetNodeInTree(t, foot.defID) + docID := strings.TrimSuffix(path.Base(defNode.Path), ".sy") var nodes []*ast.Node if ast.NodeHeading == defNode.Type { nodes = append(nodes, defNode) - children := treenode.HeadingChildren(defNode) - nodes = append(nodes, children...) + if rootID != docID { + // 同文档块引转脚注缩略定义考虑容器块和标题块 https://github.com/siyuan-note/siyuan/issues/5917 + children := treenode.HeadingChildren(defNode) + nodes = append(nodes, children...) + } } else if ast.NodeDocument == defNode.Type { docTitle := &ast.Node{ID: defNode.ID, Type: ast.NodeHeading, HeadingLevel: 1} docTitle.AppendChild(&ast.Node{Type: ast.NodeText, Tokens: []byte(defNode.IALAttr("title"))}) @@ -1345,7 +1349,8 @@ func resolveFootnotesDefs(refFootnotes *[]*refAsFootnotes, rootID string) (footn } docID := strings.TrimSuffix(path.Base(n.Path), ".sy") - if rootID == docID { // 在同一个文档的话缩略显示 https://github.com/siyuan-note/siyuan/issues/3299 + if rootID == docID { + // 同文档块引转脚注缩略定义 https://github.com/siyuan-note/siyuan/issues/3299 if text := sql.GetRefText(n.ID); 64 < utf8.RuneCountInString(text) { var unlinkChildren []*ast.Node for c := n.FirstChild; nil != c; c = c.Next {