mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-27 10:46:09 +01:00
🎨 New export settings: Include sub-docs, Include related docs https://github.com/siyuan-note/siyuan/issues/13635
Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
parent
b2f8807dc0
commit
cf79a5db32
20 changed files with 112 additions and 8 deletions
|
|
@ -514,9 +514,12 @@ func ExportSYs(ids []string) (zipPath string) {
|
|||
bts := treenode.GetBlockTrees(ids)
|
||||
for _, bt := range bts {
|
||||
docPaths = append(docPaths, bt.Path)
|
||||
docFiles := box.ListFiles(strings.TrimSuffix(bt.Path, ".sy"))
|
||||
for _, docFile := range docFiles {
|
||||
docPaths = append(docPaths, docFile.path)
|
||||
|
||||
if Conf.Export.IncludeSubDocs {
|
||||
docFiles := box.ListFiles(strings.TrimSuffix(bt.Path, ".sy"))
|
||||
for _, docFile := range docFiles {
|
||||
docPaths = append(docPaths, docFile.path)
|
||||
}
|
||||
}
|
||||
}
|
||||
zipPath = exportSYZip(block.BoxID, path.Dir(block.Path), baseFolderName, docPaths)
|
||||
|
|
@ -1705,9 +1708,12 @@ func ExportPandocConvertZip(ids []string, pandocTo, ext string) (name, zipPath s
|
|||
bts := treenode.GetBlockTrees(ids)
|
||||
for _, bt := range bts {
|
||||
docPaths = append(docPaths, bt.Path)
|
||||
docFiles := box.ListFiles(strings.TrimSuffix(bt.Path, ".sy"))
|
||||
for _, docFile := range docFiles {
|
||||
docPaths = append(docPaths, docFile.path)
|
||||
|
||||
if Conf.Export.IncludeSubDocs {
|
||||
docFiles := box.ListFiles(strings.TrimSuffix(bt.Path, ".sy"))
|
||||
for _, docFile := range docFiles {
|
||||
docPaths = append(docPaths, docFile.path)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -3617,6 +3623,9 @@ func exportRefTrees(tree *parse.Tree, defBlockIDs *[]string, retTrees, treeCache
|
|||
}
|
||||
*defBlockIDs = append(*defBlockIDs, defID)
|
||||
|
||||
if !Conf.Export.IncludeRelatedDocs {
|
||||
return ast.WalkSkipChildren
|
||||
}
|
||||
exportRefTrees(defTree, defBlockIDs, retTrees, treeCache)
|
||||
} else if treenode.IsBlockLink(n) {
|
||||
defID := strings.TrimPrefix(n.TextMarkAHref, "siyuan://blocks/")
|
||||
|
|
@ -3641,6 +3650,9 @@ func exportRefTrees(tree *parse.Tree, defBlockIDs *[]string, retTrees, treeCache
|
|||
}
|
||||
*defBlockIDs = append(*defBlockIDs, defID)
|
||||
|
||||
if !Conf.Export.IncludeRelatedDocs {
|
||||
return ast.WalkSkipChildren
|
||||
}
|
||||
exportRefTrees(defTree, defBlockIDs, retTrees, treeCache)
|
||||
} else if ast.NodeAttributeView == n.Type {
|
||||
// 导出数据库所在文档时一并导出绑定块所在文档
|
||||
|
|
@ -3684,6 +3696,9 @@ func exportRefTrees(tree *parse.Tree, defBlockIDs *[]string, retTrees, treeCache
|
|||
}
|
||||
*defBlockIDs = append(*defBlockIDs, val.BlockID)
|
||||
|
||||
if !Conf.Export.IncludeRelatedDocs {
|
||||
return ast.WalkSkipChildren
|
||||
}
|
||||
exportRefTrees(defTree, defBlockIDs, retTrees, treeCache)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue