From bbc332642666fd89895160c505e61c4f752812de Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Sat, 30 Nov 2024 20:56:59 +0800 Subject: [PATCH 1/3] :hammer: Update goproxy to https://mirrors.aliyun.com/goproxy/ --- kernel/harmony/build-win.sh | 2 +- kernel/harmony/build.sh | 2 +- scripts/darwin-build.sh | 2 +- scripts/linux-build.sh | 2 +- scripts/win-build.bat | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/kernel/harmony/build-win.sh b/kernel/harmony/build-win.sh index fc3b15d32..329b66bff 100755 --- a/kernel/harmony/build-win.sh +++ b/kernel/harmony/build-win.sh @@ -1,6 +1,6 @@ #!/bin/bash -export GOPROXY=https://goproxy.io +export GOPROXY=https://mirrors.aliyun.com/goproxy/ export CGO_ENABLED=1 export GOOS=android export GOARCH=amd64 diff --git a/kernel/harmony/build.sh b/kernel/harmony/build.sh index a1c3c9569..5b229fa1c 100755 --- a/kernel/harmony/build.sh +++ b/kernel/harmony/build.sh @@ -1,6 +1,6 @@ #!/bin/bash -export GOPROXY=https://goproxy.io +export GOPROXY=https://mirrors.aliyun.com/goproxy/ export CGO_ENABLED=1 export GOOS=android export GOARCH=arm64 diff --git a/scripts/darwin-build.sh b/scripts/darwin-build.sh index 8fe5bc1f1..304c018d9 100755 --- a/scripts/darwin-build.sh +++ b/scripts/darwin-build.sh @@ -15,7 +15,7 @@ echo 'Building Kernel' cd kernel go version export GO111MODULE=on -export GOPROXY=https://goproxy.io +export GOPROXY=https://mirrors.aliyun.com/goproxy/ export CGO_ENABLED=1 echo 'Building Kernel amd64' diff --git a/scripts/linux-build.sh b/scripts/linux-build.sh index 660763305..d5dbfe673 100755 --- a/scripts/linux-build.sh +++ b/scripts/linux-build.sh @@ -15,7 +15,7 @@ echo 'Building Kernel' cd kernel go version export GO111MODULE=on -export GOPROXY=https://goproxy.io +export GOPROXY=https://mirrors.aliyun.com/goproxy/ export CGO_ENABLED=1 echo 'Building Kernel amd64' diff --git a/scripts/win-build.bat b/scripts/win-build.bat index e12148e5c..eabd79b7c 100644 --- a/scripts/win-build.bat +++ b/scripts/win-build.bat @@ -19,7 +19,7 @@ echo 'Building Kernel' @REM the C compiler "gcc" is necessary https://sourceforge.net/projects/mingw-w64/files/mingw-w64/ go version set GO111MODULE=on -set GOPROXY=https://goproxy.io +set GOPROXY=https://mirrors.aliyun.com/goproxy/ set CGO_ENABLED=1 cd kernel From c8670fe146cba508ec53ec005b9b949e92981c52 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Sat, 30 Nov 2024 22:01:34 +0800 Subject: [PATCH 2/3] :art: Improve exporting block ref https://github.com/siyuan-note/siyuan/issues/13283 --- kernel/model/export.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/kernel/model/export.go b/kernel/model/export.go index 7d36e85cd..fe0944235 100644 --- a/kernel/model/export.go +++ b/kernel/model/export.go @@ -796,6 +796,7 @@ func ExportHTML(id, savePath string, pdf, image, keepFold, merge bool) (name, do } } + blockRefMode := Conf.Export.BlockRefMode var headings []*ast.Node if pdf { // 导出 PDF 需要标记目录书签 ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus { @@ -816,10 +817,15 @@ func ExportHTML(id, savePath string, pdf, image, keepFold, merge bool) (name, do link.AppendChild(&ast.Node{Type: ast.NodeCloseParen}) h.PrependChild(link) } + + if 5 == blockRefMode { + // 导出 PDF 时如果用户设置的块引导出模式是哈希锚点(5)则将其强制设置脚注(4)https://github.com/siyuan-note/siyuan/issues/13283 + blockRefMode = 4 + } } tree = exportTree(tree, true, keepFold, true, - Conf.Export.BlockRefMode, Conf.Export.BlockEmbedMode, Conf.Export.FileAnnotationRefMode, + blockRefMode, Conf.Export.BlockEmbedMode, Conf.Export.FileAnnotationRefMode, Conf.Export.TagOpenMarker, Conf.Export.TagCloseMarker, Conf.Export.BlockRefTextLeft, Conf.Export.BlockRefTextRight, Conf.Export.AddTitle) From 1c060947f93c3ed69bc0c81528c770d0ec4ede17 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Sun, 1 Dec 2024 11:49:34 +0800 Subject: [PATCH 3/3] :bug: Fix pdf outline exporting https://github.com/siyuan-note/siyuan/issues/13319 --- kernel/go.mod | 2 +- kernel/go.sum | 4 ++-- kernel/model/export.go | 9 +++++++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/kernel/go.mod b/kernel/go.mod index 76228cefc..8f34fee73 100644 --- a/kernel/go.mod +++ b/kernel/go.mod @@ -177,7 +177,7 @@ require ( replace github.com/mattn/go-sqlite3 => github.com/88250/go-sqlite3 v1.14.13-0.20231214121541-e7f54c482950 -replace github.com/pdfcpu/pdfcpu => github.com/88250/pdfcpu v0.3.14-0.20241128123312-a688ff960d4f +replace github.com/pdfcpu/pdfcpu => github.com/88250/pdfcpu v0.3.14-0.20241201033812-5a93b7586a01 //replace github.com/88250/lute => F:\golang\gopath\src\github.com\88250\lute //replace github.com/siyuan-note/dejavu => D:\88250\dejavu diff --git a/kernel/go.sum b/kernel/go.sum index 6c1aea718..818f3ffd2 100644 --- a/kernel/go.sum +++ b/kernel/go.sum @@ -16,8 +16,8 @@ github.com/88250/gulu v1.2.3-0.20241127120230-1ae6a9868a2d h1:dexFyk3UkR4c2xpyrC github.com/88250/gulu v1.2.3-0.20241127120230-1ae6a9868a2d/go.mod h1:MUfzyfmbPrRDZLqxc7aPrVYveatTHRfoUa5TynPS0i8= github.com/88250/lute v1.7.7-0.20241130100631-638ecbd0c45d h1:Y6dIReDpaX1zfiC2viEmEo1MNKaW/jpUR+75Bm3nsY4= github.com/88250/lute v1.7.7-0.20241130100631-638ecbd0c45d/go.mod h1:VDAzL8b+oCh+e3NAlmwwLzC53ten0rZlS8NboB7ljtk= -github.com/88250/pdfcpu v0.3.14-0.20241128123312-a688ff960d4f h1:oUW8FPgQ/RQzDG3nll1Qe3FfmBvelxjDkNNipF1ntck= -github.com/88250/pdfcpu v0.3.14-0.20241128123312-a688ff960d4f/go.mod h1:fVfOloBzs2+W2VJCCbq60XIxc3yJHAZ0Gahv1oO0gyI= +github.com/88250/pdfcpu v0.3.14-0.20241201033812-5a93b7586a01 h1:AcFe63RXjIh1XtX/dc4Es3U8bYKjlEkvavHd1nFBOHM= +github.com/88250/pdfcpu v0.3.14-0.20241201033812-5a93b7586a01/go.mod h1:fVfOloBzs2+W2VJCCbq60XIxc3yJHAZ0Gahv1oO0gyI= github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1 h1:48T899JQDwyyRu9yXHePYlPdHtpJfrJEUGBMH3SMBWY= github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1/go.mod h1:U3pckKQIgxxkmZjV5yXQjHdGxQK0o/vEZeZ6cQsxfHw= github.com/ClarkThan/ahocorasick v0.0.0-20231011042242-30d1ef1347f4 h1:r10k4+Lu1mDpiCKa1liAdGJUhB4BJHHJnMvtoli6Hts= diff --git a/kernel/model/export.go b/kernel/model/export.go index fe0944235..49e995497 100644 --- a/kernel/model/export.go +++ b/kernel/model/export.go @@ -1129,6 +1129,7 @@ func processPDFBookmarks(pdfCtx *model.Context, headings []*ast.Node) { return links[i].Page < links[j].Page }) + titles := map[string]bool{} bms := map[string]*pdfcpu.Bookmark{} for _, link := range links { linkID := link.URI[strings.LastIndex(link.URI, "/")+1:] @@ -1139,6 +1140,14 @@ func processPDFBookmarks(pdfCtx *model.Context, headings []*ast.Node) { } title := b.Content title, _ = url.QueryUnescape(title) + for { + if _, ok := titles[title]; ok { + title += "\x01" + } else { + titles[title] = true + break + } + } bm := &pdfcpu.Bookmark{ Title: title, PageFrom: link.Page,