mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +01:00
🎨 支持合并子文档导出 Word/PDF https://github.com/siyuan-note/siyuan/issues/3219
This commit is contained in:
parent
7194e938d7
commit
ff664f1262
1 changed files with 6 additions and 4 deletions
|
|
@ -29,12 +29,15 @@ func mergeSubDocs(rootTree *parse.Tree) (ret *parse.Tree, err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
insertPoint := rootTree.Root.LastChild
|
insertPoint := rootTree.Root.LastChild
|
||||||
|
if nil == insertPoint {
|
||||||
|
insertPoint = rootTree.Root
|
||||||
|
}
|
||||||
|
|
||||||
for {
|
for {
|
||||||
i := 0
|
i := 0
|
||||||
if err = walkBlock(insertPoint, rootBlock, i); nil != err {
|
if err = walkBlock(insertPoint, rootBlock, i); nil != err {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if nil == rootBlock.Children {
|
if nil == rootBlock.Children {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
@ -44,13 +47,12 @@ func mergeSubDocs(rootTree *parse.Tree) (ret *parse.Tree, err error) {
|
||||||
|
|
||||||
func walkBlock(insertPoint *ast.Node, block *Block, level int) (err error) {
|
func walkBlock(insertPoint *ast.Node, block *Block, level int) (err error) {
|
||||||
level++
|
level++
|
||||||
for _, c := range block.Children {
|
for i := len(block.Children) - 1; i >= 0; i-- {
|
||||||
|
c := block.Children[i]
|
||||||
if err = walkBlock(insertPoint, c, level); nil != err {
|
if err = walkBlock(insertPoint, c, level); nil != err {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
for _, c := range block.Children {
|
|
||||||
nodes, loadErr := loadTreeNodes(c.Box, c.Path, level)
|
nodes, loadErr := loadTreeNodes(c.Box, c.Path, level)
|
||||||
if nil != loadErr {
|
if nil != loadErr {
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue