Sfoglia il codice sorgente

Merge remote-tracking branch 'origin/dev' into dev

Vanessa 7 mesi fa
parent
commit
855b1945de

+ 1 - 1
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/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/88250/lute => F:\golang\gopath\src\github.com\88250\lute
 //replace github.com/siyuan-note/dejavu => D:\88250\dejavu
 //replace github.com/siyuan-note/dejavu => D:\88250\dejavu

+ 2 - 2
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/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 h1:Y6dIReDpaX1zfiC2viEmEo1MNKaW/jpUR+75Bm3nsY4=
 github.com/88250/lute v1.7.7-0.20241130100631-638ecbd0c45d/go.mod h1:VDAzL8b+oCh+e3NAlmwwLzC53ten0rZlS8NboB7ljtk=
 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 h1:48T899JQDwyyRu9yXHePYlPdHtpJfrJEUGBMH3SMBWY=
 github.com/88250/vitess-sqlparser v0.0.0-20210205111146-56a2ded2aba1/go.mod h1:U3pckKQIgxxkmZjV5yXQjHdGxQK0o/vEZeZ6cQsxfHw=
 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=
 github.com/ClarkThan/ahocorasick v0.0.0-20231011042242-30d1ef1347f4 h1:r10k4+Lu1mDpiCKa1liAdGJUhB4BJHHJnMvtoli6Hts=

+ 1 - 1
kernel/harmony/build-win.sh

@@ -1,6 +1,6 @@
 #!/bin/bash
 #!/bin/bash
 
 
-export GOPROXY=https://goproxy.io
+export GOPROXY=https://mirrors.aliyun.com/goproxy/
 export CGO_ENABLED=1
 export CGO_ENABLED=1
 export GOOS=android
 export GOOS=android
 export GOARCH=amd64
 export GOARCH=amd64

+ 1 - 1
kernel/harmony/build.sh

@@ -1,6 +1,6 @@
 #!/bin/bash
 #!/bin/bash
 
 
-export GOPROXY=https://goproxy.io
+export GOPROXY=https://mirrors.aliyun.com/goproxy/
 export CGO_ENABLED=1
 export CGO_ENABLED=1
 export GOOS=android
 export GOOS=android
 export GOARCH=arm64
 export GOARCH=arm64

+ 16 - 1
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
 	var headings []*ast.Node
 	if pdf { // 导出 PDF 需要标记目录书签
 	if pdf { // 导出 PDF 需要标记目录书签
 		ast.Walk(tree.Root, func(n *ast.Node, entering bool) ast.WalkStatus {
 		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})
 			link.AppendChild(&ast.Node{Type: ast.NodeCloseParen})
 			h.PrependChild(link)
 			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,
 	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.TagOpenMarker, Conf.Export.TagCloseMarker,
 		Conf.Export.BlockRefTextLeft, Conf.Export.BlockRefTextRight,
 		Conf.Export.BlockRefTextLeft, Conf.Export.BlockRefTextRight,
 		Conf.Export.AddTitle)
 		Conf.Export.AddTitle)
@@ -1123,6 +1129,7 @@ func processPDFBookmarks(pdfCtx *model.Context, headings []*ast.Node) {
 		return links[i].Page < links[j].Page
 		return links[i].Page < links[j].Page
 	})
 	})
 
 
+	titles := map[string]bool{}
 	bms := map[string]*pdfcpu.Bookmark{}
 	bms := map[string]*pdfcpu.Bookmark{}
 	for _, link := range links {
 	for _, link := range links {
 		linkID := link.URI[strings.LastIndex(link.URI, "/")+1:]
 		linkID := link.URI[strings.LastIndex(link.URI, "/")+1:]
@@ -1133,6 +1140,14 @@ func processPDFBookmarks(pdfCtx *model.Context, headings []*ast.Node) {
 		}
 		}
 		title := b.Content
 		title := b.Content
 		title, _ = url.QueryUnescape(title)
 		title, _ = url.QueryUnescape(title)
+		for {
+			if _, ok := titles[title]; ok {
+				title += "\x01"
+			} else {
+				titles[title] = true
+				break
+			}
+		}
 		bm := &pdfcpu.Bookmark{
 		bm := &pdfcpu.Bookmark{
 			Title:    title,
 			Title:    title,
 			PageFrom: link.Page,
 			PageFrom: link.Page,

+ 1 - 1
scripts/darwin-build.sh

@@ -15,7 +15,7 @@ echo 'Building Kernel'
 cd kernel
 cd kernel
 go version
 go version
 export GO111MODULE=on
 export GO111MODULE=on
-export GOPROXY=https://goproxy.io
+export GOPROXY=https://mirrors.aliyun.com/goproxy/
 export CGO_ENABLED=1
 export CGO_ENABLED=1
 
 
 echo 'Building Kernel amd64'
 echo 'Building Kernel amd64'

+ 1 - 1
scripts/linux-build.sh

@@ -15,7 +15,7 @@ echo 'Building Kernel'
 cd kernel
 cd kernel
 go version
 go version
 export GO111MODULE=on
 export GO111MODULE=on
-export GOPROXY=https://goproxy.io
+export GOPROXY=https://mirrors.aliyun.com/goproxy/
 export CGO_ENABLED=1
 export CGO_ENABLED=1
 
 
 echo 'Building Kernel amd64'
 echo 'Building Kernel amd64'

+ 1 - 1
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/
 @REM the C compiler "gcc" is necessary https://sourceforge.net/projects/mingw-w64/files/mingw-w64/
 go version
 go version
 set GO111MODULE=on
 set GO111MODULE=on
-set GOPROXY=https://goproxy.io
+set GOPROXY=https://mirrors.aliyun.com/goproxy/
 set CGO_ENABLED=1
 set CGO_ENABLED=1
 
 
 cd kernel
 cd kernel