From d00c20eac0fd5256272ae85250a9bec24327a0b0 Mon Sep 17 00:00:00 2001 From: Liang Ding Date: Wed, 16 Nov 2022 21:41:24 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20=E6=94=B9=E8=BF=9B=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E6=97=B6=E5=BC=95=E7=94=A8=E5=B5=8C=E5=A5=97=E9=94=9A=E6=96=87?= =?UTF-8?q?=E6=9C=AC=E7=9A=84=E6=B8=B2=E6=9F=93=20Fix=20https://github.com?= =?UTF-8?q?/siyuan-note/siyuan/issues/6614?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- kernel/model/export.go | 33 ++------------------------------- 1 file changed, 2 insertions(+), 31 deletions(-) diff --git a/kernel/model/export.go b/kernel/model/export.go index e39371ba2..de3e154fc 100644 --- a/kernel/model/export.go +++ b/kernel/model/export.go @@ -354,26 +354,6 @@ func ExportHTML(id, savePath string, pdf, keepFold bool) (name, dom string) { } tree = exportTree(tree, true, true, keepFold) - //if pdf { // TODO: 导出 PDF 时块引转换脚注使用书签跳转 https://github.com/siyuan-note/siyuan/issues/5761 - // var footnotesDefs []*ast.Node - // ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus { - // if entering && ast.NodeFootnotesDef == n.Type { - // footnotesDefs = append(footnotesDefs, n) - // } - // return ast.WalkContinue - // }) - // for _, f := range footnotesDefs { - // link := &ast.Node{Type: ast.NodeLink} - // link.AppendChild(&ast.Node{Type: ast.NodeOpenBracket}) - // link.AppendChild(&ast.Node{Type: ast.NodeText, Tokens: []byte(" ")}) - // link.AppendChild(&ast.Node{Type: ast.NodeCloseBracket}) - // link.AppendChild(&ast.Node{Type: ast.NodeOpenParen}) - // link.AppendChild(&ast.Node{Type: ast.NodeLinkDest, Tokens: []byte("pdf-outline://footnotes-def-" + f.FootnotesRefId)}) - // link.AppendChild(&ast.Node{Type: ast.NodeCloseParen}) - // f.PrependChild(link) - // } - //} - name = path.Base(tree.HPath) name = util.FilterFileName(name) // 导出 PDF、HTML 和 Word 时未移除不支持的文件名符号 https://github.com/siyuan-note/siyuan/issues/5614 @@ -504,15 +484,6 @@ func AddPDFOutline(id, p string) (err error) { footnotes := map[string]*pdfcpu.Bookmark{} for _, link := range links { linkID := link.URI[strings.LastIndex(link.URI, "/")+1:] - //if strings.HasPrefix(linkID, "footnotes-def-") { // 导出 PDF 时块引转换脚注使用书签跳转 https://github.com/siyuan-note/siyuan/issues/5761 - // footnotes[linkID] = &pdfcpu.Bookmark{ - // Title: "Footnote [^" + linkID + "]", - // PageFrom: link.Page, - // AbsPos: link.Rect.UR.Y, - // Level: 7, - // } - // continue - //} title := sql.GetBlock(linkID).Content title, _ = url.QueryUnescape(title) @@ -1469,9 +1440,9 @@ func collectFootnotesDefs0(node *ast.Node, refFootnotes *[]*refAsFootnotes, tree } if treenode.IsBlockRef(n) { - defID, _, _ := treenode.GetBlockRef(n) + defID, refText, _ := treenode.GetBlockRef(n) if nil == getRefAsFootnotes(defID, refFootnotes) { - anchorText := sql.GetRefText(defID) + anchorText := refText if Conf.Editor.BlockRefDynamicAnchorTextMaxLen < utf8.RuneCountInString(anchorText) { anchorText = gulu.Str.SubStr(anchorText, Conf.Editor.BlockRefDynamicAnchorTextMaxLen) + "..." }