mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-30 13:28:48 +01:00
🎨 笔记本支持导出 .sy.zip https://github.com/siyuan-note/siyuan/issues/5475
This commit is contained in:
parent
be2913c956
commit
06e970fb90
3 changed files with 39 additions and 0 deletions
|
|
@ -47,6 +47,11 @@ import (
|
|||
"github.com/siyuan-note/siyuan/kernel/util"
|
||||
)
|
||||
|
||||
func ExportNotebookSY(id string) (zipPath string) {
|
||||
zipPath = exportBoxSYZip(id)
|
||||
return
|
||||
}
|
||||
|
||||
func ExportSY(id string) (name, zipPath string) {
|
||||
block := treenode.GetBlockTree(id)
|
||||
if nil == block {
|
||||
|
|
@ -612,6 +617,23 @@ func exportMarkdownZip(boxID, baseFolderName string, docPaths []string) (zipPath
|
|||
return
|
||||
}
|
||||
|
||||
func exportBoxSYZip(boxID string) (zipPath string) {
|
||||
box := Conf.Box(boxID)
|
||||
if nil == box {
|
||||
logging.LogErrorf("not found box [%s]", boxID)
|
||||
return
|
||||
}
|
||||
baseFolderName := box.Name
|
||||
|
||||
var docPaths []string
|
||||
docFiles := box.ListFiles("/")
|
||||
for _, docFile := range docFiles {
|
||||
docPaths = append(docPaths, docFile.path)
|
||||
}
|
||||
zipPath = exportSYZip(boxID, "/", baseFolderName, docPaths)
|
||||
return
|
||||
}
|
||||
|
||||
func exportSYZip(boxID, rootDirPath, baseFolderName string, docPaths []string) (zipPath string) {
|
||||
dir, name := path.Split(baseFolderName)
|
||||
name = util.FilterFileName(name)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue